1
0
mirror of https://github.com/winfsp/winfsp.git synced 2026-06-26 06:18:21 -05:00
Commit Graph

126 Commits

Author SHA1 Message Date
yeonsh 82f59837f6 sys: fix FileRenameResource self-deadlock between notify session and FspVolumeNotifyWork
Under heavy concurrent rename + change-notification load a volume can
deadlock permanently: all renames (exclusive) and opens (shared) on the
volume block, freezing the mount.

FspFileSystemNotifyBegin (FspVolumeNotifyLock) acquires the per-volume
FileRenameResource shared via an owner pointer (&VolumeNotifyCount) and
holds it for the whole Begin/End session. If a rename queues as an
exclusive waiter mid-session, the asynchronous FspVolumeNotifyWork then
re-acquires the same resource shared with ExAcquireResourceSharedLite.
Due to ERESOURCE writer-priority that shared acquire blocks behind the
queued exclusive waiter (the worker thread is not the owner -- the owner
is the &VolumeNotifyCount pointer). But that work item is the one that
must process FspFileSystemNotifyEnd to drop VolumeNotifyCount to 0 and
release the session, so it can never run: the session lock is never
released and the rename waits forever, while VolumeNotifyCount runs away
as Begin keeps incrementing it.

Acquire the rename resource in FspVolumeNotifyWork with
ExAcquireSharedStarveExclusive instead. The enclosing Begin/End session
already holds the resource shared and already defers renames until End,
so granting this redundant shared acquire ahead of the queued exclusive
waiter preserves name-stability semantics while breaking the deadlock. A
real exclusive holder still blocks the starve-exclusive acquire, so
correctness is unchanged.
2026-06-05 22:48:47 +09:00
Bill Zissimopoulos 624f285452 update source copyright for 2026 2026-03-04 15:54:27 +02:00
Bill Zissimopoulos c8366af48c update source copyright for 2025 2025-05-15 20:33:31 +01:00
Bill Zissimopoulos 7551193ad7 update source copyright to 2024 2024-01-08 12:38:44 +00:00
Bill Zissimopoulos 7f73192f8d sys: FspVolumeCreate
If we have an fsvrt device, mount it via opening the volume.
This ensures that the fsvrt is mounted by the correct fsvol
device early on and remedies a rare case where NTFS crashes
the system when it attempts to mount our fsvrt.
2022-10-02 20:10:32 +01:00
Bill Zissimopoulos f1cfe758ec sys: RejectIrpPriorToTransact0 is always 1 2022-06-29 15:08:34 +01:00
Bill Zissimopoulos a731f0e5d8 sys,dll: MountUseMountmgrFromFSD 2022-06-27 17:28:24 +01:00
Bill Zissimopoulos 2e441534a3 sys: FspFsvolDeviceLockVolumeNotify 2022-06-10 16:20:19 +01:00
Bill Zissimopoulos 66f3620808 sys: FSP_FSVOL_DEVICE_EXTENSION::VolumeDeleteResource 2022-06-10 16:20:13 +01:00
Bill Zissimopoulos 805742f306 sys: FSP_FSVOL_DEVICE_EXTENSION::VolumeDeleteResource 2022-06-10 16:20:08 +01:00
Bill Zissimopoulos a7a526351f sys: keep extra fsvol device reference
Reference an fsvol device at CREATE time and dereference at CLOSE time,
to ensure that fsvol remains around for DeviceIoControl operations done
after CLEANUP.
2022-06-09 14:28:31 +01:00
Bill Zissimopoulos c0fa5696d7 sys: FspVolumeFastTransact 2022-05-17 17:25:18 +01:00
Bill Zissimopoulos 43af829d46 sys,dll,inc: FSP_IOCTL_TRANSACT 2022-05-16 21:40:01 +01:00
Bill Zissimopoulos 228f1d658d sys: FspVolumeNotify: allow multiple outstanding calls to FspFileSystemNotifyBegin 2022-01-15 15:46:56 +00:00
Bill Zissimopoulos 57fce78ff3 sys: FspVolumeNotifyWork: always acquire the rename lock shared 2022-01-12 15:43:05 +00:00
Bill Zissimopoulos 751eaa69df update source copyright to 2022 2022-01-07 17:30:49 +00:00
Bill Zissimopoulos 6e3a8f70b2 update source copyright to 2021 2021-05-21 15:57:05 -07:00
Bill Zissimopoulos ca832988ed 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.
2021-05-18 12:30:17 -07:00
Bill Zissimopoulos 6b4b1dff6c sys: notify implementation 2020-10-09 15:19:51 -07:00
Bill Zissimopoulos 3687df53c6 sys: wait groups and notify implementation 2020-10-09 12:40:49 -07:00
Bill Zissimopoulos a004e4be10 sys: notify implementation 2020-10-08 20:49:24 -07:00
Bill Zissimopoulos 7f360827f6 sys: notify implementation 2020-10-08 15:31:41 -07:00
Bill Zissimopoulos 01f91c771d sys: notify implementation 2020-10-07 17:07:35 -07:00
Bill Zissimopoulos 844fb7171e inc,dll,sys: notify implementation skeleton 2020-10-06 16:37:33 -07:00
Bill Zissimopoulos 84e0744c28 sys: FspVolumeTransact: FSP_FSCTL_TRANSACT_INTERNAL
Zero out OutputBuffer on error to avoid confusion for fsext providers.
2020-07-29 22:51:17 -07:00
Bill Zissimopoulos aa3beba928 sys: silo support 2020-06-05 15:47:19 -07:00
Bill Zissimopoulos 71995a1fcd dll,sys: FSP_CFG_REJECT_EARLY_IRP
Includes Avast fix for FUSE.
2020-02-07 15:11:24 -08:00
Bill Zissimopoulos 8497855d80 sys: FSP_DEVICE_REJECT_EARLY_IRP macro 2020-02-07 13:22:09 -08:00
Bill Zissimopoulos bf6d56ceac inc,sys,tst: FSP_FSCTL_VOLUME_PARAMS::RejectIrpPriorToTransact0 2020-02-03 16:38:55 -08:00
Bill Zissimopoulos 51350d5a42 inc,sys,tst: FSP_FSCTL_VOLUME_PARAMS::RejectIrpPriorToTransact 2020-02-03 14:59:23 -08:00
Bill Zissimopoulos aedf01a384 update source copyright for 2020 2020-01-02 17:50:40 -08:00
Bill Zissimopoulos 254174b8e9 sys: avoid using FspFsextProvider unnecessarily 2019-11-04 16:30:30 -08:00
Bill Zissimopoulos 05b37c744b sys,dll: only user mode sends MountManager IOCTL's
(except for cleanup in FspMountdevFini)
2019-09-08 17:45:00 -07:00
Bill Zissimopoulos 9436fd8402 sys: implement SectorSize queries
- IRP_MJ_QUERY_VOLUME_INFORMATION/FileFsSectorSizeInformation
- IOCTL_STORAGE_QUERY_PROPERTY/StorageAccessAlignmentProperty
2019-09-06 20:52:15 -07:00
Bill Zissimopoulos 4655926d03 sys, dll: mount manager support 2019-09-06 14:24:00 -07:00
Bill Zissimopoulos 565caebe4c sys,dll: FspFileSystemSetMountPoint: mount manager support 2019-09-05 19:58:14 -07:00
Bill Zissimopoulos ebb9b8b799 sys: FspVolumeTransact: remove erroneous ASSERT 2019-06-23 11:07:01 -07:00
Bill Zissimopoulos 804bcc3354 sys: FspVolumeTransactFsext:
- only allow ControlCodes with 0xC00 bits set in Function
2019-06-22 15:40:48 -07:00
Bill Zissimopoulos f5fde4c0bb sys: FspVolumeTransactFsext 2019-06-22 15:18:16 -07:00
Bill Zissimopoulos dcf7e4c5a6 sys: fsext: FsextProvider testing 2019-06-22 14:30:23 -07:00
Bill Zissimopoulos adc759447e sys: FspVolumeCreate: fix missing return 2019-06-21 16:37:07 -07:00
Bill Zissimopoulos b637a72ec8 sys: FspFsextProvider 2019-06-18 16:11:38 -07:00
Bill Zissimopoulos 781deff06f sys: default TransactTimeout changes 2019-06-11 17:53:34 -07:00
Bill Zissimopoulos a811cd2cf8 sys, dll: extended attributes: checkpoint 2019-03-13 14:29:49 -07:00
Bill Zissimopoulos d2de5e996c update source copyright for 2019 2019-02-28 10:39:31 -08:00
Bill Zissimopoulos 75ae8daf8f update commercial disclaimer 2018-08-21 18:09:33 -07:00
Bill Zissimopoulos 9501b5771d inc,sys,tst: FSP_FSCTL_VOLUME_PARAMS: fine-grained timeouts 2018-04-21 11:53:14 -07:00
Bill Zissimopoulos 6b0b4c8b8e sys: mup: claim \ClassName instead of \ClassName\InstanceName prefix 2018-01-17 15:44:01 -08:00
Bill Zissimopoulos a4629b8f8b sys: fsmup device
- This commit introduces the fsmup device, which is a major change in how
network file systems are handled. Previously every network file system's
fsvol device was directly registered with the MUP. Now there is a single
fsmup device that is registered with the MUP; network file systems' fsvol
devices register with fsmup instead. The fsmup device maintains a prefix
table which it uses to demultiplex and forward requests to the appropriate
fsvol device.
- This device change was necessatitated to fix issue #87.
2018-01-16 10:38:52 -08:00
Bill Zissimopoulos 9bd9cf4fbd update source copyright notices for 2018 2018-01-03 15:29:38 -08:00