mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 17:03:12 -05:00
sys: device.c: use ERESOURCE instead of fast/guarded mutex as a lock for Context table
This commit is contained in:
parent
58b16cdaae
commit
fd6c36b62c
@ -291,7 +291,7 @@ static NTSTATUS FspFsvolDeviceInit(PDEVICE_OBJECT DeviceObject)
|
|||||||
FsvolDeviceExtension->InitDoneIoq = 1;
|
FsvolDeviceExtension->InitDoneIoq = 1;
|
||||||
|
|
||||||
/* initialize our generic table */
|
/* initialize our generic table */
|
||||||
KeInitializeGuardedMutex(&FsvolDeviceExtension->GenericTableMutex);
|
ExInitializeResourceLite(&FsvolDeviceExtension->GenericTableResource);
|
||||||
RtlInitializeGenericTableAvl(&FsvolDeviceExtension->GenericTable,
|
RtlInitializeGenericTableAvl(&FsvolDeviceExtension->GenericTable,
|
||||||
FspFsvolDeviceCompareElement, FspFsvolDeviceAllocateElement, FspFsvolDeviceFreeElement, 0);
|
FspFsvolDeviceCompareElement, FspFsvolDeviceAllocateElement, FspFsvolDeviceFreeElement, 0);
|
||||||
FsvolDeviceExtension->InitDoneGenTab = 1;
|
FsvolDeviceExtension->InitDoneGenTab = 1;
|
||||||
@ -326,24 +326,25 @@ static VOID FspFsvolDeviceFini(PDEVICE_OBJECT DeviceObject)
|
|||||||
if (FsvolDeviceExtension->InitDoneTimer)
|
if (FsvolDeviceExtension->InitDoneTimer)
|
||||||
IoStopTimer(DeviceObject);
|
IoStopTimer(DeviceObject);
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* FspDeviceFreeElement is now a no-op, so this is no longer necessary */
|
|
||||||
/*
|
|
||||||
* Enumerate and delete all entries in the GenericTable.
|
|
||||||
* There is no need to protect accesses to the table as we are in the device destructor.
|
|
||||||
*/
|
|
||||||
if (FsvolDeviceExtension->InitDoneGenTab)
|
|
||||||
{
|
|
||||||
FSP_DEVICE_GENERIC_TABLE_ELEMENT_DATA *Element;
|
|
||||||
while (0 != (Element = RtlGetElementGenericTableAvl(&FsvolDeviceExtension->GenericTable, 0)))
|
|
||||||
RtlDeleteElementGenericTableAvl(&FsvolDeviceExtension->GenericTable, &Element->Identifier);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* delete the Ioq */
|
/* delete the Ioq */
|
||||||
if (FsvolDeviceExtension->InitDoneIoq)
|
if (FsvolDeviceExtension->InitDoneIoq)
|
||||||
FspIoqDelete(FsvolDeviceExtension->Ioq);
|
FspIoqDelete(FsvolDeviceExtension->Ioq);
|
||||||
|
|
||||||
|
if (FsvolDeviceExtension->InitDoneGenTab)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
/* FspDeviceFreeElement is now a no-op, so this is no longer necessary */
|
||||||
|
/*
|
||||||
|
* Enumerate and delete all entries in the GenericTable.
|
||||||
|
* There is no need to protect accesses to the table as we are in the device destructor.
|
||||||
|
*/
|
||||||
|
FSP_DEVICE_GENERIC_TABLE_ELEMENT_DATA *Element;
|
||||||
|
while (0 != (Element = RtlGetElementGenericTableAvl(&FsvolDeviceExtension->GenericTable, 0)))
|
||||||
|
RtlDeleteElementGenericTableAvl(&FsvolDeviceExtension->GenericTable, &Element->Identifier);
|
||||||
|
#endif
|
||||||
|
ExDeleteResourceLite(&FsvolDeviceExtension->GenericTableResource);
|
||||||
|
}
|
||||||
|
|
||||||
/* finalize our delete lock */
|
/* finalize our delete lock */
|
||||||
if (FsvolDeviceExtension->InitDoneDelRsc)
|
if (FsvolDeviceExtension->InitDoneDelRsc)
|
||||||
ExDeleteResourceLite(&FsvolDeviceExtension->DeleteResource);
|
ExDeleteResourceLite(&FsvolDeviceExtension->DeleteResource);
|
||||||
@ -413,7 +414,7 @@ VOID FspFsvolDeviceLockContextTable(PDEVICE_OBJECT DeviceObject)
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||||
KeAcquireGuardedMutex(&FsvolDeviceExtension->GenericTableMutex);
|
ExAcquireResourceExclusiveLite(&FsvolDeviceExtension->GenericTableResource, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FspFsvolDeviceUnlockContextTable(PDEVICE_OBJECT DeviceObject)
|
VOID FspFsvolDeviceUnlockContextTable(PDEVICE_OBJECT DeviceObject)
|
||||||
@ -421,7 +422,7 @@ VOID FspFsvolDeviceUnlockContextTable(PDEVICE_OBJECT DeviceObject)
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||||
KeReleaseGuardedMutex(&FsvolDeviceExtension->GenericTableMutex);
|
ExReleaseResourceLite(&FsvolDeviceExtension->GenericTableResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID FspFsvolDeviceLookupContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier)
|
PVOID FspFsvolDeviceLookupContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier)
|
||||||
|
@ -434,7 +434,7 @@ typedef struct
|
|||||||
KSPIN_LOCK ExpirationLock;
|
KSPIN_LOCK ExpirationLock;
|
||||||
WORK_QUEUE_ITEM ExpirationWorkItem;
|
WORK_QUEUE_ITEM ExpirationWorkItem;
|
||||||
BOOLEAN ExpirationInProgress;
|
BOOLEAN ExpirationInProgress;
|
||||||
KGUARDED_MUTEX GenericTableMutex;
|
ERESOURCE GenericTableResource;
|
||||||
RTL_AVL_TABLE GenericTable;
|
RTL_AVL_TABLE GenericTable;
|
||||||
PVOID GenericTableElementStorage;
|
PVOID GenericTableElementStorage;
|
||||||
UNICODE_STRING VolumeName;
|
UNICODE_STRING VolumeName;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user