syzbot


possible deadlock in ext4_evict_inode (2)

Status: auto-obsoleted due to no activity on 2024/03/15 02:58
Reported-by: syzbot+880b57274899b225d178@syzkaller.appspotmail.com
First crash: 374d, last: 374d
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ext4_evict_inode (2) ext4 18 639d 815d 0/28 auto-obsoleted due to no activity on 2023/07/14 13:24
linux-6.1 possible deadlock in ext4_evict_inode (3) 1 255d 255d 0/3 auto-obsoleted due to no activity on 2024/07/12 10:45
linux-5.15 possible deadlock in ext4_evict_inode (2) 2 277d 282d 0/3 auto-obsoleted due to no activity on 2024/06/20 13:51
upstream possible deadlock in ext4_evict_inode (3) ext4 5 109d 302d 0/28 auto-obsoleted due to no activity on 2024/12/05 07:55
upstream possible deadlock in ext4_evict_inode ext4 syz error error 38 2252d 2291d 15/28 fixed on 2020/05/22 17:31
linux-6.1 possible deadlock in ext4_evict_inode 2 522d 631d 0/3 auto-obsoleted due to no activity on 2023/10/19 10:40
linux-5.15 possible deadlock in ext4_evict_inode 2 623d 627d 0/3 auto-obsoleted due to no activity on 2023/07/30 00:10

