FBSD: close race in afs_root
authorBen Kaduk <kaduk@mit.edu>
Sat, 6 Nov 2010 04:02:31 +0000 (00:02 -0400)
committerDerrick Brashear <shadow@dementia.org>
Tue, 23 Nov 2010 12:50:35 +0000 (04:50 -0800)
commit76de77c7f9a6f58e7d7e85554decaa2ac959db07
tree6ea66c61645ab5a67ee5a81564fc3037c51ca924
parentf26f4651516b36263fd1de3c3aaa461ce623e71d
FBSD: close race in afs_root

Previously, we called afs_PutVCache(afs_globalVp) directly.  This
is unsafe because PutVCache acquires locks which can sleep, losing
the serialization of the GLOCK.  In rare circumstances, this can
result in two threads simultaneously making that call, and the
second one would panic in vputx() with a negative refcount.
Close the race by using a local variable for the afs_PutVCache()
calls, applying the change to afs_globalVp before dropping the GLOCK.
While here, fix up other race conditions.

Change-Id: Id62f27d4469a96c9becd9b031125bd6c910c3e9b
Reviewed-on: http://gerrit.openafs.org/3275
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/afs/FBSD/osi_vfsops.c