]> git.michaelhowe.org Git - packages/o/openafs.git/commit
Fix locking in afs_buffer.c
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Mon, 26 Oct 2009 17:06:20 +0000 (17:06 +0000)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 17 Dec 2009 07:00:17 +0000 (23:00 -0800)
commit7cb287abe44df635ecedaf722b86d03425d3845a
tree3c393cf0d276aa9d4d58afb5a158a7779297dc75
parent55ec00bf5d7ccfec2dda8121dd51db068d195fb9
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>
(cherry picked from commit b21b209f1cb2bafe916543c1ac8f232d6fc84847)
Reviewed-on: http://gerrit.openafs.org/980
src/afs/afs_buffer.c