Sample crash report:
EXT4-fs (loop4): mounted filesystem without journal. Quota mode: writeback.
ext4 filesystem being mounted at /root/syzkaller-testdir2273581239/syzkaller.yYAEnL/1740/file1 supports timestamps until 2038 (0x7fffffff)
======================================================
WARNING: possible circular locking dependency detected
6.1.65-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/30736 is trying to acquire lock:
ffff88801ea8e650 (sb_internal){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1875 [inline]
ffff88801ea8e650 (sb_internal){.+.+}-{0:0}, at: sb_start_intwrite include/linux/fs.h:1997 [inline]
ffff88801ea8e650 (sb_internal){.+.+}-{0:0}, at: ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240

but task is already holding lock:
ffff88801ea88b98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_ext_migrate+0x314/0x12f0 fs/ext4/migrate.c:437

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&sbi->s_writepages_rwsem){++++}-{0:0}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51
       ext4_writepages+0x1e5/0x3de0 fs/ext4/inode.c:2703
       do_writepages+0x3a2/0x670 mm/page-writeback.c:2469
       filemap_fdatawrite_wbc+0x121/0x180 mm/filemap.c:388
       __filemap_fdatawrite_range mm/filemap.c:421 [inline]
       filemap_write_and_wait_range+0x1a4/0x290 mm/filemap.c:674
       __iomap_dio_rw+0xb56/0x2140 fs/iomap/direct-io.c:573
       iomap_dio_rw+0x42/0xa0 fs/iomap/direct-io.c:690
       ext4_dio_read_iter fs/ext4/file.c:94 [inline]
       ext4_file_read_iter+0x50b/0x660 fs/ext4/file.c:145
       call_read_iter include/linux/fs.h:2242 [inline]
       generic_file_splice_read+0x23c/0x630 fs/splice.c:309
       do_splice_to fs/splice.c:793 [inline]
       splice_direct_to_actor+0x408/0xbd0 fs/splice.c:865
       do_splice_direct+0x27f/0x3c0 fs/splice.c:974
       do_sendfile+0x61c/0xff0 fs/read_write.c:1255
       __do_sys_sendfile64 fs/read_write.c:1323 [inline]
       __se_sys_sendfile64+0x178/0x1e0 fs/read_write.c:1309
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #2 (&sb->s_type->i_mutex_key#8){++++}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
       inode_lock_shared include/linux/fs.h:766 [inline]
       ext4_bmap+0x4b/0x410 fs/ext4/inode.c:3176
       bmap+0xa1/0xd0 fs/inode.c:1840
       jbd2_journal_bmap fs/jbd2/journal.c:977 [inline]
       __jbd2_journal_erase fs/jbd2/journal.c:1789 [inline]
       jbd2_journal_flush+0x5b5/0xc40 fs/jbd2/journal.c:2492
       ext4_ioctl_checkpoint fs/ext4/ioctl.c:1086 [inline]
       __ext4_ioctl fs/ext4/ioctl.c:1594 [inline]
       ext4_ioctl+0x3986/0x5f60 fs/ext4/ioctl.c:1614
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #1 (&journal->j_checkpoint_mutex){+.+.}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       mutex_lock_io_nested+0x134/0xab0 kernel/locking/mutex.c:833
       __jbd2_log_wait_for_space+0x213/0x760 fs/jbd2/checkpoint.c:71
       add_transaction_credits fs/jbd2/transaction.c:298 [inline]
       start_this_handle+0x1040/0x21b0 fs/jbd2/transaction.c:422
       jbd2__journal_start+0x2d1/0x5c0 fs/jbd2/transaction.c:520
       __ext4_journal_start_sb+0x19b/0x410 fs/ext4/ext4_jbd2.c:105
       __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline]
       ext4_evict_inode+0x8dc/0x1150 fs/ext4/inode.c:251
       evict+0x2a4/0x620 fs/inode.c:664
       do_unlinkat+0x503/0x820 fs/namei.c:4328
       __do_sys_unlink fs/namei.c:4369 [inline]
       __se_sys_unlink fs/namei.c:4367 [inline]
       __x64_sys_unlink+0x45/0x50 fs/namei.c:4367
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (sb_internal){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51
       __sb_start_write include/linux/fs.h:1875 [inline]
       sb_start_intwrite include/linux/fs.h:1997 [inline]
       ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240
       evict+0x2a4/0x620 fs/inode.c:664
       ext4_ext_migrate+0x100b/0x12f0 fs/ext4/migrate.c:587
       __ext4_ioctl fs/ext4/ioctl.c:1396 [inline]
       ext4_ioctl+0x1dc6/0x5f60 fs/ext4/ioctl.c:1614
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

Chain exists of:
  sb_internal --> &sb->s_type->i_mutex_key#8 --> &sbi->s_writepages_rwsem

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sbi->s_writepages_rwsem);
                               lock(&sb->s_type->i_mutex_key#8);
                               lock(&sbi->s_writepages_rwsem);
  lock(sb_internal);

 *** DEADLOCK ***

3 locks held by syz-executor.4/30736:
 #0: ffff88801ea8e460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write_file+0x5a/0x1f0 fs/namespace.c:437
 #1: ffff88808e644030 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
 #1: ffff88808e644030 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: __ext4_ioctl fs/ext4/ioctl.c:1395 [inline]
 #1: ffff88808e644030 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: ext4_ioctl+0x1dbe/0x5f60 fs/ext4/ioctl.c:1614
 #2: ffff88801ea88b98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_ext_migrate+0x314/0x12f0 fs/ext4/migrate.c:437

stack backtrace:
CPU: 0 PID: 30736 Comm: syz-executor.4 Not tainted 6.1.65-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51
 __sb_start_write include/linux/fs.h:1875 [inline]
 sb_start_intwrite include/linux/fs.h:1997 [inline]
 ext4_evict_inode+0x46d/0x1150 fs/ext4/inode.c:240
 evict+0x2a4/0x620 fs/inode.c:664
 ext4_ext_migrate+0x100b/0x12f0 fs/ext4/migrate.c:587
 __ext4_ioctl fs/ext4/ioctl.c:1396 [inline]
 ext4_ioctl+0x1dc6/0x5f60 fs/ext4/ioctl.c:1614
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f69e4e7cae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f69e5c070c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f69e4f9bf80 RCX: 00007f69e4e7cae9
RDX: 0000000000000000 RSI: 0000000000006609 RDI: 0000000000000005
RBP: 00007f69e4ec847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f69e4f9bf80 R15: 00007fffb91bca98
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/12/06 02:57 linux-6.1.y c6114c845984 858d62d1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ext4_evict_inode
* Struck through repros no longer work on HEAD.