mirror of
https://github.com/reactos/reactos.git
synced 2024-10-20 08:01:05 +00:00
- Respect DeviceIsLocked flag and Alertable in IopMountVolume
- Don't mount if the VPB is alread ymoutned or being removed - Bugcheck the system if we failed to mount the boot partition. svn path=/trunk/; revision=22760
This commit is contained in:
parent
e3ec87ef6d
commit
2dfe23b2f6
|
@ -330,6 +330,23 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
LIST_ENTRY LocalList;
|
LIST_ENTRY LocalList;
|
||||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
ASSERT_IRQL(PASSIVE_LEVEL);
|
||||||
|
|
||||||
|
/* Check if the device isn't already locked */
|
||||||
|
if (!DeviceIsLocked)
|
||||||
|
{
|
||||||
|
/* Lock it ourselves */
|
||||||
|
Status = KeWaitForSingleObject(&DeviceObject->DeviceLock,
|
||||||
|
Executive,
|
||||||
|
KeGetPreviousMode(),
|
||||||
|
Alertable,
|
||||||
|
NULL);
|
||||||
|
if ((Status == STATUS_ALERTED) || (Status == STATUS_USER_APC))
|
||||||
|
{
|
||||||
|
/* Don't mount if we were interrupted */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Acquire the FS Lock*/
|
||||||
KeEnterCriticalRegion();
|
KeEnterCriticalRegion();
|
||||||
ExAcquireResourceSharedLite(&FileSystemListLock, TRUE);
|
ExAcquireResourceSharedLite(&FileSystemListLock, TRUE);
|
||||||
|
|
||||||
|
@ -351,7 +368,11 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
FsList = &IopTapeFsListHead;
|
FsList = &IopTapeFsListHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure we weren't already mounted */
|
||||||
|
if (!(DeviceObject->Vpb->Flags & (VPB_MOUNTED | VPB_REMOVE_PENDING)))
|
||||||
|
{
|
||||||
/* Now loop the fs list until one of the file systems accepts us */
|
/* Now loop the fs list until one of the file systems accepts us */
|
||||||
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
ListEntry = FsList->Flink;
|
ListEntry = FsList->Flink;
|
||||||
while (ListEntry != FsList)
|
while (ListEntry != FsList)
|
||||||
{
|
{
|
||||||
|
@ -398,10 +419,39 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
ListEntry = ListEntry->Flink;
|
ListEntry = ListEntry->Flink;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (DeviceObject->Vpb->Flags & VPB_REMOVE_PENDING)
|
||||||
|
{
|
||||||
|
/* Someone wants to remove us */
|
||||||
|
Status = STATUS_DEVICE_DOES_NOT_EXIST;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Someone already mounted us */
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release the FS lock */
|
||||||
ExReleaseResourceLite(&FileSystemListLock);
|
ExReleaseResourceLite(&FileSystemListLock);
|
||||||
KeLeaveCriticalRegion();
|
KeLeaveCriticalRegion();
|
||||||
return(STATUS_UNRECOGNIZED_VOLUME);
|
|
||||||
|
/* Release the device lock if we're holding it */
|
||||||
|
if (DeviceIsLocked) KeSetEvent(&DeviceObject->DeviceLock, 0, FALSE);
|
||||||
|
|
||||||
|
/* Check if we failed to mount the boot partition */
|
||||||
|
if ((!NT_SUCCESS(Status)) &&
|
||||||
|
(DeviceObject->Flags & DO_SYSTEM_BOOT_PARTITION))
|
||||||
|
{
|
||||||
|
/* Bugcheck the system */
|
||||||
|
KeBugCheckEx(INACCESSIBLE_BOOT_DEVICE,
|
||||||
|
(ULONG_PTR)DeviceObject,
|
||||||
|
Status,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the mount status */
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS **********************************************************/
|
/* PUBLIC FUNCTIONS **********************************************************/
|
||||||
|
|
Loading…
Reference in a new issue