mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
volser: Do not FSYNC_VOL_DONE temporary volumes
Currently, the volserver just looks at the destroyMe field in a volume
header to see if it should tell the fileserver a volume has been
deleted (FSYNC_VOL_DONE opcode). However, temporary volumes created by
the volserver (such as new volumes or clones) have destroyMe set, but
are obviously not deleted, and so the fileserver should just be told
FSYNC_VOL_LEAVE_OFF about these volumes instead.
With commit bb9caf9822
, FSYNC_VOL_DONE
and FSYNC_VOL_LEAVE_OFF actually do different things, so this does
make a difference.
Note that this commit slightly changes the meaning of the
vp->needsPutBack field. Now it must be set to VOL_PUTBACK_DELETE to
tell the fileserver that the volume has been deleted, and set to
VOL_PUTBACK if it just needs to be given back to the fileserver.
Change-Id: I020679c853b93593e5c75c4f30ac56312ba0f8d6
Reviewed-on: http://gerrit.openafs.org/2872
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
0b6b2b3cab
commit
5988923898
@ -2418,7 +2418,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode)
|
||||
if (mode == V_PEEK) {
|
||||
vp->needsPutBack = 0;
|
||||
} else {
|
||||
vp->needsPutBack = 1;
|
||||
vp->needsPutBack = VOL_PUTBACK;
|
||||
}
|
||||
#else /* !AFS_DEMAND_ATTACH_FS */
|
||||
/* duplicate computation in fssync.c about whether the server
|
||||
@ -2429,7 +2429,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode)
|
||||
|| (!VolumeWriteable(vp) && (mode == V_CLONE || mode == V_DUMP)))
|
||||
vp->needsPutBack = 0;
|
||||
else
|
||||
vp->needsPutBack = 1;
|
||||
vp->needsPutBack = VOL_PUTBACK;
|
||||
#endif /* !AFS_DEMAND_ATTACH_FS */
|
||||
}
|
||||
#ifdef FSSYNC_BUILD_CLIENT
|
||||
@ -4180,7 +4180,7 @@ VDetachVolume_r(Error * ec, Volume * vp)
|
||||
if (VCanUseFSSYNC()) {
|
||||
notifyServer = vp->needsPutBack;
|
||||
if (V_destroyMe(vp) == DESTROY_ME)
|
||||
useDone = FSYNC_VOL_DONE;
|
||||
useDone = FSYNC_VOL_LEAVE_OFF;
|
||||
#ifdef AFS_DEMAND_ATTACH_FS
|
||||
else if (!V_blessed(vp) || !V_inService(vp))
|
||||
useDone = FSYNC_VOL_LEAVE_OFF;
|
||||
@ -4209,6 +4209,12 @@ VDetachVolume_r(Error * ec, Volume * vp)
|
||||
*/
|
||||
#ifdef FSSYNC_BUILD_CLIENT
|
||||
if (VCanUseFSSYNC() && notifyServer) {
|
||||
if (notifyServer == VOL_PUTBACK_DELETE) {
|
||||
/* Only send FSYNC_VOL_DONE if the volume was actually deleted.
|
||||
* volserver code will set needsPutBack to VOL_PUTBACK_DELETE
|
||||
* to signify a deleted volume. */
|
||||
useDone = FSYNC_VOL_DONE;
|
||||
}
|
||||
/*
|
||||
* Note: The server is not notified in the case of a bogus volume
|
||||
* explicitly to make it possible to create a volume, do a partial
|
||||
|
@ -654,10 +654,15 @@ typedef struct Volume {
|
||||
bit32 cacheCheck; /* Online sequence number to be used to invalidate vnode cache entries
|
||||
* that stayed around while a volume was offline */
|
||||
short nUsers; /* Number of users of this volume header */
|
||||
byte needsPutBack; /* For a volume utility, this flag is set if we need
|
||||
* to give the volume back when we detach it. The server has
|
||||
#define VOL_PUTBACK 1
|
||||
#define VOL_PUTBACK_DELETE 2
|
||||
byte needsPutBack; /* For a volume utility, this flag is set to VOL_PUTBACK if we
|
||||
* need to give the volume back when we detach it. The server has
|
||||
* certain modes where it doesn't detach the volume, and
|
||||
* if we give it back spuriously, the server aborts. This field
|
||||
* if we give it back spuriously, the server aborts. If set to
|
||||
* VOL_PUTBACK_DELETE, it indicates that we need to tell the
|
||||
* fileserver that the volume is gone entirely, instead of just
|
||||
* giving the volume back to the fileserver. This field
|
||||
* is meaningless on the file server */
|
||||
byte specialStatus; /* An error code to return on VGetVolume: the
|
||||
* volume is unavailable for the reason quoted,
|
||||
|
@ -633,7 +633,10 @@ VolDeleteVolume(struct rx_call *acid, afs_int32 atrans)
|
||||
Log("%s is executing Delete Volume %u\n", caller, tt->volid);
|
||||
TSetRxCall(tt, acid, "DeleteVolume");
|
||||
VPurgeVolume(&error, tt->volume); /* don't check error code, it is not set! */
|
||||
V_destroyMe(tt->volume) = DESTROY_ME; /* so endtrans does the right fssync opcode */
|
||||
V_destroyMe(tt->volume) = DESTROY_ME;
|
||||
if (tt->volume->needsPutBack) {
|
||||
tt->volume->needsPutBack = VOL_PUTBACK_DELETE; /* so endtrans does the right fssync opcode */
|
||||
}
|
||||
VTRANS_OBJ_LOCK(tt);
|
||||
tt->vflags |= VTDeleted; /* so we know not to do anything else to it */
|
||||
TClearRxCall_r(tt);
|
||||
|
Loading…
Reference in New Issue
Block a user