Author: cgutman
Date: Sun Jun 19 19:43:52 2011
New Revision: 52372
URL:
http://svn.reactos.org/svn/reactos?rev=52372&view=rev
Log:
[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
Modified:
trunk/reactos/drivers/filesystems/cdfs/common.c
trunk/reactos/drivers/filesystems/fastfat/rw.c
Modified: trunk/reactos/drivers/filesystems/cdfs/common.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/c…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/common.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/common.c [iso-8859-1] Sun Jun 19 19:43:52 2011
@@ -50,6 +50,7 @@
PIRP Irp;
NTSTATUS Status;
+again:
KeInitializeEvent(&Event,
NotificationEvent,
FALSE);
@@ -102,14 +103,19 @@
if (Status == STATUS_VERIFY_REQUIRED)
{
PDEVICE_OBJECT DeviceToVerify;
- NTSTATUS NewStatus;
DPRINT1("STATUS_VERIFY_REQUIRED\n");
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
- NewStatus = IoVerifyVolume(DeviceToVerify, FALSE);
- DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus);
+ Status = IoVerifyVolume(DeviceToVerify, FALSE);
+ 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);
@@ -146,6 +152,7 @@
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize,
OutputBufferSize ? *OutputBufferSize : 0);
+again:
KeInitializeEvent (&Event, NotificationEvent, FALSE);
DPRINT("Building device I/O control request ...\n");
@@ -191,7 +198,6 @@
if (Status == STATUS_VERIFY_REQUIRED)
{
PDEVICE_OBJECT DeviceToVerify;
- NTSTATUS NewStatus;
DPRINT1("STATUS_VERIFY_REQUIRED\n");
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
@@ -199,8 +205,14 @@
if (DeviceToVerify)
{
- NewStatus = IoVerifyVolume(DeviceToVerify, FALSE);
- DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus);
+ Status = IoVerifyVolume(DeviceToVerify, FALSE);
+ DPRINT1("IoVerifyVolume() returned (Status %lx)\n", Status);
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ DPRINT1("Volume verify succeeded; trying request again\n");
+ goto again;
}
}
Modified: trunk/reactos/drivers/filesystems/fastfat/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/rw.c [iso-8859-1] Sun Jun 19 19:43:52 2011
@@ -697,12 +697,11 @@
}
Status = VfatReadFileData(IrpContext, Length, ByteOffset, &ReturnedLength);
-/**/
if (Status == STATUS_VERIFY_REQUIRED)
{
- DPRINT("VfatReadFile returned STATUS_VERIFY_REQUIRED\n");
+ DPRINT("VfatReadFileData returned STATUS_VERIFY_REQUIRED\n");
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
- IoSetDeviceToVerify(PsGetCurrentThread(), DeviceToVerify);
+ IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
Status = IoVerifyVolume (DeviceToVerify, FALSE);
if (NT_SUCCESS(Status))
@@ -710,9 +709,8 @@
Status = VfatReadFileData(IrpContext, Length,
ByteOffset, &ReturnedLength);
}
-
- }
-/**/
+ }
+
if (NT_SUCCESS(Status))
{
IrpContext->Irp->IoStatus.Information = ReturnedLength;
@@ -769,6 +767,7 @@
ULONG OldAllocationSize;
PVOID Buffer;
ULONG BytesPerSector;
+ PDEVICE_OBJECT DeviceToVerify;
ASSERT(IrpContext);
@@ -990,6 +989,19 @@
}
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))
{
IrpContext->Irp->IoStatus.Information = Length;