diff options
| author | Ryusuke Konishi <konishi.ryusuke@gmail.com> | 2026-09-24 01:41:19 +0900 |
|---|---|---|
| committer | Viacheslav Dubeyko <slava@dubeyko.com> | 2026-09-24 11:19:01 -0700 |
| commit | ff1227f70eead8704ecfec69259fb4c041f92cda (patch) | |
| tree | f07d0b9260fe49bf71d98f9dd2f96ecd7226a3ff /tools/perf/scripts/python/bin/stackcollapse-report | |
| parent | 2cb947450e0e5a88bb6bb5fca6dbfda1910e74b0 (diff) | |
| download | linux-ff1227f70eead8704ecfec69259fb4c041f92cda.tar.gz linux-ff1227f70eead8704ecfec69259fb4c041f92cda.zip | |
nilfs2: fix deadlock between nilfs_evict_inode() and find_inode()
Syzbot reported a deadlock between nilfs_evict_inode(), executed via
an asynchronous workqueue (kworker) as:
process_one_work()
process_scheduled_works()
nilfs_iput_work_func()
nilfs_dispose_list()
iput()
iput_final()
evict()
s_op->evict_inode()
nilfs_evict_inode()
and find_inode(), called via
nilfs_mkdir()
nilfs_new_inode()
nilfs_insert_inode_locked()
insert_inode_locked4()
inode_insert5()
find_inode()
When an inode is deleted (i_nlink == 0), nilfs_evict_inode() clears its
ifile bitmap entry and then synchronously triggers the log writer via
nilfs_transaction_commit() if IS_SYNC(inode) is true.
If a concurrent directory creation via nilfs_new_inode() attempts to
allocate the same newly freed inode number, however, find_inode() called
just before inserting it into the inode hash, blocks waiting for the old
inode's evict() to complete.
Meanwhile, the synchronous log writer invoked from nilfs_evict_inode()
tries to acquire a write lock on 'ns_segctor_sem' which is read locked
by the caller of nilfs_new_inode() (in this case, nilfs_mkdir()),
resulting in a deadlock.
The synchronous log writer invocation from nilfs_evict_inode() is a
legacy artifact; it is no longer necessary because the call itself
(triggered by iput()) is now handled asynchronously with a kworker
if i_nlink == 0. It merely increases the risk of deadlock.
Fix this deadlock by removing the synchronous log writer trigger from
nilfs_evict_inode().
Reported-by: syzbot+6646318bbcf419411bc5@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6646318bbcf419411bc5
Fixes: 7ef3ff2fea8b ("nilfs2: fix deadlock of segment constructor over I_SYNC flag")
Tested-by: syzbot+6646318bbcf419411bc5@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions
