From: Michael Meffie Date: Fri, 12 Jun 2015 00:28:43 +0000 (-0400) Subject: libafs: reset all the volumes with fs flushall X-Git-Tag: upstream/1.6.17^2~59 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e1655c9027ac60a5df8f9fdddf4add17b845c1e0;p=packages%2Fo%2Fopenafs.git 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. 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 (cherry picked from commit 82e02157fec248293e7336f0e0b3d1c9da545228) Change-Id: I5dddbaed265ee1ce5dc14e88e22abcb29d96db58 Reviewed-on: http://gerrit.openafs.org/11894 Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand Tested-by: Stephan Wiesand --- diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index fe76a711c..e91316abb 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -3516,14 +3516,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.