From: Jeffrey Altman Date: Fri, 18 May 2012 20:31:19 +0000 (-0400) Subject: Windows: avoid deadlock TreeLock vs Fcb Resource X-Git-Tag: upstream/1.8.0_pre1^2~2401 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=3a7dbe331580e418d1bdd5d75769512bb5e38cee;p=packages%2Fo%2Fopenafs.git Windows: avoid deadlock TreeLock vs Fcb Resource Cannot call AFSPerformObjectInvalidate directly because ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.TreeLock is held during the sequence AFSVerifyEntry->AFSValidateDirectoryCache->AFSVerifyDirectoryContent and AFSPerformObjectInvalidate requires the Fcb->NPFcb->Resource which must be held prior to the TreeLock. Change-Id: I337f52e2927c8e5ae2d218867987625c3240a792 Reviewed-on: http://gerrit.openafs.org/7423 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp index 763c45d6b..771041b0e 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp @@ -1070,12 +1070,22 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB, // // The ObjectReferenceCount will be freed by AFSPerformObjectInvalidate + // if successfully queued. Cannot call AFSPerformObjectInvalidate directly + // because ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.TreeLock is + // held during the sequence AFSVerifyEntry->AFSValidateDirectoryCache-> + // AFSVerifyDirectoryContent and AFSPerformObjectInvalidate requires the + // Fcb->NPFcb->Resource which must be held prior to the TreeLock in the + // lock hierarchy. // lCount = InterlockedIncrement( &pObjectInfo->ObjectReferenceCount); - AFSPerformObjectInvalidate( pObjectInfo, - AFS_INVALIDATE_DATA_VERSION); + if ( !NT_SUCCESS( AFSQueueInvalidateObject( pObjectInfo, + AFS_INVALIDATE_DATA_VERSION))) + { + + lCount = InterlockedDecrement( &pObjectInfo->ObjectReferenceCount); + } } else {