mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-30 16:02:57 -05:00
dll,sys: fix issue #369
The original WinFsp protocol for shutting down a file system was to issue an FSP_FSCTL_STOP control code to the fsctl device. This would set the IOQ to the "stopped" state and would also cancel all active IRP's. Cancelation of IRP's would sometimes free buffers that may have still been in use by the user mode file system threads; hence access violation. To fix this problem a new control code FSP_FSCTL_STOP0 is introduced. The new file system shutdown protocol is backwards compatible with the original one and works as follows: - First the file system process issues an FSP_FSCTL_STOP0 control code which sets the IOQ to the "stopped" state but does NOT cancel IRP's. - Then the file system process waits for its dispatcher threads to complete (see FspFileSystemStopDispatcher). - Finally the file system process issues an FSP_FSCTL_STOP control code which stops the (already stopped) IOQ and cancels all IRP's.
This commit is contained in:
@ -85,6 +85,8 @@ extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid =
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 't', METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_STOP \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'S', METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_STOP0 \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 's', METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_NOTIFY \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'n', METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
@ -647,6 +649,7 @@ FSP_API NTSTATUS FspFsctlTransact(HANDLE VolumeHandle,
|
||||
PVOID RequestBuf, SIZE_T *PRequestBufSize,
|
||||
BOOLEAN Batch);
|
||||
FSP_API NTSTATUS FspFsctlStop(HANDLE VolumeHandle);
|
||||
FSP_API NTSTATUS FspFsctlStop0(HANDLE VolumeHandle);
|
||||
FSP_API NTSTATUS FspFsctlNotify(HANDLE VolumeHandle,
|
||||
FSP_FSCTL_NOTIFY_INFO *NotifyInfo, SIZE_T Size);
|
||||
FSP_API NTSTATUS FspFsctlGetVolumeList(PWSTR DevicePath,
|
||||
|
Reference in New Issue
Block a user