Skip to content

Conversation

hsitter
Copy link

@hsitter hsitter commented Aug 7, 2025

seems to fix various deadlock scenarios when writing in windows 11

what appears to happen is that ccflush magically acquires locks if we don't acquire them explicitly. this then results in a deadlock where the ccflush thread is holding the lock and waiting for writing to happen (somewhere inside CcFlushCacheOneRange). meanwhile one of our threads is stuck waiting for the lock (somewhere inside drv_write).

(I am not super sure that is the right thing to do, but looking at ext4fsd it also implements these functions with actual acquire and release. also I don't understand the implications of FSRTL_CACHE_TOP_LEVEL_IRP)

@maharmstone
Copy link
Owner

Nice work. I'll have to double-check, but it certainly sounds plausible. It's also similar to what fastfat does (https://github.com/microsoft/Windows-driver-samples/blob/main/filesys/fastfat/resrcsup.c#L711).

@SandeMC
Copy link

SandeMC commented Sep 19, 2025

Is there any plans to merge this anytime soon? Or at least somebody posting a version of the driver with this fix - it's extremely unbearable.

seems to fix various deadlock scenarios when writing in windows 11

what appears to happen is that ccflush magically acquires locks if we
don't acquire them explicitly. this then results in a deadlock where the
ccflush thread is holding the lock and waiting for writing to happen
(somewhere inside CcFlushCacheOneRange). meanwhile one of our threads is
stuck waiting for the lock (somewhere inside drv_write).
@hsitter hsitter force-pushed the work/sitter/deadlock branch from de0d57f to 0f4eca1 Compare September 19, 2025 16:24
@hsitter
Copy link
Author

hsitter commented Sep 19, 2025

I came to realize that locking blockingly is probably smarter here, I've seen some programs error out otherwise (notably the game guildwars2 throws exceptions consistently with the original revision). Revised the commit accordingly and rebased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants