syzbot


possible deadlock in nilfs_dirty_inode (2)

Status: auto-obsoleted due to no activity on 2024/03/29 20:19
Subsystems: nilfs
[Documentation on labels]
Reported-by: syzbot+903350d47ddb4cbb7f6f@syzkaller.appspotmail.com
First crash: 114d, last: 114d
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly nilfs report (Jan 2024) 0 (1) 2024/01/02 13:35
[syzbot] [nilfs?] possible deadlock in nilfs_dirty_inode (2) 0 (1) 2023/12/22 00:59
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in nilfs_dirty_inode nilfs 1 295d 291d 0/26 auto-obsoleted due to no activity on 2023/09/30 14:44

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.7.0-rc6-syzkaller-00022-g55cb5f43689d #0 Not tainted
------------------------------------------------------
kswapd0/108 is trying to acquire lock:
ffff888079954608 (sb_internal#4){.+.+}-{0:0}, at: nilfs_dirty_inode+0x1a0/0x270 fs/nilfs2/inode.c:1158

but task is already holding lock:
ffffffff8d11c740 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x160/0x1a90 mm/vmscan.c:6746

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (fs_reclaim){+.+.}-{0:0}:
       __fs_reclaim_acquire mm/page_alloc.c:3693 [inline]
       fs_reclaim_acquire+0x100/0x150 mm/page_alloc.c:3707
       might_alloc include/linux/sched/mm.h:303 [inline]
       prepare_alloc_pages.constprop.0+0x155/0x550 mm/page_alloc.c:4339
       __alloc_pages+0x193/0x2420 mm/page_alloc.c:4557
       alloc_pages_mpol+0x258/0x5f0 mm/mempolicy.c:2133
       folio_alloc+0x1e/0xe0 mm/mempolicy.c:2211
       filemap_alloc_folio+0x3bb/0x490 mm/filemap.c:974
       __filemap_get_folio+0x54c/0xaa0 mm/filemap.c:1918
       pagecache_get_page+0x2c/0x250 mm/folio-compat.c:99
       block_write_begin+0x38/0x490 fs/buffer.c:2223
       nilfs_write_begin+0x9f/0x1a0 fs/nilfs2/inode.c:261
       page_symlink+0x391/0x490 fs/namei.c:5187
       nilfs_symlink+0x24f/0x3e0 fs/nilfs2/namei.c:153
       vfs_symlink fs/namei.c:4464 [inline]
       vfs_symlink+0x3e4/0x620 fs/namei.c:4448
       do_symlinkat+0x25f/0x310 fs/namei.c:4490
       __do_sys_symlinkat fs/namei.c:4506 [inline]
       __se_sys_symlinkat fs/namei.c:4503 [inline]
       __ia32_sys_symlinkat+0x97/0xc0 fs/namei.c:4503
       do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
       __do_fast_syscall_32+0x62/0xe0 arch/x86/entry/common.c:321
       do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:346
       entry_SYSENTER_compat_after_hwframe+0x70/0x7a

-> #1 (&nilfs->ns_segctor_sem){++++}-{3:3}:
       down_read+0x9a/0x330 kernel/locking/rwsem.c:1526
       nilfs_transaction_begin+0x329/0xa40 fs/nilfs2/segment.c:223
       nilfs_symlink+0x130/0x3e0 fs/nilfs2/namei.c:140
       vfs_symlink fs/namei.c:4464 [inline]
       vfs_symlink+0x3e4/0x620 fs/namei.c:4448
       do_symlinkat+0x25f/0x310 fs/namei.c:4490
       __do_sys_symlinkat fs/namei.c:4506 [inline]
       __se_sys_symlinkat fs/namei.c:4503 [inline]
       __ia32_sys_symlinkat+0x97/0xc0 fs/namei.c:4503
       do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
       __do_fast_syscall_32+0x62/0xe0 arch/x86/entry/common.c:321
       do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:346
       entry_SYSENTER_compat_after_hwframe+0x70/0x7a

-> #0 (sb_internal#4){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3869 [inline]
       __lock_acquire+0x2433/0x3b20 kernel/locking/lockdep.c:5137
       lock_acquire kernel/locking/lockdep.c:5754 [inline]
       lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1635 [inline]
       sb_start_intwrite include/linux/fs.h:1757 [inline]
       nilfs_transaction_begin+0x21e/0xa40 fs/nilfs2/segment.c:220
       nilfs_dirty_inode+0x1a0/0x270 fs/nilfs2/inode.c:1158
       __mark_inode_dirty+0x1e0/0xd60 fs/fs-writeback.c:2452
       mark_inode_dirty_sync include/linux/fs.h:2311 [inline]
       iput.part.0+0x5b/0x7b0 fs/inode.c:1800
       iput+0x5c/0x80 fs/inode.c:1793
       dentry_unlink_inode+0x292/0x430 fs/dcache.c:401
       __dentry_kill+0x3b8/0x640 fs/dcache.c:607
       shrink_dentry_list+0x11e/0x4a0 fs/dcache.c:1201
       prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282
       super_cache_scan+0x327/0x540 fs/super.c:228
       do_shrink_slab+0x428/0x1120 mm/shrinker.c:435
       shrink_slab_memcg mm/shrinker.c:548 [inline]
       shrink_slab+0xa83/0x1310 mm/shrinker.c:626
       shrink_one+0x47d/0x7a0 mm/vmscan.c:4745
       shrink_many mm/vmscan.c:4808 [inline]
       lru_gen_shrink_node mm/vmscan.c:4923 [inline]
       shrink_node+0x211c/0x3710 mm/vmscan.c:5863
       kswapd_shrink_node mm/vmscan.c:6668 [inline]
       balance_pgdat+0x9d2/0x1a90 mm/vmscan.c:6858
       kswapd+0x5be/0xbf0 mm/vmscan.c:7118
       kthread+0x2c6/0x3a0 kernel/kthread.c:388
       ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242

other info that might help us debug this:

Chain exists of:
  sb_internal#4 --> &nilfs->ns_segctor_sem --> fs_reclaim

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(fs_reclaim);
                               lock(&nilfs->ns_segctor_sem);
                               lock(fs_reclaim);
  rlock(sb_internal#4);

 *** DEADLOCK ***

2 locks held by kswapd0/108:
 #0: ffffffff8d11c740 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x160/0x1a90 mm/vmscan.c:6746
 #1: ffff8880799540e0 (&type->s_umount_key#68){++++}-{3:3}, at: super_trylock_shared fs/super.c:610 [inline]
 #1: ffff8880799540e0 (&type->s_umount_key#68){++++}-{3:3}, at: super_cache_scan+0x96/0x540 fs/super.c:203

stack backtrace:
CPU: 2 PID: 108 Comm: kswapd0 Not tainted 6.7.0-rc6-syzkaller-00022-g55cb5f43689d #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 check_noncircular+0x317/0x400 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x2433/0x3b20 kernel/locking/lockdep.c:5137
 lock_acquire kernel/locking/lockdep.c:5754 [inline]
 lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1635 [inline]
 sb_start_intwrite include/linux/fs.h:1757 [inline]
 nilfs_transaction_begin+0x21e/0xa40 fs/nilfs2/segment.c:220
 nilfs_dirty_inode+0x1a0/0x270 fs/nilfs2/inode.c:1158
 __mark_inode_dirty+0x1e0/0xd60 fs/fs-writeback.c:2452
 mark_inode_dirty_sync include/linux/fs.h:2311 [inline]
 iput.part.0+0x5b/0x7b0 fs/inode.c:1800
 iput+0x5c/0x80 fs/inode.c:1793
 dentry_unlink_inode+0x292/0x430 fs/dcache.c:401
 __dentry_kill+0x3b8/0x640 fs/dcache.c:607
 shrink_dentry_list+0x11e/0x4a0 fs/dcache.c:1201
 prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282
 super_cache_scan+0x327/0x540 fs/super.c:228
 do_shrink_slab+0x428/0x1120 mm/shrinker.c:435
 shrink_slab_memcg mm/shrinker.c:548 [inline]
 shrink_slab+0xa83/0x1310 mm/shrinker.c:626
 shrink_one+0x47d/0x7a0 mm/vmscan.c:4745
 shrink_many mm/vmscan.c:4808 [inline]
 lru_gen_shrink_node mm/vmscan.c:4923 [inline]
 shrink_node+0x211c/0x3710 mm/vmscan.c:5863
 kswapd_shrink_node mm/vmscan.c:6668 [inline]
 balance_pgdat+0x9d2/0x1a90 mm/vmscan.c:6858
 kswapd+0x5be/0xbf0 mm/vmscan.c:7118
 kthread+0x2c6/0x3a0 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/12/20 20:18 upstream 55cb5f43689d de21eb89 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in nilfs_dirty_inode
* Struck through repros no longer work on HEAD.