sys: fsctl: oplock fixes

This commit is contained in:
Bill Zissimopoulos
2016-11-20 15:27:24 -08:00
parent ce551d4e0d
commit 127d4cc4eb
4 changed files with 18 additions and 43 deletions

View File

@ -432,30 +432,18 @@ static NTSTATUS FspFsvolFileSystemControlOplock(
}
/*
* It is possible for FspOplockFsctrl to complete the IRP immediately.
* In this case trying to access the IRP (to get its IrpFlags) in FspFileNodeRelease
* can lead to a bugcheck. For this reason we set the TopLevelIrp to NULL here.
* FspOplockFsctrl takes ownership of the IRP under all circumstances.
*
* FspFsvolFileSystemControlOplock does not need the TopLevelIrp functionality,
* because it cannot be used recursively (I believe -- famous last words).
* We mark the IRP pending so that we can safely return STATUS_PENDING.
*/
PIRP TopLevelIrp = IoGetTopLevelIrp();
IoSetTopLevelIrp(0);
Result = FspOplockFsctrl(FspFileNodeAddrOfOplock(FileNode), Irp, OplockCount);
IoMarkIrpPending(Irp);
Result = FspFileNodeOplockFsctl(FileNode, Irp, OplockCount);
FspFileNodeRelease(FileNode, Main);
if (!NT_SUCCESS(Result))
{
/* set back the top level IRP just in case! */
IoSetTopLevelIrp(TopLevelIrp);
FspIrpHookReset(Irp);
FspFree(CompletionContext);
return Result;
}
return STATUS_PENDING;
unlock_exit: