From 40d93cb9df62031f1dc5b185e690d11d2c2b9d0b Mon Sep 17 00:00:00 2001 From: Rod Widdowson Date: Sun, 25 Aug 2013 12:25:55 -0700 Subject: [PATCH] Windows: Take FCB resource in presection create. Fix a lock inversion in the paging query file information path (called from within section create). The query file takes the FCB resource, but that is a lower rank lock than the SOP resource which is taken in AcquireFileForNtCreateSection, We fix the inversion by grabbing the FCB resource in AcquireFileForNtCreateSection. Change-Id: I6ea8d2ebf9d454f78469e86765ae36e1993533b2 Reviewed-on: http://gerrit.openafs.org/10190 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- .../afsrdr/kernel/fs/AFSFastIoSupport.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/WINNT/afsrdr/kernel/fs/AFSFastIoSupport.cpp b/src/WINNT/afsrdr/kernel/fs/AFSFastIoSupport.cpp index 6ea12117a3..8f9ccac81f 100644 --- a/src/WINNT/afsrdr/kernel/fs/AFSFastIoSupport.cpp +++ b/src/WINNT/afsrdr/kernel/fs/AFSFastIoSupport.cpp @@ -264,6 +264,15 @@ AFSFastIoAcquireFile( IN struct _FILE_OBJECT *FileObject) AFSDbgTrace(( AFS_SUBSYSTEM_LOCK_PROCESSING, AFS_TRACE_LEVEL_VERBOSE, + "AFSFastIoAcquireFile Acquiring Fcb lock %p EXCL %08lX\n", + &pFcb->NPFcb->Resource, + PsGetCurrentThread())); + + AFSAcquireExcl( &pFcb->NPFcb->Resource, + TRUE); + + AFSDbgTrace(( AFS_SUBSYSTEM_LOCK_PROCESSING, + AFS_TRACE_LEVEL_VERBOSE, "AFSFastIoAcquireFile Acquiring Fcb SectionObject lock %p EXCL %08lX\n", &pFcb->NPFcb->SectionObjectResource, PsGetCurrentThread())); @@ -293,6 +302,17 @@ AFSFastIoReleaseFile( IN struct _FILE_OBJECT *FileObject) AFSFcb *pFcb = (AFSFcb *)FileObject->FsContext; + if( ExIsResourceAcquiredExclusiveLite( &pFcb->NPFcb->Resource)) + { + AFSDbgTrace(( AFS_SUBSYSTEM_LOCK_PROCESSING, + AFS_TRACE_LEVEL_VERBOSE, + "AFSFastIoReleaseFile Releasing Fcb Lock %p EXCL %08lX\n", + &pFcb->NPFcb->Resource, + PsGetCurrentThread())); + + AFSReleaseResource( &pFcb->NPFcb->Resource); + } + if( ExIsResourceAcquiredExclusiveLite( &pFcb->NPFcb->SectionObjectResource)) { PFILE_OBJECT fileObject = pFcb->Specific.File.SectionCreateFO;