mirror of
https://github.com/reactos/reactos.git
synced 2024-07-18 10:26:09 +00:00
[FASTFAT]
- Handle STATUS_VERIFY_REQUIRED for write requests - Clear the device to verify after retrieving it - Fixes write failure after changing floppy media [CDFS] - Reissue the I/O request if IoVerifyVolume was successful - Fixes read after a media change svn path=/trunk/; revision=52372
This commit is contained in:
parent
cef5719846
commit
e2d92bfd5e
|
@ -50,6 +50,7 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
again:
|
||||||
KeInitializeEvent(&Event,
|
KeInitializeEvent(&Event,
|
||||||
NotificationEvent,
|
NotificationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
@ -102,14 +103,19 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
|
||||||
if (Status == STATUS_VERIFY_REQUIRED)
|
if (Status == STATUS_VERIFY_REQUIRED)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceToVerify;
|
PDEVICE_OBJECT DeviceToVerify;
|
||||||
NTSTATUS NewStatus;
|
|
||||||
|
|
||||||
DPRINT1("STATUS_VERIFY_REQUIRED\n");
|
DPRINT1("STATUS_VERIFY_REQUIRED\n");
|
||||||
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||||
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
||||||
|
|
||||||
NewStatus = IoVerifyVolume(DeviceToVerify, FALSE);
|
Status = IoVerifyVolume(DeviceToVerify, FALSE);
|
||||||
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus);
|
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", Status);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Volume verify succeeded; trying request again\n");
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("CdfsReadSectors() failed (Status %x)\n", Status);
|
DPRINT("CdfsReadSectors() failed (Status %x)\n", Status);
|
||||||
|
@ -146,6 +152,7 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject,
|
||||||
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize,
|
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize,
|
||||||
OutputBufferSize ? *OutputBufferSize : 0);
|
OutputBufferSize ? *OutputBufferSize : 0);
|
||||||
|
|
||||||
|
again:
|
||||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
DPRINT("Building device I/O control request ...\n");
|
DPRINT("Building device I/O control request ...\n");
|
||||||
|
@ -191,7 +198,6 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject,
|
||||||
if (Status == STATUS_VERIFY_REQUIRED)
|
if (Status == STATUS_VERIFY_REQUIRED)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceToVerify;
|
PDEVICE_OBJECT DeviceToVerify;
|
||||||
NTSTATUS NewStatus;
|
|
||||||
|
|
||||||
DPRINT1("STATUS_VERIFY_REQUIRED\n");
|
DPRINT1("STATUS_VERIFY_REQUIRED\n");
|
||||||
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||||
|
@ -199,8 +205,14 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
if (DeviceToVerify)
|
if (DeviceToVerify)
|
||||||
{
|
{
|
||||||
NewStatus = IoVerifyVolume(DeviceToVerify, FALSE);
|
Status = IoVerifyVolume(DeviceToVerify, FALSE);
|
||||||
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus);
|
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Volume verify succeeded; trying request again\n");
|
||||||
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -697,12 +697,11 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = VfatReadFileData(IrpContext, Length, ByteOffset, &ReturnedLength);
|
Status = VfatReadFileData(IrpContext, Length, ByteOffset, &ReturnedLength);
|
||||||
/**/
|
|
||||||
if (Status == STATUS_VERIFY_REQUIRED)
|
if (Status == STATUS_VERIFY_REQUIRED)
|
||||||
{
|
{
|
||||||
DPRINT("VfatReadFile returned STATUS_VERIFY_REQUIRED\n");
|
DPRINT("VfatReadFileData returned STATUS_VERIFY_REQUIRED\n");
|
||||||
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||||
IoSetDeviceToVerify(PsGetCurrentThread(), DeviceToVerify);
|
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
||||||
Status = IoVerifyVolume (DeviceToVerify, FALSE);
|
Status = IoVerifyVolume (DeviceToVerify, FALSE);
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
@ -710,9 +709,8 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext)
|
||||||
Status = VfatReadFileData(IrpContext, Length,
|
Status = VfatReadFileData(IrpContext, Length,
|
||||||
ByteOffset, &ReturnedLength);
|
ByteOffset, &ReturnedLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**/
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
IrpContext->Irp->IoStatus.Information = ReturnedLength;
|
IrpContext->Irp->IoStatus.Information = ReturnedLength;
|
||||||
|
@ -769,6 +767,7 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
ULONG OldAllocationSize;
|
ULONG OldAllocationSize;
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
ULONG BytesPerSector;
|
ULONG BytesPerSector;
|
||||||
|
PDEVICE_OBJECT DeviceToVerify;
|
||||||
|
|
||||||
ASSERT(IrpContext);
|
ASSERT(IrpContext);
|
||||||
|
|
||||||
|
@ -990,6 +989,19 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = VfatWriteFileData(IrpContext, Length, ByteOffset);
|
Status = VfatWriteFileData(IrpContext, Length, ByteOffset);
|
||||||
|
if (Status == STATUS_VERIFY_REQUIRED)
|
||||||
|
{
|
||||||
|
DPRINT("VfatWriteFileData returned STATUS_VERIFY_REQUIRED\n");
|
||||||
|
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||||
|
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
||||||
|
Status = IoVerifyVolume (DeviceToVerify, FALSE);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
Status = VfatWriteFileData(IrpContext, Length, ByteOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
IrpContext->Irp->IoStatus.Information = Length;
|
IrpContext->Irp->IoStatus.Information = Length;
|
||||||
|
|
Loading…
Reference in a new issue