sys: fsctl

This commit is contained in:
Bill Zissimopoulos 2015-12-21 16:04:10 -08:00
parent e71ecd5fa1
commit 68eefd9e24

View File

@ -394,24 +394,17 @@ static NTSTATUS FspFsctlTransact(
PIRP ProcessIrp, PendingIrp; PIRP ProcessIrp, PendingIrp;
LARGE_INTEGER Timeout; LARGE_INTEGER Timeout;
Result = STATUS_SUCCESS;
FsContext2 = IrpSp->FileObject->FsContext2; FsContext2 = IrpSp->FileObject->FsContext2;
ExAcquireFastMutex(&FsContext2->FastMutex); ExAcquireFastMutex(&FsContext2->FastMutex);
try try
{ {
/* check to see if we already have a volume */ /* check to see if we already have a volume */
FsvolDeviceObject = FsContext2->FsvolDeviceObject; FsvolDeviceObject = FsContext2->FsvolDeviceObject;
if (0 != FsvolDeviceObject) if (0 == FsvolDeviceObject)
{
BOOLEAN Success; (VOID)Success;
/* this must succeed because our volume device exists until IRP_MJ_CLEANUP */
Success = FspDeviceRetain(FsvolDeviceObject);
ASSERT(Success);
Result = STATUS_SUCCESS;
}
else
Result = STATUS_ACCESS_DENIED; Result = STATUS_ACCESS_DENIED;
/* no need to FspDeviceRetain our volume device, because it exists until IRP_MJ_CLEANUP */
} }
finally finally
{ {
@ -420,8 +413,6 @@ static NTSTATUS FspFsctlTransact(
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
return Result; return Result;
try
{
FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject); FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
/* process any user-mode file system responses */ /* process any user-mode file system responses */
@ -447,8 +438,7 @@ static NTSTATUS FspFsctlTransact(
if (0 == Irp->MdlAddress) if (0 == Irp->MdlAddress)
{ {
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
Result = STATUS_SUCCESS; return STATUS_SUCCESS;
goto exit;
} }
MdlBuffer = MmGetMdlVirtualAddress(Irp->MdlAddress); MdlBuffer = MmGetMdlVirtualAddress(Irp->MdlAddress);
ASSERT(0 != MdlBuffer); ASSERT(0 != MdlBuffer);
@ -460,16 +450,12 @@ static NTSTATUS FspFsctlTransact(
while (0 == (PendingIrp = FspIoqNextPendingIrp(&FsvolDeviceExtension->Ioq, &Timeout))) while (0 == (PendingIrp = FspIoqNextPendingIrp(&FsvolDeviceExtension->Ioq, &Timeout)))
{ {
if (FspIoqStopped(&FsvolDeviceExtension->Ioq)) if (FspIoqStopped(&FsvolDeviceExtension->Ioq))
{ return STATUS_CANCELLED;
Result = STATUS_CANCELLED;
goto exit;
}
} }
if (FspIoqTimeout == PendingIrp) if (FspIoqTimeout == PendingIrp)
{ {
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
Result = STATUS_SUCCESS; return STATUS_SUCCESS;
goto exit;
} }
/* send any pending IRP's to the user-mode file system */ /* send any pending IRP's to the user-mode file system */
@ -498,8 +484,7 @@ static NTSTATUS FspFsctlTransact(
*/ */
ASSERT(FspIoqStopped(&FsvolDeviceExtension->Ioq)); ASSERT(FspIoqStopped(&FsvolDeviceExtension->Ioq));
FspIopCompleteIrp(PendingIrp, STATUS_CANCELLED); FspIopCompleteIrp(PendingIrp, STATUS_CANCELLED);
Result = STATUS_CANCELLED; return STATUS_CANCELLED;
goto exit;
} }
/* check that we have enough space before pulling the next pending IRP off the queue */ /* check that we have enough space before pulling the next pending IRP off the queue */
@ -516,13 +501,6 @@ static NTSTATUS FspFsctlTransact(
Irp->IoStatus.Information = (PUINT8)Request - (PUINT8)MdlBuffer; Irp->IoStatus.Information = (PUINT8)Request - (PUINT8)MdlBuffer;
Result = STATUS_SUCCESS; Result = STATUS_SUCCESS;
exit:;
}
finally
{
FspDeviceRelease(FsvolDeviceObject);
}
return Result; return Result;
} }