syzbot


possible deadlock in do_qc

Status: upstream: reported on 2024/04/28 01:25
Reported-by: syzbot+bdc96b32d35cce7a6064@syzkaller.appspotmail.com
First crash: 237d, last: 6d18h
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in do_qc gfs2 785 130d 258d 0/28 auto-obsoleted due to no activity on 2024/10/22 09:11
linux-5.15 possible deadlock in do_qc 409 1d00h 237d 0/3 upstream: reported on 2024/04/27 22:18

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.119-syzkaller #0 Not tainted
------------------------------------------------------
syz.9.1660/12660 is trying to acquire lock:
ffff8880649acae0 (&sdp->sd_quota_mutex){+.+.}-{3:3}, at: do_qc+0xc8/0x720 fs/gfs2/quota.c:682

but task is already holding lock:
ffff88804e152780 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1512 [inline]
ffff88804e152780 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x27e9/0x3ab0 fs/gfs2/bmap.c:1837

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ip->i_rw_mutex){++++}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
       __gfs2_iomap_get+0x178/0x1480 fs/gfs2/bmap.c:856
       gfs2_iomap_get+0xdb/0x150 fs/gfs2/bmap.c:1396
       bh_get+0x286/0x800 fs/gfs2/quota.c:385
       qdsb_get+0x209/0x3b0 fs/gfs2/quota.c:522
       gfs2_quota_hold+0x19d/0x5c0 fs/gfs2/quota.c:608
       punch_hole+0xebd/0x3ab0 fs/gfs2/bmap.c:1798
       do_shrink+0x844/0x9b0 fs/gfs2/bmap.c:2018
       gfs2_setattr_size+0x151/0x8d0 fs/gfs2/bmap.c:2142
       gfs2_setattr+0x258/0x410 fs/gfs2/inode.c:2002
       notify_change+0xce3/0xfc0 fs/attr.c:499
       do_truncate+0x21c/0x300 fs/open.c:65
       vfs_truncate+0x2dd/0x3a0 fs/open.c:111
       do_sys_truncate+0xda/0x190 fs/open.c:134
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&sdp->sd_quota_mutex){+.+.}-{3:3}:
       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
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       do_qc+0xc8/0x720 fs/gfs2/quota.c:682
       gfs2_quota_change+0x2db/0x8c0 fs/gfs2/quota.c:1295
       punch_hole+0x344a/0x3ab0 fs/gfs2/bmap.c:1938
       do_shrink+0x844/0x9b0 fs/gfs2/bmap.c:2018
       gfs2_setattr_size+0x151/0x8d0 fs/gfs2/bmap.c:2142
       gfs2_setattr+0x258/0x410 fs/gfs2/inode.c:2002
       notify_change+0xce3/0xfc0 fs/attr.c:499
       do_truncate+0x21c/0x300 fs/open.c:65
       vfs_truncate+0x2dd/0x3a0 fs/open.c:111
       do_sys_truncate+0xda/0x190 fs/open.c:134
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ip->i_rw_mutex);
                               lock(&sdp->sd_quota_mutex);
                               lock(&ip->i_rw_mutex);
  lock(&sdp->sd_quota_mutex);

 *** DEADLOCK ***

5 locks held by syz.9.1660/12660:
 #0: ffff888045f46460 (sb_writers#30){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
 #1: ffff88804e1522e8 (&sb->s_type->i_mutex_key#39){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
 #1: ffff88804e1522e8 (&sb->s_type->i_mutex_key#39){+.+.}-{3:3}, at: do_truncate+0x208/0x300 fs/open.c:63
 #2: ffff888045f46650 (sb_internal#6){.+.+}-{0:0}, at: gfs2_trans_begin+0x6d/0xe0 fs/gfs2/trans.c:118
 #3: ffff8880649ad058 (&sdp->sd_log_flush_lock){.+.+}-{3:3}, at: __gfs2_trans_begin+0x558/0x940 fs/gfs2/trans.c:87
 #4: ffff88804e152780 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1512 [inline]
 #4: ffff88804e152780 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x27e9/0x3ab0 fs/gfs2/bmap.c:1837

