mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 12:24:48 +00:00
[NTOSKRNL]
- Unregister dope (device object power extension) from volume list when device object is deleted - Core-6691 #resolve svn path=/trunk/; revision=57599
This commit is contained in:
parent
d1e0226d49
commit
f24aa3981d
3 changed files with 54 additions and 1 deletions
|
@ -285,6 +285,11 @@ PoVolumeDevice(
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
IN PDEVICE_OBJECT DeviceObject
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PoRemoveVolumeDevice(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Power State routines
|
// Power State routines
|
||||||
//
|
//
|
||||||
|
|
|
@ -1035,6 +1035,9 @@ IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
|
||||||
/* Set the pending delete flag */
|
/* Set the pending delete flag */
|
||||||
IoGetDevObjExtension(DeviceObject)->ExtensionFlags |= DOE_DELETE_PENDING;
|
IoGetDevObjExtension(DeviceObject)->ExtensionFlags |= DOE_DELETE_PENDING;
|
||||||
|
|
||||||
|
/* Unlink with the power manager */
|
||||||
|
if (DeviceObject->Vpb) PoRemoveVolumeDevice(DeviceObject);
|
||||||
|
|
||||||
/* Check if the device object can be unloaded */
|
/* Check if the device object can be unloaded */
|
||||||
if (!DeviceObject->ReferenceCount) IopUnloadDevice(DeviceObject);
|
if (!DeviceObject->ReferenceCount) IopUnloadDevice(DeviceObject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,51 @@ PoVolumeDevice(IN PDEVICE_OBJECT DeviceObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PoRemoveVolumeDevice(IN PDEVICE_OBJECT DeviceObject)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT_POWER_EXTENSION Dope;
|
||||||
|
PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
|
||||||
|
KIRQL OldIrql;
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
/* If the device already has the dope, return it */
|
||||||
|
DeviceExtension = IoGetDevObjExtension(DeviceObject);
|
||||||
|
if (!DeviceExtension->Dope)
|
||||||
|
{
|
||||||
|
/* no dope */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure we can flush safely */
|
||||||
|
KeAcquireGuardedMutex(&PopVolumeLock);
|
||||||
|
|
||||||
|
/* Get dope from device */
|
||||||
|
Dope = (PDEVICE_OBJECT_POWER_EXTENSION)DeviceExtension->Dope;
|
||||||
|
|
||||||
|
if (Dope->Volume.Flink)
|
||||||
|
{
|
||||||
|
/* Remove from volume from list */
|
||||||
|
RemoveEntryList(&Dope->Volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allow flushes to go through */
|
||||||
|
KeReleaseGuardedMutex(&PopVolumeLock);
|
||||||
|
|
||||||
|
/* Now remove dope from device object */
|
||||||
|
KeAcquireSpinLock(&PopDopeGlobalLock, &OldIrql);
|
||||||
|
|
||||||
|
/* remove from dev obj */
|
||||||
|
DeviceExtension->Dope = NULL;
|
||||||
|
|
||||||
|
/* Release lock */
|
||||||
|
KeReleaseSpinLock(&PopDopeGlobalLock, OldIrql);
|
||||||
|
|
||||||
|
/* Free dope */
|
||||||
|
ExFreePoolWithTag(Dope, 'Dope');
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
PopFlushVolumeWorker(IN PVOID Context)
|
PopFlushVolumeWorker(IN PVOID Context)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue