sys: FspAcquireForModWrite: fix deadlock between the Lazy Writer and the Mod Writer.

This commit is contained in:
Bill Zissimopoulos
2016-04-13 12:15:56 -07:00
parent 7499c964b9
commit 279778265f

View File

@ -99,11 +99,20 @@ NTSTATUS FspAcquireForModWrite(
FSP_ENTER(PAGED_CODE());
FSP_FILE_NODE *FileNode = FileObject->FsContext;
BOOLEAN Success;
ASSERT((PIRP)FSRTL_MOD_WRITE_TOP_LEVEL_IRP == IoGetTopLevelIrp());
FspFileNodeAcquireExclusive(FileNode, Full);
Success = FspFileNodeTryAcquireExclusiveF(FileNode, FspFileNodeAcquireFull, FALSE);
if (Success)
{
*ResourceToRelease = FileNode->Header.PagingIoResource;
/* ignored by us, but ModWriter expects it; any (non-NULL) resource will do */
Result = STATUS_SUCCESS;
}
else
{
*ResourceToRelease = 0;
Result = STATUS_CANT_WAIT;
}
FSP_LEAVE("FileObject=%p", FileObject);
}