]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vol: fix nextVnodeUnique roll over
authorMichael Meffie <mmeffie@sinenomine.net>
Mon, 23 Dec 2013 16:42:19 +0000 (11:42 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 12 Mar 2014 12:52:16 +0000 (05:52 -0700)
Fixes for the per volume nextVnodeUnique counter roll over. Uniquifier number 1
is reserved for the root vnode, so reset the unique count to 2 when the
nextVnodeUnique counter rolls over.

Update the disk backed V_uniquifier count when the in-memory nextVnodeUnique
counter rolls over during the creation of a new vnode. If the nextVnodeUnique
rolls over when V_uniquifier is UINT32_MAX, then the V_uniquifier is not updated
and remains at UINT32_MAX until the next VUpdateVolume_r() call for the volume.

This bug is usually masked by the VBumpVolumeUsage(), which on every 128 volume
accesses, bumps the V_uniquifier to be 200 more than the current
nextVnodeUnique counter.  This causes the V_uniquifier to roll over before
reaching UINT32_MAX.  (The number of access before updating the headers is set
in the usage_threshold volume package option, which is currently set to 128 by
default.)

The following shows the unique counters for a series of vnode
creation/deletions before this commit.  The nextVnodeUnique rolls over to 1,
and the uniquifier is not reset.  The `usage_threshold' was set to a value
greater than 200 to avoid the VBumpVolumeUsage() calls during this test run.

fid = 536870918.4.4294967294, nextVnodeUnique = 4294967295, uniquifier = 4294967295
fid = 536870918.4.4294967295, nextVnodeUnique = 0, uniquifier = 4294967295
fid = 536870918.4.1, nextVnodeUnique = 2, uniquifier = 4294967295
fid = 536870918.4.2, nextVnodeUnique = 3, uniquifier = 4294967295

The following shows the unique counters after this commit:

fid = 536870918.4.4294967294, nextVnodeUnique = 4294967295, uniquifier = 4294967295
fid = 536870918.4.4294967295, nextVnodeUnique = 0, uniquifier = 4294967295
fid = 536870918.4.2, nextVnodeUnique = 3, uniquifier = 203
fid = 536870918.4.3, nextVnodeUnique = 4, uniquifier = 203

Reviewed-on: http://gerrit.openafs.org/10616
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 1a287c631ead0221828ae70e10c3cfd5563fdfb7)

Change-Id: I4d2bca2f3f1763f00e12de98f9dc4534c2ae51de
Reviewed-on: http://gerrit.openafs.org/10846
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/vol/vnode.c

index 2b69112364b212728298e67525499717a4c36bf7..a577eb8cd9cf27c518fef7da81ee6e0b9a115d70 100644 (file)
@@ -611,6 +611,7 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type)
 #ifdef AFS_DEMAND_ATTACH_FS
     VolState vol_state_save;
 #endif
+    int rollover = 0;
 
     *ec = 0;
 
@@ -645,10 +646,13 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type)
     }
 
     unique = vp->nextVnodeUnique++;
-    if (!unique)
+    if (unique == 0) {
+       rollover = 1;   /* nextVnodeUnique rolled over */
+       vp->nextVnodeUnique = 2;        /* 1 is reserved for the root vnode */
        unique = vp->nextVnodeUnique++;
+    }
 
-    if (vp->nextVnodeUnique > V_uniquifier(vp)) {
+    if (vp->nextVnodeUnique > V_uniquifier(vp) || rollover) {
        VUpdateVolume_r(ec, vp, 0);
        if (*ec)
            return NULL;