BTRFS info (device loop8): enabling ssd optimizations BTRFS info (device loop8): turning on async discard BTRFS info (device loop8): enabling free space tree BTRFS info (device loop8): use zstd compression, level 3 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.8.6633/27696 is trying to acquire lock: ffff8880847940f0 (btrfs-tree-00){++++}-{4:4}, at: btrfs_tree_read_lock_nested+0x45/0x250 fs/btrfs/locking.c:146 but task is already holding lock: ffff888084795360 (btrfs-tree-01){++++}-{4:4}, at: btrfs_tree_read_lock_nested+0x45/0x250 fs/btrfs/locking.c:146 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #10 (btrfs-tree-01){++++}-{4:4}: down_read_nested+0x47/0x320 kernel/locking/rwsem.c:1709 btrfs_tree_read_lock_nested+0x45/0x250 fs/btrfs/locking.c:146 btrfs_tree_read_lock fs/btrfs/locking.h:188 [inline] btrfs_read_lock_root_node+0x3f/0xd0 fs/btrfs/locking.c:267 btrfs_search_slot_get_root fs/btrfs/ctree.c:1740 [inline] btrfs_search_slot+0x66c/0x2d20 fs/btrfs/ctree.c:2070 btrfs_lookup_file_extent+0xe6/0x140 fs/btrfs/file-item.c:265 btrfs_drop_extents+0x444/0x29b0 fs/btrfs/file.c:170 __cow_file_range_inline+0x270/0x1000 fs/btrfs/inode.c:638 run_delalloc_inline fs/btrfs/inode.c:2354 [inline] btrfs_run_delalloc_range+0x1932/0x1e80 fs/btrfs/inode.c:2410 writepage_delalloc+0x10a4/0x1c60 fs/btrfs/extent_io.c:1685 extent_writepage fs/btrfs/extent_io.c:2081 [inline] extent_write_cache_pages fs/btrfs/extent_io.c:2834 [inline] btrfs_writepages+0x15df/0x2830 fs/btrfs/extent_io.c:2965 do_writepages+0x338/0x560 mm/page-writeback.c:2562 filemap_writeback mm/filemap.c:386 [inline] filemap_fdatawrite_range+0x1ef/0x2f0 mm/filemap.c:411 btrfs_fdatawrite_range+0x54/0xf0 fs/btrfs/file.c:3872 btrfs_wait_ordered_range+0x59/0x260 fs/btrfs/ordered-data.c:910 btrfs_fallocate+0xbc8/0x1df0 fs/btrfs/file.c:3162 vfs_fallocate+0x65a/0x7e0 fs/open.c:338 ksys_fallocate fs/open.c:362 [inline] __do_sys_fallocate fs/open.c:367 [inline] __se_sys_fallocate fs/open.c:365 [inline] __x64_sys_fallocate+0xbf/0x110 fs/open.c:365 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #9 (btrfs_trans_num_extwriters){++++}-{0:0}: join_transaction+0x180/0x1030 fs/btrfs/transaction.c:346 start_transaction+0x731/0x1830 fs/btrfs/transaction.c:753 btrfs_dirty_inode+0x9f/0x190 fs/btrfs/inode.c:6386 file_update_time_flags+0x285/0x440 fs/inode.c:2502 btrfs_fallocate+0x79a/0x1df0 fs/btrfs/file.c:3126 vfs_fallocate+0x65a/0x7e0 fs/open.c:338 ksys_fallocate fs/open.c:362 [inline] __do_sys_fallocate fs/open.c:367 [inline] __se_sys_fallocate fs/open.c:365 [inline] __x64_sys_fallocate+0xbf/0x110 fs/open.c:365 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #8 (btrfs_trans_num_writers){++++}-{0:0}: __lock_release kernel/locking/lockdep.c:5627 [inline] lock_release+0x1a3/0x3c0 kernel/locking/lockdep.c:5964 percpu_up_read include/linux/percpu-rwsem.h:114 [inline] __sb_end_write include/linux/fs/super.h:14 [inline] sb_end_intwrite+0x26/0x190 include/linux/fs/super.h:101 __btrfs_end_transaction+0x237/0x640 fs/btrfs/transaction.c:1124 btrfs_dirty_inode+0x14c/0x190 fs/btrfs/inode.c:6400 touch_atime+0x2f8/0x670 fs/inode.c:2347 file_accessed include/linux/fs.h:2286 [inline] btrfs_file_mmap_prepare+0x172/0x1f0 fs/btrfs/file.c:2010 vfs_mmap_prepare include/linux/fs.h:2076 [inline] call_mmap_prepare mm/vma.c:2986 [inline] __mmap_region mm/vma.c:3103 [inline] mmap_region+0x1191/0x2820 mm/vma.c:3201 do_mmap+0xe0a/0x1300 mm/mmap.c:573 vm_mmap_pgoff+0x27a/0x520 mm/util.c:581 ksys_mmap_pgoff+0x4dc/0x760 mm/mmap.c:619 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #7 (&mm->mmap_lock){++++}-{4:4}: __might_fault+0xcb/0x130 mm/memory.c:7607 _copy_from_iter+0x100/0x1680 lib/iov_iter.c:271 copy_from_iter include/linux/uio.h:236 [inline] copy_from_iter_full include/linux/uio.h:253 [inline] skb_do_copy_data_nocache include/net/sock.h:2345 [inline] skb_copy_to_page_nocache include/net/sock.h:2371 [inline] tcp_sendmsg_locked+0x244e/0x57c0 net/ipv4/tcp.c:1324 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1467 sock_sendmsg_nosec+0x10f/0x190 net/socket.c:801 __sock_sendmsg net/socket.c:818 [inline] sock_write_iter+0x2de/0x3e0 net/socket.c:1269 new_sync_write fs/read_write.c:575 [inline] vfs_write+0x612/0xba0 fs/read_write.c:667 ksys_write+0x150/0x270 fs/read_write.c:719 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #6 (sk_lock-AF_INET){+.+.}-{0:0}: lock_sock_nested+0x41/0x100 net/core/sock.c:3909 lock_sock include/net/sock.h:1717 [inline] inet_shutdown+0x6a/0x390 net/ipv4/af_inet.c:913 nbd_mark_nsock_dead+0x2cb/0x550 drivers/block/nbd.c:319 recv_work+0x1d14/0x1e30 drivers/block/nbd.c:1030 process_one_work kernel/workqueue.c:3497 [inline] process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3580 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3661 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #5 (&nsock->tx_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 nbd_handle_cmd drivers/block/nbd.c:1143 [inline] nbd_queue_rq+0x373/0xff0 drivers/block/nbd.c:1207 blk_mq_dispatch_rq_list+0x499/0x1990 block/blk-mq.c:2141 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xd36/0x1580 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0x167/0x2f0 block/blk-mq.c:2556 process_one_work kernel/workqueue.c:3497 [inline] process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3580 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3661 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #4 (&cmd->lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 nbd_queue_rq+0xc1/0xff0 drivers/block/nbd.c:1199 blk_mq_dispatch_rq_list+0x499/0x1990 block/blk-mq.c:2141 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xd36/0x1580 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0x167/0x2f0 block/blk-mq.c:2556 process_one_work kernel/workqueue.c:3497 [inline] process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3580 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3661 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #3 (set->srcu){.+.+}-{0:0}: srcu_lock_sync include/linux/srcu.h:261 [inline] __synchronize_srcu+0xca/0x2f0 kernel/rcu/srcutree.c:1662 elevator_switch+0x1e8/0x7b0 block/elevator.c:576 elevator_change+0x2fa/0x480 block/elevator.c:681 elevator_set_default+0x375/0x440 block/elevator.c:754 blk_register_queue+0x404/0x4f0 block/blk-sysfs.c:992 __add_disk+0x6b8/0xdb0 block/genhd.c:531 add_disk_fwnode+0x100/0x3a0 block/genhd.c:600 add_disk include/linux/blkdev.h:799 [inline] nbd_dev_add+0x733/0xb60 drivers/block/nbd.c:2027 nbd_init+0x168/0x1f0 drivers/block/nbd.c:2744 do_one_initcall+0x250/0x870 init/main.c:1432 do_initcall_level+0x10a/0x1a0 init/main.c:1494 do_initcalls+0x59/0xa0 init/main.c:1510 kernel_init_freeable+0x29d/0x3e0 init/main.c:1745 kernel_init+0x22/0x1d0 init/main.c:1635 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #2 (&q->elevator_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 elevator_change+0x1af/0x480 block/elevator.c:679 elv_iosched_store+0x50e/0x630 block/elevator.c:831 queue_attr_store+0x207/0x2b0 block/blk-sysfs.c:906 kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345 iter_file_splice_write+0x9f9/0x11c0 fs/splice.c:660 do_splice_from fs/splice.c:863 [inline] direct_splice_actor+0x101/0x160 fs/splice.c:1114 splice_direct_to_actor+0x57b/0xcb0 fs/splice.c:1023 do_splice_direct_actor fs/splice.c:1157 [inline] do_splice_direct+0x195/0x290 fs/splice.c:1183 do_sendfile+0x52e/0x7c0 fs/read_write.c:1351 __do_sys_sendfile64 fs/read_write.c:1412 [inline] __se_sys_sendfile64+0x144/0x1a0 fs/read_write.c:1398 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&q->q_usage_counter(io)#17){++++}-{0:0}: bio_queue_enter block/blk.h:95 [inline] blk_mq_submit_bio+0x7c6/0x2eb0 block/blk-mq.c:3149 __submit_bio_noacct_mq block/blk-core.c:755 [inline] submit_bio_noacct_nocheck+0x2fe/0xb80 block/blk-core.c:789 btrfs_submit_chunk fs/btrfs/bio.c:823 [inline] btrfs_submit_bbio+0x132d/0x1ee0 fs/btrfs/bio.c:882 read_extent_buffer_pages_nowait+0x747/0x860 fs/btrfs/extent_io.c:4381 read_extent_buffer_pages+0x22/0x100 fs/btrfs/extent_io.c:4390 btrfs_read_extent_buffer+0x9d/0x730 fs/btrfs/disk-io.c:236 read_block_for_search+0x67e/0xa40 fs/btrfs/ctree.c:1569 btrfs_search_slot+0x147a/0x2d20 fs/btrfs/ctree.c:2198 btrfs_init_root_free_objectid+0xf5/0x290 fs/btrfs/disk-io.c:5058 btrfs_init_fs_root+0x204/0x3b0 fs/btrfs/disk-io.c:1114 btrfs_get_root_ref+0x3c8/0x890 fs/btrfs/disk-io.c:1365 btrfs_get_fs_root fs/btrfs/disk-io.c:1417 [inline] open_ctree+0x2d07/0x4140 fs/btrfs/disk-io.c:3805 btrfs_fill_super fs/btrfs/super.c:971 [inline] btrfs_get_tree_super fs/btrfs/super.c:1956 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2099 [inline] btrfs_get_tree+0x10cf/0x1a00 fs/btrfs/super.c:2133 vfs_get_tree+0x92/0x2a0 fs/super.c:1881 fc_mount fs/namespace.c:1282 [inline] do_new_mount_fc fs/namespace.c:3910 [inline] do_new_mount+0x325/0xb00 fs/namespace.c:3986 do_mount fs/namespace.c:4350 [inline] __do_sys_mount fs/namespace.c:4563 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4540 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (btrfs-tree-00){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 down_read_nested+0x47/0x320 kernel/locking/rwsem.c:1709 btrfs_tree_read_lock_nested+0x45/0x250 fs/btrfs/locking.c:146 btrfs_tree_read_lock fs/btrfs/locking.h:188 [inline] btrfs_search_slot+0x15e1/0x2d20 fs/btrfs/ctree.c:2224 btrfs_lookup_match_dir fs/btrfs/dir-item.c:196 [inline] btrfs_lookup_dir_item+0x154/0x280 fs/btrfs/dir-item.c:234 btrfs_inode_by_name fs/btrfs/inode.c:5726 [inline] btrfs_lookup_dentry+0x269/0x1390 fs/btrfs/inode.c:6018 btrfs_lookup+0x1d/0x40 fs/btrfs/inode.c:6091 lookup_open+0xa54/0x1ae0 fs/namei.c:4536 open_last_lookups fs/namei.c:4774 [inline] path_openat+0x70c/0x20f0 fs/namei.c:5013 do_file_open+0x23e/0x4a0 fs/namei.c:5045 do_sys_openat2+0x115/0x200 fs/open.c:1443 do_sys_open fs/open.c:1449 [inline] __do_sys_openat fs/open.c:1465 [inline] __se_sys_openat fs/open.c:1460 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1460 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: btrfs-tree-00 --> btrfs_trans_num_extwriters --> btrfs-tree-01 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(btrfs-tree-01); lock(btrfs_trans_num_extwriters); lock(btrfs-tree-01); rlock(btrfs-tree-00); *** DEADLOCK *** locks held by syz.8.6633/27696: 4, on CPU#1: #0: ffff8880845de478 (sb_writers#14){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:531 #1: ffff888053a7a610 (&type->i_mutex_dir_key#11){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:1042 [inline] #1: ffff888053a7a610 (&type->i_mutex_dir_key#11){++++}-{4:4}, at: lookup_open+0x221/0x1ae0 fs/namei.c:4466 #2: ffff888077541ca0 (DCACHE_PAR_LOOKUP#17){+.+.}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline] #2: ffff888077541ca0 (DCACHE_PAR_LOOKUP#17){+.+.}-{0:0}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #2: ffff888077541ca0 (DCACHE_PAR_LOOKUP#17){+.+.}-{0:0}, at: __d_alloc_parallel+0x39e/0x1700 fs/dcache.c:2919 #3: ffff888084795360 (btrfs-tree-01){++++}-{4:4}, at: btrfs_tree_read_lock_nested+0x45/0x250 fs/btrfs/locking.c:146 stack backtrace: CPU: 1 UID: 0 PID: 27696 Comm: syz.8.6633 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219 check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 down_read_nested+0x47/0x320 kernel/locking/rwsem.c:1709 btrfs_tree_read_lock_nested+0x45/0x250 fs/btrfs/locking.c:146 btrfs_tree_read_lock fs/btrfs/locking.h:188 [inline] btrfs_search_slot+0x15e1/0x2d20 fs/btrfs/ctree.c:2224 btrfs_lookup_match_dir fs/btrfs/dir-item.c:196 [inline] btrfs_lookup_dir_item+0x154/0x280 fs/btrfs/dir-item.c:234 btrfs_inode_by_name fs/btrfs/inode.c:5726 [inline] btrfs_lookup_dentry+0x269/0x1390 fs/btrfs/inode.c:6018 btrfs_lookup+0x1d/0x40 fs/btrfs/inode.c:6091 lookup_open+0xa54/0x1ae0 fs/namei.c:4536 open_last_lookups fs/namei.c:4774 [inline] path_openat+0x70c/0x20f0 fs/namei.c:5013 do_file_open+0x23e/0x4a0 fs/namei.c:5045 do_sys_openat2+0x115/0x200 fs/open.c:1443 do_sys_open fs/open.c:1449 [inline] __do_sys_openat fs/open.c:1465 [inline] __se_sys_openat fs/open.c:1460 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1460 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f2fae9a9c99 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2faf7d3028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f2faec35fa0 RCX: 00007f2fae9a9c99 RDX: 0000000000000002 RSI: 000020000000de80 RDI: ffffffffffffff9c RBP: 00007f2faea3b18b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f2faec36038 R14: 00007f2faec35fa0 R15: 00007ffdd78f3be8