From 82e02157fec248293e7336f0e0b3d1c9da545228 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Thu, 11 Jun 2015 20:28:43 -0400 Subject: [PATCH 1/1] libafs: reset all the volumes with fs flushall 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 Reviewed-by: Mark Vitale Reviewed-by: Chas Williams <3chas3@gmail.com> Reviewed-by: Jeffrey Altman --- src/afs/afs_pioctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index e0eab3a..53681e5 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -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. -- 1.9.4