afs: Assert avc->lock is held in afs_IAS_once 92/14592/3
authorAndrew Deason <adeason@sinenomine.net>
Mon, 12 Apr 2021 23:21:23 +0000 (18:21 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 13 May 2021 16:54:35 +0000 (12:54 -0400)
commit72223e0958c2d7cddd968970547dd73fc3cc1351
treeb776108a92310f0ced2aeda97ded0f08134f8280
parentf02be4e3b89382317a3baa496f9cb672cdb4b32a
afs: Assert avc->lock is held in afs_IAS_once

Commit 3be5880d (afs: Avoid panics in afs_InvalidateAllSegments) added
an assert to check that vcache->lock is write-locked before we call
afs_InvalidateAllSegments_once from a background operation.

However, afs_InvalidateAllSegments_once should always be called with
vcache->lock write-locked; there's nothing specific about the
backgrounded call that requires this. So to make sure we catch all
cases, move this assert to afs_InvalidateAllSegments_once itself.

Also remove the conditional check for WriteLocked(&avc->lock) in here,
since clearly avc->lock must be write-locked (and actually is, since
change Ic309e4006bf47bcb38fa2b53bf103e0c645a856d "afs: write-lock
vcache->lock in afs_InactiveVCache").

Add some comments to this function while we're here, to more clearly
indicate what locks are needed.

Change-Id: I10c47021e94220879cd79c0f7390c52a13ee0eee
Reviewed-on: https://gerrit.openafs.org/14592
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/afs_daemons.c
src/afs/afs_segments.c