mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 06:55:55 +00:00
File system drivers should forward the IRP_MJ_SHUTDOWN request to underlying storage drivers. Fixes bug #504.
svn path=/trunk/; revision=13594
This commit is contained in:
parent
7e682fbbd0
commit
4b76287e18
1 changed files with 44 additions and 7 deletions
|
@ -14,6 +14,34 @@
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
VfatDiskShutDown(PVCB Vcb)
|
||||||
|
{
|
||||||
|
PIRP Irp;
|
||||||
|
KEVENT Event;
|
||||||
|
NTSTATUS Status;
|
||||||
|
IO_STATUS_BLOCK IoStatus;
|
||||||
|
|
||||||
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||||
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_SHUTDOWN, Vcb->StorageDevice,
|
||||||
|
NULL, 0, NULL, &Event, &IoStatus);
|
||||||
|
if (Irp)
|
||||||
|
{
|
||||||
|
Status = IoCallDriver(Vcb->StorageDevice, Irp);
|
||||||
|
if (Status == STATUS_PENDING)
|
||||||
|
{
|
||||||
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||||
|
Status = IoStatus.Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Status = IoStatus.Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
{
|
{
|
||||||
|
@ -37,15 +65,24 @@ VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
|
|
||||||
ExAcquireResourceExclusiveLite(&DeviceExt->DirResource, TRUE);
|
ExAcquireResourceExclusiveLite(&DeviceExt->DirResource, TRUE);
|
||||||
Status = VfatFlushVolume(DeviceExt, DeviceExt->VolumeFcb);
|
Status = VfatFlushVolume(DeviceExt, DeviceExt->VolumeFcb);
|
||||||
ExReleaseResourceLite(&DeviceExt->DirResource);
|
if (NT_SUCCESS(Status))
|
||||||
if (!NT_SUCCESS(Status))
|
{
|
||||||
{
|
Status = VfatDiskShutDown(DeviceExt);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
DPRINT1("VfatDiskShutDown failed, status = %x\n", Status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DPRINT1("VfatFlushVolume failed, status = %x\n", Status);
|
DPRINT1("VfatFlushVolume failed, status = %x\n", Status);
|
||||||
Irp->IoStatus.Status = Status;
|
|
||||||
}
|
}
|
||||||
|
ExReleaseResourceLite(&DeviceExt->DirResource);
|
||||||
|
|
||||||
/* FIXME: Unmount the logical volume */
|
/* FIXME: Unmount the logical volume */
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
Irp->IoStatus.Status = Status;
|
||||||
}
|
}
|
||||||
ExReleaseResourceLite(&VfatGlobalData->VolumeListLock);
|
ExReleaseResourceLite(&VfatGlobalData->VolumeListLock);
|
||||||
|
|
||||||
/* FIXME: Free all global acquired resources */
|
/* FIXME: Free all global acquired resources */
|
||||||
|
|
||||||
|
@ -53,13 +90,13 @@ VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue