From adfe378df858aef951b0a30b640e46ad1feefb2d Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 10 May 2011 12:54:53 -0500 Subject: [PATCH] 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. Reviewed-on: http://gerrit.openafs.org/4639 Tested-by: Andrew Deason Reviewed-by: Derrick Brashear (cherry picked from commit ae638fa383b8270fe2461a2ad91b9101c74f3593) Change-Id: I095c74f51f1ddb74ebaecda221ca45a4f6ad09c8 Reviewed-on: http://gerrit.openafs.org/4663 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/afs_callback.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index 5f980ffd5..9cc559785 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -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); } -- 2.39.5