afs: prevent double release of global lock afs_xvcb 11/14411/2
authorMark Vitale <mvitale@sinenomine.net>
Fri, 28 Oct 2016 22:12:19 +0000 (18:12 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Sat, 24 Oct 2020 04:44:03 +0000 (00:44 -0400)
commite8702e6a615a160cdbe464f76bd6f100667720d2
treeaff21cc8806e9a2364ff342fc09337839b76f34a
parentfed176cc50512b4a5ae83c64b24c25e04198fa24
afs: prevent double release of global lock afs_xvcb

afs_GetServer calls ReleaseWriteLock(&afs_xvcb) twice within a few
lines.  The second one is spurious.

Commits b18653de7ae90491c2e75f4a98410581655d776c 'xserver lock order
violation' and f2bf60ed4f1323cd6f74f2f01114f7e4f714db53 'xvcb lock order
violation' were written by the same author at the same time and
apparently were victims of a bad merge.

Discovered during a lock audit project as a panic during afsd startup:

  assertion failed: (&afs_xvcb)->excl_locked == WRITE_LOCK, file:
  /home/mvitale/src/sna-openafs/src/afs/afs_server.c, line: 2089

afs_GetServer is called frequently by many threads and so this bug could
easily have released another thread's write lock on afs_xvcb.

Remove the spurious second release.

Change-Id: I495f4775e18ed37cfbccd03b5f25594586864b83
Reviewed-on: https://gerrit.openafs.org/14411
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/afs_server.c