Re: [PATCH 5.15] fuse: Fix race condition in writethrough path A race

lu gu
2025-10-15T04:00:12Z

> Attaching a test patch, minimally tested.
Since I only have a test environment for kernel 5.15, I ported this
patch to the FUSE module in 5.15. I ran the previous LTP test cases
more than ten times, and the data inconsistency issue did not reoccur.
However, a deadlock occur. Below is the specific stack trace.
root@ubuntu:~# ps aux | grep ltp
root 15040 0.0 0.0 2972 1124 pts/2 S+ 11:26 0:00
/root/ltp-install/testcases/bin/doio -N iogen01 -a -v -n 2 -k
root 15042 0.2 0.0 3036 1320 pts/2 D+ 11:26 0:01
/root/ltp-install/testcases/bin/doio -N iogen01 -a -v -n 2 -k
root@ubuntu:~# cat /proc/15042/stack
[<0>] __inode_wait_for_writeback+0xae/0xf0
[<0>] writeback_single_inode+0x72/0x190
[<0>] sync_inode_metadata+0x41/0x60
[<0>] fuse_fsync+0xbf/0x110 [fuse]
[<0>] vfs_fsync_range+0x49/0x90
[<0>] fuse_file_write_iter+0x34b/0x470 [fuse]
[<0>] new_sync_write+0x114/0x1a0
[<0>] vfs_write+0x1d5/0x270
[<0>] ksys_write+0x67/0xf0
[<0>] __x64_sys_write+0x19/0x20
[<0>] do_syscall_64+0x5c/0xc0
[<0>] entry_SYSCALL_64_after_hwframe+0x61/0xcb
root@ubuntu:~# cat /proc/15040/stack
[<0>] do_wait+0x171/0x310
[<0>] kernel_wait4+0xaf/0x150
[<0>] __do_sys_wait4+0x89/0xa0
[<0>] __x64_sys_wait4+0x1c/0x30
[<0>] do_syscall_64+0x5c/0xc0
[<0>] entry_SYSCALL_64_after_hwframe+0x61/0xcb

Thanks,
Guangming