syzbot


possible deadlock in btrfs_read_chunk_tree

Status: upstream: reported C repro on 2025/06/24 13:11
Subsystems: btrfs
[Documentation on labels]
Reported-by: syzbot+fa90fcaa28f5cd4b1fc1@syzkaller.appspotmail.com
First crash: 4d23h, last: 3h35m
Cause bisection: introduced by (bisect log) :
commit 7aacdf6feed1ca882339ebd3895a233373b40a1e
Author: Qu Wenruo <wqu@suse.com>
Date: Tue Jun 17 05:19:38 2025 +0000

  btrfs: delay btrfs_open_devices() until super block is created

Crash: possible deadlock in btrfs_read_chunk_tree (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH next] btrfs: fix deadlock in btrfs_read_chunk_tree 4 (4) 2025/06/25 10:49
[syzbot] [btrfs?] possible deadlock in btrfs_read_chunk_tree 1 (3) 2025/06/24 14:27
Last patch testing requests (1)
Created Duration User Patch Repo Result
2025/06/24 13:56 29m eadavis@qq.com patch linux-next OK log

Sample crash report:
BTRFS info (device loop0): using sha256 (sha256-x86_64) checksum algorithm
BTRFS info (device loop0): disk space caching is enabled
BTRFS warning (device loop0): space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2
======================================================
WARNING: possible circular locking dependency detected
6.16.0-rc2-next-20250620-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor123/5843 is trying to acquire lock:
ffffffff8e6e9fe8 (uuid_mutex){+.+.}-{4:4}, at: btrfs_read_chunk_tree+0xef/0x2170 fs/btrfs/volumes.c:7462

but task is already holding lock:
ffff8880328ea0e0 (&type->s_umount_key#41/1){+.+.}-{4:4}, at: alloc_super+0x204/0x970 fs/super.c:345

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&type->s_umount_key#41/1){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       down_write_nested+0x9d/0x200 kernel/locking/rwsem.c:1693
       alloc_super+0x204/0x970 fs/super.c:345
       sget_fc+0x329/0xa40 fs/super.c:761
       btrfs_get_tree_super fs/btrfs/super.c:1867 [inline]
       btrfs_get_tree_subvol fs/btrfs/super.c:2059 [inline]
       btrfs_get_tree+0x4c6/0x12d0 fs/btrfs/super.c:2093
       vfs_get_tree+0x8f/0x2b0 fs/super.c:1804
       do_new_mount+0x24a/0xa40 fs/namespace.c:3902
       do_mount fs/namespace.c:4239 [inline]
       __do_sys_mount fs/namespace.c:4450 [inline]
       __se_sys_mount+0x317/0x410 fs/namespace.c:4427
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (uuid_mutex){+.+.}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3168 [inline]
       check_prevs_add kernel/locking/lockdep.c:3287 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       __mutex_lock_common kernel/locking/mutex.c:602 [inline]
       __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:747
       btrfs_read_chunk_tree+0xef/0x2170 fs/btrfs/volumes.c:7462
       open_ctree+0x17f2/0x3a10 fs/btrfs/disk-io.c:3458
       btrfs_fill_super fs/btrfs/super.c:984 [inline]
       btrfs_get_tree_super fs/btrfs/super.c:1922 [inline]
       btrfs_get_tree_subvol fs/btrfs/super.c:2059 [inline]
       btrfs_get_tree+0xc6f/0x12d0 fs/btrfs/super.c:2093
       vfs_get_tree+0x8f/0x2b0 fs/super.c:1804
       do_new_mount+0x24a/0xa40 fs/namespace.c:3902
       do_mount fs/namespace.c:4239 [inline]
       __do_sys_mount fs/namespace.c:4450 [inline]
       __se_sys_mount+0x317/0x410 fs/namespace.c:4427
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&type->s_umount_key#41/1);
                               lock(uuid_mutex);
                               lock(&type->s_umount_key#41/1);
  lock(uuid_mutex);

 *** DEADLOCK ***

1 lock held by syz-executor123/5843:
 #0: ffff8880328ea0e0 (&type->s_umount_key#41/1){+.+.}-{4:4}, at: alloc_super+0x204/0x970 fs/super.c:345

stack backtrace:
CPU: 1 UID: 0 PID: 5843 Comm: syz-executor123 Not tainted 6.16.0-rc2-next-20250620-syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2046
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3168 [inline]
 check_prevs_add kernel/locking/lockdep.c:3287 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
 __mutex_lock_common kernel/locking/mutex.c:602 [inline]
 __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:747
 btrfs_read_chunk_tree+0xef/0x2170 fs/btrfs/volumes.c:7462
 open_ctree+0x17f2/0x3a10 fs/btrfs/disk-io.c:3458
 btrfs_fill_super fs/btrfs/super.c:984 [inline]
 btrfs_get_tree_super fs/btrfs/super.c:1922 [inline]
 btrfs_get_tree_subvol fs/btrfs/super.c:2059 [inline]
 btrfs_get_tree+0xc6f/0x12d0 fs/btrfs/super.c:2093
 vfs_get_tree+0x8f/0x2b0 fs/super.c:1804
 do_new_mount+0x24a/0xa40 fs/namespace.c:3902
 do_mount fs/namespace.c:4239 [inline]
 __do_sys_mount fs/namespace.c:4450 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4427
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fda63124f3a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd76f19cb8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffd76f19cd0 RCX: 00007fda63124f3a
RDX: 00002000000004c0 RSI: 00002000000015c0 RDI: 00007ffd76f19cd0
RBP: 00002000000004c0 R08: 00007ffd76f19d10 R09: 0000000000005598
R10: 0000000002000000 R11: 0000000000000282 R12: 00002000000015c0
R13: 00007ffd76f19d10 R14: 0000000000000003 R15: 0000000002000000
 </TASK>
BTRFS info (device loop0): rebuilding free space tree
BTRFS info (device loop0): disabling free space tree
BTRFS info (device loop0): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1)
BTRFS info (device loop0): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2)