stack backtrace:
CPU: 1 PID: 12660 Comm: syz.9.1660 Not tainted 6.1.119-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
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
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
 do_qc+0xc8/0x720 fs/gfs2/quota.c:682
 gfs2_quota_change+0x2db/0x8c0 fs/gfs2/quota.c:1295
 punch_hole+0x344a/0x3ab0 fs/gfs2/bmap.c:1938
 do_shrink+0x844/0x9b0 fs/gfs2/bmap.c:2018
 gfs2_setattr_size+0x151/0x8d0 fs/gfs2/bmap.c:2142
 gfs2_setattr+0x258/0x410 fs/gfs2/inode.c:2002
 notify_change+0xce3/0xfc0 fs/attr.c:499
 do_truncate+0x21c/0x300 fs/open.c:65
 vfs_truncate+0x2dd/0x3a0 fs/open.c:111
 do_sys_truncate+0xda/0x190 fs/open.c:134
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fad12f7ff19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fad13de4058 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 00007fad13146080 RCX: 00007fad12f7ff19
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000020000080
RBP: 00007fad12ff3986 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fad13146080 R15: 00007fffcf9ad588
 </TASK>

Crashes (225):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/04 04:20 linux-6.1.y e4d90d63d385 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/11/28 18:38 linux-6.1.y e4d90d63d385 5df23865 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/11/22 14:52 linux-6.1.y b67dc5c9ade9 4b25d554 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/11/22 00:55 linux-6.1.y b67dc5c9ade9 4b25d554 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/11/20 22:35 linux-6.1.y b67dc5c9ade9 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/11/01 15:32 linux-6.1.y 7c15117f9468 96eb609f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/10/23 12:07 linux-6.1.y 7ec6f9fa3d97 15fa2979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/10/18 05:46 linux-6.1.y 54d90d17e8ce 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/10/18 04:37 linux-6.1.y 54d90d17e8ce 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/10/16 09:52 linux-6.1.y aa4cd140bba5 bde2d81c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/10/07 14:22 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/10/04 12:59 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/10/04 03:51 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/09/15 11:17 linux-6.1.y 5f55cad62cc9 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/12/14 18:30 linux-6.1.y e4d90d63d385 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/12/14 01:16 linux-6.1.y e4d90d63d385 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/12/11 01:58 linux-6.1.y e4d90d63d385 cfc402b4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/12/09 05:22 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/12/08 12:37 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/12/07 08:35 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/12/03 00:01 linux-6.1.y e4d90d63d385 b499ea68 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/28 10:42 linux-6.1.y e4d90d63d385 5df23865 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/26 18:45 linux-6.1.y e4d90d63d385 e9a9a9f2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/25 03:28 linux-6.1.y e4d90d63d385 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/24 14:56 linux-6.1.y e4d90d63d385 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/23 06:29 linux-6.1.y e4d90d63d385 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/23 06:27 linux-6.1.y e4d90d63d385 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/22 10:16 linux-6.1.y b67dc5c9ade9 4b25d554 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/21 21:37 linux-6.1.y b67dc5c9ade9 4b25d554 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/19 12:06 linux-6.1.y b67dc5c9ade9 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/18 07:04 linux-6.1.y b67dc5c9ade9 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/18 02:13 linux-6.1.y b67dc5c9ade9 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/17 14:37 linux-6.1.y 59d7b1a7104a cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/15 15:03 linux-6.1.y 59d7b1a7104a f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/14 03:35 linux-6.1.y d7039b844a1c bb3f8425 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/10 06:35 linux-6.1.y d7039b844a1c 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/07 09:33 linux-6.1.y 7c15117f9468 df3dc63b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/04 21:37 linux-6.1.y 7c15117f9468 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/11/03 15:14 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/10/31 21:39 linux-6.1.y 7ec6f9fa3d97 96eb609f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/10/28 02:28 linux-6.1.y 7ec6f9fa3d97 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/10/28 01:00 linux-6.1.y 7ec6f9fa3d97 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/10/27 14:53 linux-6.1.y 7ec6f9fa3d97 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/10/25 22:12 linux-6.1.y 7ec6f9fa3d97 045e728d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/09/28 23:33 linux-6.1.y e526b12bf916 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/09/21 23:16 linux-6.1.y e526b12bf916 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/09/09 08:48 linux-6.1.y 5ca5b389fddf 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/04/28 01:25 linux-6.1.y f2295faba5e8 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
* Struck through repros no longer work on HEAD.