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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
Rod Widdowson 2013-08-25 12:25:55 -07:00 committed by Jeffrey Altman
parent 1dc051294c
commit 40d93cb9df

View File

@ -262,6 +262,15 @@ AFSFastIoAcquireFile( IN struct _FILE_OBJECT *FileObject)
AFSFcb *pFcb = (AFSFcb *)FileObject->FsContext;
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",
@ -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;