sys: IRP_MJ_CREATE: oplock support

This commit is contained in:
Bill Zissimopoulos 2016-11-10 15:03:58 -08:00
parent fb70eccc9c
commit e50c9ff649

View File

@ -1040,10 +1040,15 @@ static NTSTATUS FspFsvolCreateSharingViolationWork(
KEVENT Event; KEVENT Event;
NTSTATUS Result; NTSTATUS Result;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
FspFileNodeAcquireShared(FileNode, Main); FspFileNodeAcquireShared(FileNode, Main);
Result = FspCheckOplockEx(FspFileNodeAddrOfOplock(FileNode), Irp,
OPLOCK_FLAG_OPLOCK_KEY_CHECK_ONLY, 0, 0, 0);
if (!NT_SUCCESS(Result))
goto exit;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
if (FsRtlCurrentBatchOplock(FspFileNodeAddrOfOplock(FileNode))) if (FsRtlCurrentBatchOplock(FspFileNodeAddrOfOplock(FileNode)))
{ {
Result = FspCheckOplock(FspFileNodeAddrOfOplock(FileNode), Irp, Result = FspCheckOplock(FspFileNodeAddrOfOplock(FileNode), Irp,
@ -1053,10 +1058,11 @@ static NTSTATUS FspFsvolCreateSharingViolationWork(
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, 0); KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, 0);
if (STATUS_SUCCESS == Irp->IoStatus.Status) if (STATUS_SUCCESS == Irp->IoStatus.Status)
OpbatchBreakUnderway = TRUE; OpbatchBreakUnderway = TRUE;
KeResetEvent(&Event);
} }
} }
KeResetEvent(&Event);
Result = FspOplockBreakH(FspFileNodeAddrOfOplock(FileNode), Irp, 0, Result = FspOplockBreakH(FspFileNodeAddrOfOplock(FileNode), Irp, 0,
&Event, FspFsvolCreateSharingViolationOplockComplete, 0); &Event, FspFsvolCreateSharingViolationOplockComplete, 0);
if (STATUS_PENDING == Result) if (STATUS_PENDING == Result)
@ -1066,6 +1072,7 @@ static NTSTATUS FspFsvolCreateSharingViolationWork(
StatusSharingViolation = FALSE; StatusSharingViolation = FALSE;
} }
exit:
FspFileNodeRelease(FileNode, Main); FspFileNodeRelease(FileNode, Main);
FspFileNodeClose(FileNode, IrpSp->FileObject, FALSE, TRUE); FspFileNodeClose(FileNode, IrpSp->FileObject, FALSE, TRUE);