]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
libafs: Do not write-lock afs_xserver on ICBS
authorAndrew Deason <adeason@sinenomine.net>
Tue, 10 May 2011 17:54:53 +0000 (12:54 -0500)
committerDerrick Brashear <shadow@dementia.org>
Tue, 17 May 2011 14:45:53 +0000 (07:45 -0700)
Our RXAFSCB_InitCallBackState* handler currently write-locks
afs_xserver when it clears the SCAPS_KNOWN flag for the relevant
server. However, the afs_xserver lock is for protecting the global
list and hash table of server structures, and is not necessary to
acquire in order to modify the flags of an individual server struct.
For instance, CkSrv_GetCaps does not acquire any locks to modify the
server flags.

Taking this lock conflicts with a read lock on afs_xserver acquired by
afs_FlushVCBs when it traverses the list of server structures.
afs_FlushVCBs may contact a server that then calls InitCallBackState
on us, causing a deadlock if ICBS waits for the afs_xserver lock.

So, avoid locking afs_xserver in this case, to avoid that deadlock.

Reviewed-on: http://gerrit.openafs.org/4639
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit ae638fa383b8270fe2461a2ad91b9101c74f3593)

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

index 5f980ffd59b66c029ea8464d627963f1436e34ab..9cc55978525ada5bafcbdda1720acef83bcb603c 100644 (file)
@@ -771,9 +771,7 @@ SRXAFSCB_InitCallBackState(struct rx_call *a_call)
                }
 
            /* capabilities need be requested again */
-           ObtainWriteLock(&afs_xserver, 877);
            ts->flags &= ~SCAPS_KNOWN;
-           ReleaseWriteLock(&afs_xserver);
        }