libafs: reset all the volumes with fs flushall
authorMichael Meffie <mmeffie@sinenomine.net>
Fri, 12 Jun 2015 00:28:43 +0000 (20:28 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 13 Jun 2015 16:28:53 +0000 (12:28 -0400)
Fix a logic bug in fs flushall in which only the first volume in each
hash chain is reset (invalidated).  Instead, reset all the volumes in
the volume hash.

This bug was introduced in commit 4197bbecd9d0b2ff0b8eaec75a0df9a64f713cf0
(libafs: fs flushall for unix cm)

Also, when flushing a single volume with fs flushvolume, don't bother
searching all the hash chains, instead start on the hash chain
containing the volume being flushed.

Change-Id: I7be67fdb310b4845d02dc916f4400f83cc649cb8
Reviewed-on: http://gerrit.openafs.org/11892
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/afs/afs_pioctl.c

index e0eab3a..53681e5 100644 (file)
@@ -3550,14 +3550,16 @@ FlushVolumeData(struct VenusFid *afid, afs_ucred_t * acred)
     ReleaseWriteLock(&afs_xdcache);
 
     ObtainReadLock(&afs_xvolume);
-    for (i = 0; i < NVOLS; i++) {
+    for (i = all ? 0 : VHash(volume); i < NVOLS; i++) {
        for (tv = afs_volumes[i]; tv; tv = tv->next) {
            if (all || tv->volume == volume) {
                afs_ResetVolumeInfo(tv);
-               break;
+               if (!all)
+                   goto last;
            }
        }
     }
+ last:
     ReleaseReadLock(&afs_xvolume);
 
     /* probably, a user is doing this, probably, because things are screwed up.