Fix locking in afs_buffer.c
Back in 2002,
0eb68f307aac84472a13523a0ce8b7a865f01ac7 was committed
to fix locking problems in dir/buffer.c.
Sadly, similar changes were never made to afs/afs_buffer.c, so the
same problems remain in the cache manager.
The issue here is with two processes racing in afs_newslot. Calls to
afs_newslot protect buffers with a zero reference count using
afs_bufferLock. If we release afs_bufferLock, before we increase the
reference count of the vcache, then we can end up with newslot
picking the same buffer for two different purposes.
The GLOCK actually protects us from the worst of this, but this fix
is necessary both for correctness, and for symmetry with the file
server buffer code.
Change-Id: I7f1c7d6571559c5f1784926c39d4889b77677231
Reviewed-on: http://gerrit.openafs.org/737
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>