Crashes (7216):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/22 05:48 linux-next 5d4809e25903 d6cdfb8a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/22 02:01 linux-next 5d4809e25903 d6cdfb8a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/21 23:44 linux-next 5d4809e25903 d6cdfb8a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/21 23:23 linux-next 5d4809e25903 d6cdfb8a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/21 23:02 linux-next 5d4809e25903 d6cdfb8a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/21 22:39 linux-next 5d4809e25903 d6cdfb8a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/21 22:18 linux-next 5d4809e25903 d6cdfb8a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/21 21:10 linux-next 5d4809e25903 d6cdfb8a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 08:36 linux-next 1b152eeca84a 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 08:31 linux-next 1b152eeca84a 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 07:37 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 07:07 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 06:33 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 06:27 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 06:22 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 06:08 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 05:39 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 05:16 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 05:01 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 04:37 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 01:10 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 01:01 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 00:52 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 00:39 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/25 00:22 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 23:38 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 23:26 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 21:06 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 20:38 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 20:33 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 20:24 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 20:15 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 20:06 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 20:00 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 19:53 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 19:38 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 18:06 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 15:52 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 15:47 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 15:41 linux-next 2ae2aaafb214 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 14:42 linux-next 2ae2aaafb214 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 12:14 linux-next 2ae2aaafb214 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 12:07 linux-next 2ae2aaafb214 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 12:05 linux-next 2ae2aaafb214 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 10:32 linux-next f817b6dd2b62 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 10:27 linux-next f817b6dd2b62 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 10:22 linux-next f817b6dd2b62 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 10:22 linux-next f817b6dd2b62 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 08:09 linux-next f817b6dd2b62 1a7fb460 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/24 08:08 linux-next f817b6dd2b62 1a7fb460 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
2025/06/20 13:00 linux-next 5d4809e25903 e3003213 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in btrfs_read_chunk_tree
* Struck through repros no longer work on HEAD.