From: Andrew Deason Date: Tue, 10 May 2011 17:54:53 +0000 (-0500) Subject: libafs: Do not write-lock afs_xserver on ICBS X-Git-Tag: upstream/1.8.0_pre1^2~3754 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ae638fa383b8270fe2461a2ad91b9101c74f3593;p=packages%2Fo%2Fopenafs.git libafs: Do not write-lock afs_xserver on ICBS 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. Change-Id: Id4dea74ce85726a3da07f738e301600f46059297 Reviewed-on: http://gerrit.openafs.org/4639 Tested-by: Andrew Deason Reviewed-by: Derrick Brashear --- diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index 05d2361bd..d9d24f8f4 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -766,9 +766,7 @@ SRXAFSCB_InitCallBackState(struct rx_call *a_call) } /* capabilities need be requested again */ - ObtainWriteLock(&afs_xserver, 877); ts->flags &= ~SCAPS_KNOWN; - ReleaseWriteLock(&afs_xserver); }