Re: [PATCH v4] ntfs: serialize attribute-list replacement with lookups
From: Cen Zhang
Date: Sat Jul 04 2026 - 11:40:12 EST
Hi, Hyunchul
Hyunchul Lee <hyc.lee@xxxxxxxxx> 于2026年7月3日周五 09:41写道:
>
> Hi Cen,
>
> While running generic/013 from xfstests, I observed the following hung
> task warning:
>
> [ 492.533956] INFO: task fsstress:934 blocked for more than 122 seconds.
> [ 492.534445] Tainted: G O 7.1.0-g81fe702ff176 #2
> [ 492.534870] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
> disables this message.
> [ 492.535914] INFO: task fsstress:934 <reader> blocked on an
> rw-semaphore likely owned by task fsstress:934 <writer>
> [ 492.536788] INFO: lockdep is turned off.
>
> # ps -eo pid,comm,stat | grep " D"
> 460 kworker/u16:4+f D
> 934 fsstress D+
>
> # cat /proc/934/stack
> [<0>] ntfs_attr_list_lock+0x2a/0x60 [ntfs]
> [<0>] ntfs_attr_get_search_ctx+0x97/0x100 [ntfs]
> [<0>] ntfs_resident_attr_resize+0x64/0x610 [ntfs]
> [<0>] ntfs_ir_truncate+0x82/0x120 [ntfs]
> [<0>] ntfs_ie_add+0x35/0x200 [ntfs]
> [<0>] ntfs_index_add_filename+0xca/0x120 [ntfs]
> [<0>] __ntfs_create+0xa9a/0xd80 [ntfs]
> [<0>] ntfs_create+0xbd/0x170 [ntfs]
> [<0>] path_openat+0x1014/0x1400
> [<0>] do_file_open+0xdf/0x1a0
> [<0>] do_sys_openat2+0x7b/0xe0
> [<0>] __x64_sys_creat+0x45/0x70
> [<0>] do_syscall_64+0x101/0x6a0
> [<0>] entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> # cat /proc/460/stack
> [<0>] __ntfs_write_inode+0x7b/0x6b0 [ntfs]
> [<0>] __writeback_single_inode+0x3f1/0x580
> [<0>] writeback_sb_inodes+0x25b/0x8c0
> [<0>] __writeback_inodes_wb+0x47/0xf0
> [<0>] wb_writeback+0x216/0x440
> [<0>] wb_workfn+0x3e6/0x510
> [<0>] process_one_work+0x200/0x5e0
> [<0>] worker_thread+0x1a0/0x370
> [<0>] kthread+0xef/0x120
> [<0>] ret_from_fork+0x270/0x330
> [<0>] ret_from_fork_asm+0x1a/0x30
Thanks for the review and test.
I tried to solve this crash, then kept refining the locking after testing
it with xfstests. During that process I ran into more and more issues,
which forced me to keep changing and expanding the patch. As a result,
the current patch has become quite large and complex, although I have not
found new issues with the current version under xfstests.
However, this version was also prepared with LLM assistance, and although
I reviewed and tested the result, I am not fully confident that this is
already the best or complete solution. I am therefore sending it as an RFC
first. I would appreciate your review on whether this direction and lock
ordering look reasonable, or whether you would prefer a smaller/different
approach. It would also be great if you could help solve this together;
I may have made it more complicated than it needed to be.
Best Regards,
Cen Zhang