From: syzbot <syzbot+050e797ad21ccc3f5d1a@syzkaller.appspotmail.com>
To: bfoster@redhat.com, kent.overstreet@linux.dev,
linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com
Subject: [syzbot] [bcachefs?] possible deadlock in bch2_gc_mark_key
Date: Mon, 27 May 2024 06:22:28 -0700 [thread overview]
Message-ID: <000000000000aa7cb106196f6883@google.com> (raw)
Hello,
syzbot found the following issue on:
HEAD commit: 9b62e02e6336 Merge tag 'mm-hotfixes-stable-2024-05-25-09-1..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10e3fb34980000
kernel config: https://syzkaller.appspot.com/x/.config?x=3e73beba72b96506
dashboard link: https://syzkaller.appspot.com/bug?extid=050e797ad21ccc3f5d1a
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/61b507f6e56c/disk-9b62e02e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6991f1313243/vmlinux-9b62e02e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/65f88b96d046/bzImage-9b62e02e.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+050e797ad21ccc3f5d1a@syzkaller.appspotmail.com
bcachefs (loop4): alloc_read... done
bcachefs (loop4): stripes_read... done
bcachefs (loop4): snapshots_read... done
bcachefs (loop4): check_allocations...
======================================================
WARNING: possible circular locking dependency detected
6.9.0-syzkaller-12393-g9b62e02e6336 #0 Not tainted
------------------------------------------------------
syz-executor.4/6744 is trying to acquire lock:
ffff888025c00988 (&c->sb_lock){+.+.}-{3:3}, at: bch2_gc_mark_key+0x9f6/0xd90 fs/bcachefs/btree_gc.c:599
but task is already holding lock:
ffff888025c01a50 (&c->btree_root_lock){+.+.}-{3:3}, at: bch2_gc_btree.constprop.0+0x106/0x11e0 fs/bcachefs/btree_gc.c:643
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&c->btree_root_lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:608 [inline]
__mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752
bch2_btree_roots_to_journal_entries+0x93/0x570 fs/bcachefs/btree_update_interior.c:2633
bch2_fs_mark_clean+0x31b/0x470 fs/bcachefs/sb-clean.c:376
bch2_fs_read_only+0x88a/0xf10 fs/bcachefs/super.c:381
__bch2_fs_stop+0xfc/0x540 fs/bcachefs/super.c:613
generic_shutdown_super+0x159/0x3d0 fs/super.c:642
bch2_kill_sb+0x3b/0x50 fs/bcachefs/fs.c:2026
deactivate_locked_super+0xbe/0x1a0 fs/super.c:473
deactivate_super+0xde/0x100 fs/super.c:506
cleanup_mnt+0x222/0x450 fs/namespace.c:1267
task_work_run+0x14e/0x250 kernel/task_work.c:180
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x278/0x2a0 kernel/entry/common.c:218
do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&c->sb_lock){+.+.}-{3:3}:
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+0x2478/0x3b30 kernel/locking/lockdep.c:5137
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719
__mutex_lock_common kernel/locking/mutex.c:608 [inline]
__mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752
bch2_gc_mark_key+0x9f6/0xd90 fs/bcachefs/btree_gc.c:599
bch2_gc_btree.constprop.0+0x394/0x11e0 fs/bcachefs/btree_gc.c:647
bch2_gc_btrees+0x442/0x8c0 fs/bcachefs/btree_gc.c:697
bch2_check_allocations+0x98f/0x2670 fs/bcachefs/btree_gc.c:1217
bch2_run_recovery_pass+0x8e/0x1a0 fs/bcachefs/recovery_passes.c:182
bch2_run_recovery_passes+0x33b/0x710 fs/bcachefs/recovery_passes.c:225
bch2_fs_recovery+0x259f/0x3db0 fs/bcachefs/recovery.c:807
bch2_fs_start+0x2e9/0x600 fs/bcachefs/super.c:1031
bch2_fs_open+0xfa0/0x1110 fs/bcachefs/super.c:2123
bch2_mount+0xdcc/0x1130 fs/bcachefs/fs.c:1917
legacy_get_tree+0x109/0x220 fs/fs_context.c:662
vfs_get_tree+0x8f/0x380 fs/super.c:1780
do_new_mount fs/namespace.c:3352 [inline]
path_mount+0x14e6/0x1f20 fs/namespace.c:3679
do_mount fs/namespace.c:3692 [inline]
__do_sys_mount fs/namespace.c:3898 [inline]
__se_sys_mount fs/namespace.c:3875 [inline]
__x64_sys_mount+0x297/0x320 fs/namespace.c:3875
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&c->btree_root_lock);
lock(&c->sb_lock);
lock(&c->btree_root_lock);
lock(&c->sb_lock);
*** DEADLOCK ***
4 locks held by syz-executor.4/6744:
#0: ffff888025c00278 (&c->state_lock){+.+.}-{3:3}, at: bch2_fs_start+0x3e/0x600 fs/bcachefs/super.c:1001
#1: ffff888025c268d8 (&c->gc_lock){++++}-{3:3}, at: bch2_check_allocations+0xf1/0x2670 fs/bcachefs/btree_gc.c:1202
#2: ffff888025c042d0 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:116 [inline]
#2: ffff888025c042d0 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:215 [inline]
#2: ffff888025c042d0 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x656/0xf20 fs/bcachefs/btree_iter.c:3204
#3: ffff888025c01a50 (&c->btree_root_lock){+.+.}-{3:3}, at: bch2_gc_btree.constprop.0+0x106/0x11e0 fs/bcachefs/btree_gc.c:643
stack backtrace:
CPU: 0 PID: 6744 Comm: syz-executor.4 Not tainted 6.9.0-syzkaller-12393-g9b62e02e6336 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
check_noncircular+0x31a/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+0x2478/0x3b30 kernel/locking/lockdep.c:5137
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719
__mutex_lock_common kernel/locking/mutex.c:608 [inline]
__mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752
bch2_gc_mark_key+0x9f6/0xd90 fs/bcachefs/btree_gc.c:599
bch2_gc_btree.constprop.0+0x394/0x11e0 fs/bcachefs/btree_gc.c:647
bch2_gc_btrees+0x442/0x8c0 fs/bcachefs/btree_gc.c:697
bch2_check_allocations+0x98f/0x2670 fs/bcachefs/btree_gc.c:1217
bch2_run_recovery_pass+0x8e/0x1a0 fs/bcachefs/recovery_passes.c:182
bch2_run_recovery_passes+0x33b/0x710 fs/bcachefs/recovery_passes.c:225
bch2_fs_recovery+0x259f/0x3db0 fs/bcachefs/recovery.c:807
bch2_fs_start+0x2e9/0x600 fs/bcachefs/super.c:1031
bch2_fs_open+0xfa0/0x1110 fs/bcachefs/super.c:2123
bch2_mount+0xdcc/0x1130 fs/bcachefs/fs.c:1917
legacy_get_tree+0x109/0x220 fs/fs_context.c:662
vfs_get_tree+0x8f/0x380 fs/super.c:1780
do_new_mount fs/namespace.c:3352 [inline]
path_mount+0x14e6/0x1f20 fs/namespace.c:3679
do_mount fs/namespace.c:3692 [inline]
__do_sys_mount fs/namespace.c:3898 [inline]
__se_sys_mount fs/namespace.c:3875 [inline]
__x64_sys_mount+0x297/0x320 fs/namespace.c:3875
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f743727e5ea
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007f7437fb6ef8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f7437fb6f80 RCX: 00007f743727e5ea
RDX: 0000000020005b00 RSI: 0000000020000000 RDI: 00007f7437fb6f40
RBP: 0000000020005b00 R08: 00007f7437fb6f80 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 00007f7437fb6f40 R14: 0000000000005b46 R15: 00000000200000c0
</TASK>
bucket 0:26 gen 0 data type btree has wrong cached_sectors: got 458752, should be 0, shutting down
bcachefs (loop4): inconsistency detected - emergency read only at journal seq 8
bcachefs (loop4): bch2_gc_alloc_done(): error fsck_errors_not_fixed
bcachefs (loop4): bch2_check_allocations(): error fsck_errors_not_fixed
bcachefs (loop4): bch2_fs_recovery(): error fsck_errors_not_fixed
bcachefs (loop4): bch2_fs_start(): error starting filesystem fsck_errors_not_fixed
bcachefs (loop4): shutting down
bcachefs (loop4): shutdown complete
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
next reply other threads:[~2024-05-27 13:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 13:22 syzbot [this message]
2024-06-21 5:31 ` [syzbot] [bcachefs?] possible deadlock in bch2_gc_mark_key syzbot
2024-06-21 9:34 ` [PATCH] bcachefs: fix " Lizhi Xu
2024-06-22 13:43 ` Kent Overstreet
2024-06-21 8:58 ` [syzbot] Re: [syzbot] [bcachefs?] possible " syzbot
2024-06-21 22:17 ` syzbot
2024-08-23 22:51 ` [syzbot] " syzbot
[not found] <20240621085812.1588215-1-lizhi.xu@windriver.com>
2024-06-21 9:28 ` [syzbot] [bcachefs?] " syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=000000000000aa7cb106196f6883@google.com \
--to=syzbot+050e797ad21ccc3f5d1a@syzkaller.appspotmail.com \
--cc=bfoster@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.