Update nextVnodeUnique before checking inUse
authorAndrew Deason <adeason@sinenomine.net>
Thu, 22 Apr 2010 16:54:06 +0000 (11:54 -0500)
committerDerrick Brashear <shadow@dementia.org>
Thu, 22 Apr 2010 19:30:10 +0000 (12:30 -0700)
When attaching a volume, update the nextVnodeUnique field for the
volume, before we do any checks on the volume; for example, checking
inUse, which may result in a demand-salvage if we are running DAFS.

If we do not do this, we can schedule a demand-salvage without setting
nextVnodeUnique, and VUpdateVolume_r will update the volume header
uniquifier to nextVnodeUnique+200, when nextVnodeUnique is not set.
So, we will always set the uniquifier to 200. Fortunately, the salvage
should usually fix the uniquifer anyway.

So, set nextVnodeUnique before doing any of those checks, to avoid
screwing up the uniquifier when taking the volume offline.

Change-Id: Ib211bbf5e93efbebcb679259944e7abf211aa6e1
Reviewed-on: http://gerrit.openafs.org/1809
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/vol/volume.c

index 990327f..41f9cce 100644 (file)
@@ -3206,6 +3206,7 @@ attach2(Error * ec, VolId volumeId, char *path, struct DiskPartition64 *partp,
     }
 
     VOL_LOCK;
+    vp->nextVnodeUnique = V_uniquifier(vp);
     if (VShouldCheckInUse(mode)) {
 #ifndef FAST_RESTART
        if (V_inUse(vp) && VolumeWriteable(vp)) {
@@ -3251,7 +3252,6 @@ attach2(Error * ec, VolId volumeId, char *path, struct DiskPartition64 *partp,
        }
     }
 
-    vp->nextVnodeUnique = V_uniquifier(vp);
     vp->vnodeIndex[vSmall].bitmap = vp->vnodeIndex[vLarge].bitmap = NULL;
 #ifndef BITMAP_LATER
     if (programType == fileServer && VolumeWriteable(vp)) {