- Fix infinite loop of verification and read attempts when a disc change occurs on VMware while ROS is running

svn path=/trunk/; revision=54750
This commit is contained in:
Cameron Gutman 2011-12-25 00:14:01 +00:00
parent aa885e24d7
commit eec24f8325

View file

@ -49,6 +49,7 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
KEVENT Event;
PIRP Irp;
NTSTATUS Status;
BOOLEAN LastChance = FALSE;
again:
KeInitializeEvent(&Event,
@ -104,18 +105,26 @@ again:
{
PDEVICE_OBJECT DeviceToVerify;
DPRINT1("STATUS_VERIFY_REQUIRED\n");
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
Status = IoVerifyVolume(DeviceToVerify, FALSE);
DPRINT1("IoVerifyVolume() returned (Status %lx)\n", Status);
if (NT_SUCCESS(Status))
if (NT_SUCCESS(Status) && !LastChance)
{
DPRINT1("Volume verify succeeded; trying request again\n");
DPRINT("Volume verify succeeded; trying request again\n");
LastChance = TRUE;
goto again;
}
else if (NT_SUCCESS(Status))
{
DPRINT1("Failed to read after successful verify, aborting\n");
Status = STATUS_DEVICE_NOT_READY;
}
else
{
DPRINT1("IoVerifyVolume() failed (Status %lx)\n", Status);
}
}
DPRINT("CdfsReadSectors() failed (Status %x)\n", Status);