syzbot


possible deadlock in do_qc

Status: upstream: reported on 2024/04/28 01:25
Reported-by: syzbot+bdc96b32d35cce7a6064@syzkaller.appspotmail.com
First crash: 50d, last: 2d20h
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in do_qc gfs2 476 29m 70d 0/27 upstream: reported on 2024/04/07 05:18
linux-5.15 possible deadlock in do_qc 188 2d22h 50d 0/3 upstream: reported on 2024/04/27 22:18

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

but task is already holding lock:
ffff8880702005e8 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1512 [inline]
ffff8880702005e8 (&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
       gfs2_iomap_end+0x511/0x6d0 fs/gfs2/bmap.c:1157
       iomap_iter+0x22c/0x1090 fs/iomap/iter.c:79
       iomap_file_buffered_write+0xabe/0xc90 fs/iomap/buffered-io.c:845
       gfs2_file_buffered_write+0x4e3/0x870 fs/gfs2/file.c:1056
       gfs2_file_write_iter+0x415/0xe90 fs/gfs2/file.c:1157
       call_write_iter include/linux/fs.h:2265 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x7ae/0xba0 fs/read_write.c:584
       ksys_write+0x19c/0x2c0 fs/read_write.c:637
       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
       gfs2_iomap_end+0x511/0x6d0 fs/gfs2/bmap.c:1157
       iomap_iter+0x22c/0x1090 fs/iomap/iter.c:79
       iomap_file_buffered_write+0xabe/0xc90 fs/iomap/buffered-io.c:845
       gfs2_file_buffered_write+0x4e3/0x870 fs/gfs2/file.c:1056
       gfs2_file_write_iter+0x415/0xe90 fs/gfs2/file.c:1157
       call_write_iter include/linux/fs.h:2265 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x7ae/0xba0 fs/read_write.c:584
       ksys_write+0x19c/0x2c0 fs/read_write.c:637
       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 ***

6 locks held by syz-executor.2/3707:
 #0: ffff88802241e368 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2ba/0x360 fs/file.c:1062
 #1: ffff88801727a460 (sb_writers#17){.+.+}-{0:0}, at: vfs_write+0x269/0xba0 fs/read_write.c:580
 #2: ffff888070200150 (&sb->s_type->i_mutex_key#26){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
 #2: ffff888070200150 (&sb->s_type->i_mutex_key#26){+.+.}-{3:3}, at: gfs2_file_write_iter+0x347/0xe90 fs/gfs2/file.c:1114
 #3: ffff88801727a650 (sb_internal#5){.+.+}-{0:0}, at: gfs2_trans_begin+0x6d/0xe0 fs/gfs2/trans.c:118
 #4: ffff88807a3a5058 (&sdp->sd_log_flush_lock){++++}-{3:3}, at: __gfs2_trans_begin+0x558/0x940 fs/gfs2/trans.c:87
 #5: ffff8880702005e8 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1512 [inline]
 #5: ffff8880702005e8 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x27e9/0x3ab0 fs/gfs2/bmap.c:1837

stack backtrace:
CPU: 0 PID: 3707 Comm: syz-executor.2 Not tainted 6.1.93-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/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
 gfs2_iomap_end+0x511/0x6d0 fs/gfs2/bmap.c:1157
 iomap_iter+0x22c/0x1090 fs/iomap/iter.c:79
 iomap_file_buffered_write+0xabe/0xc90 fs/iomap/buffered-io.c:845
 gfs2_file_buffered_write+0x4e3/0x870 fs/gfs2/file.c:1056
 gfs2_file_write_iter+0x415/0xe90 fs/gfs2/file.c:1157
 call_write_iter include/linux/fs.h:2265 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x7ae/0xba0 fs/read_write.c:584
 ksys_write+0x19c/0x2c0 fs/read_write.c:637
 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:0x7efd49a7cea9
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:00007efd4a7b10c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007efd49bb3f80 RCX: 00007efd49a7cea9
RDX: 000000000208e24b RSI: 0000000020000100 RDI: 0000000000000004
RBP: 00007efd49aebff4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007efd49bb3f80 R15: 00007ffd59c5c318
 </TASK>

Crashes (108):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/14 06:17 linux-6.1.y ae9f2a70d69e a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/06/10 08:22 linux-6.1.y 88690811da69 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/06/09 05:46 linux-6.1.y 88690811da69 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/06/04 22:08 linux-6.1.y 88690811da69 11f2afa5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/06/02 20:11 linux-6.1.y 88690811da69 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/06/01 22:41 linux-6.1.y 88690811da69 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/29 14:52 linux-6.1.y 88690811da69 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/26 01:40 linux-6.1.y 88690811da69 a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/26 00:02 linux-6.1.y 88690811da69 a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/24 09:39 linux-6.1.y 4078fa637fcd 8f98448e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/24 07:52 linux-6.1.y 4078fa637fcd 8f98448e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/23 00:31 linux-6.1.y 4078fa637fcd 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/22 21:57 linux-6.1.y 4078fa637fcd 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/21 06:21 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/19 16:19 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/19 13:35 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/18 09:37 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/17 00:51 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/17 00:50 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/17 00:49 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/17 00:49 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/16 12:46 linux-6.1.y 909ba1f1b414 ef5d53ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/16 12:39 linux-6.1.y 909ba1f1b414 ef5d53ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/14 09:03 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/12 10:41 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/11 20:11 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/11 17:05 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/11 16:49 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/11 14:03 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/11 14:03 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/05/11 03:35 linux-6.1.y 909ba1f1b414 f7c35481 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_qc
2024/06/14 04:23 linux-6.1.y ae9f2a70d69e a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/06/10 10:07 linux-6.1.y 88690811da69 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/06/10 09:06 linux-6.1.y 88690811da69 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/06/10 07:18 linux-6.1.y 88690811da69 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/06/06 12:08 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/06/05 09:20 linux-6.1.y 88690811da69 e1e2c66e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/06/03 18:45 linux-6.1.y 88690811da69 0aba2352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/05/23 03:30 linux-6.1.y 4078fa637fcd 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/05/23 01:45 linux-6.1.y 4078fa637fcd 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/05/21 06:11 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/05/18 20:42 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/05/17 05:46 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/05/16 22:13 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/05/14 11:52 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_qc
2024/05/12 10:43 linux-6.1.y 909ba1f1b414 9026e142 .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.