BTRFS info (device loop2): using free space tree BTRFS info (device loop2): has skinny extents ====================================================== WARNING: possible circular locking dependency detected 4.14.302-syzkaller #0 Not tainted ------------------------------------------------------ kworker/u4:5/5872 is trying to acquire lock: (sb_internal#3){.+.+}, at: [] sb_start_intwrite include/linux/fs.h:1598 [inline] (sb_internal#3){.+.+}, at: [] start_transaction+0x6de/0xf30 fs/btrfs/transaction.c:548 but task is already holding lock: ((&work->normal_work)){+.+.}, at: [] process_one_work+0x6e6/0x14a0 kernel/workqueue.c:2092 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 ((&work->normal_work)){+.+.}: process_one_work+0x736/0x14a0 kernel/workqueue.c:2093 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251 kthread+0x30d/0x420 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406 -> #2 ("%s-%s""btrfs", name){+.+.}: flush_workqueue+0xfa/0x1310 kernel/workqueue.c:2625 drain_workqueue+0x177/0x3e0 kernel/workqueue.c:2790 destroy_workqueue+0x71/0x710 kernel/workqueue.c:4116 __btrfs_destroy_workqueue fs/btrfs/async-thread.c:436 [inline] btrfs_destroy_workqueue+0xf8/0x630 fs/btrfs/async-thread.c:447 scrub_workers_put+0x90/0x1a0 fs/btrfs/scrub.c:4075 btrfs_scrub_dev+0x536/0xcd0 fs/btrfs/scrub.c:4219 btrfs_ioctl_scrub fs/btrfs/ioctl.c:4451 [inline] btrfs_ioctl+0xba8/0x5b20 fs/btrfs/ioctl.c:5681 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 -> #1 (&fs_info->scrub_lock){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 btrfs_scrub_pause+0x80/0x330 fs/btrfs/scrub.c:4229 btrfs_commit_transaction+0x534/0x2210 fs/btrfs/transaction.c:2099 btrfs_commit_super+0xb1/0xf0 fs/btrfs/disk-io.c:3714 close_ctree+0x622/0x840 fs/btrfs/disk-io.c:3775 generic_shutdown_super+0x144/0x370 fs/super.c:446 kill_anon_super+0x36/0x90 fs/super.c:1006 btrfs_kill_super+0x49/0x540 fs/btrfs/super.c:2163 deactivate_locked_super+0x6c/0xd0 fs/super.c:319 deactivate_super+0x7f/0xa0 fs/super.c:350 cleanup_mnt+0x186/0x2c0 fs/namespace.c:1183 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 -> #0 (sb_internal#3){.+.+}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline] percpu_down_read include/linux/percpu-rwsem.h:59 [inline] __sb_start_write+0x64/0x260 fs/super.c:1342 sb_start_intwrite include/linux/fs.h:1598 [inline] start_transaction+0x6de/0xf30 fs/btrfs/transaction.c:548 btrfs_qgroup_rescan_worker+0x176/0x1060 fs/btrfs/qgroup.c:2632 normal_work_helper+0x304/0x1330 fs/btrfs/async-thread.c:376 process_one_work+0x793/0x14a0 kernel/workqueue.c:2117 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251 kthread+0x30d/0x420 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406 other info that might help us debug this: Chain exists of: sb_internal#3 --> "%s-%s""btrfs", name --> (&work->normal_work) Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock((&work->normal_work)); lock("%s-%s""btrfs", name); lock((&work->normal_work)); lock(sb_internal#3); *** DEADLOCK *** 2 locks held by kworker/u4:5/5872: #0: ("%s-%s""btrfs", name){+.+.}, at: [] process_one_work+0x6b0/0x14a0 kernel/workqueue.c:2088 #1: ((&work->normal_work)){+.+.}, at: [] process_one_work+0x6e6/0x14a0 kernel/workqueue.c:2092 stack backtrace: CPU: 1 PID: 5872 Comm: kworker/u4:5 Not tainted 4.14.302-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: btrfs-qgroup-rescan btrfs_qgroup_rescan_helper Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1905 [inline] check_prevs_add kernel/locking/lockdep.c:2022 [inline] validate_chain kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline] percpu_down_read include/linux/percpu-rwsem.h:59 [inline] __sb_start_write+0x64/0x260 fs/super.c:1342 sb_start_intwrite include/linux/fs.h:1598 [inline] start_transaction+0x6de/0xf30 fs/btrfs/transaction.c:548 btrfs_qgroup_rescan_worker+0x176/0x1060 fs/btrfs/qgroup.c:2632 normal_work_helper+0x304/0x1330 fs/btrfs/async-thread.c:376 process_one_work+0x793/0x14a0 kernel/workqueue.c:2117 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251 kthread+0x30d/0x420 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406 BTRFS error (device loop2): fail to start transaction for status update: -28 input: syz1 as /devices/virtual/input/input22 Restarting kernel threads ... done. REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal REISERFS (device loop0): using ordered data mode reiserfs: using flush barriers REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 REISERFS (device loop0): checking transaction log (loop0) BTRFS info (device loop2): using free space tree BTRFS info (device loop2): has skinny extents REISERFS (device loop0): Using r5 hash to sort names REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage. BTRFS error (device loop2): fail to start transaction for status update: -28 REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal input: syz1 as /devices/virtual/input/input23 REISERFS (device loop0): using ordered data mode reiserfs: using flush barriers REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 REISERFS (device loop0): checking transaction log (loop0) input: syz1 as /devices/virtual/input/input24 REISERFS (device loop0): Using r5 hash to sort names REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage. BTRFS info (device loop2): using free space tree input: syz1 as /devices/virtual/input/input25 BTRFS info (device loop2): has skinny extents REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal REISERFS (device loop0): using ordered data mode reiserfs: using flush barriers REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 BTRFS error (device loop2): fail to start transaction for status update: -28 REISERFS (device loop0): checking transaction log (loop0) REISERFS (device loop0): Using r5 hash to sort names REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage. REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal REISERFS (device loop0): using ordered data mode reiserfs: using flush barriers REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 REISERFS (device loop0): checking transaction log (loop0) REISERFS (device loop0): Using r5 hash to sort names REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage. BTRFS info (device loop2): using free space tree BTRFS info (device loop2): has skinny extents BTRFS error (device loop2): fail to start transaction for status update: -28 REISERFS (device loop2): found reiserfs format "3.6" with non-standard journal REISERFS (device loop2): using ordered data mode reiserfs: using flush barriers REISERFS (device loop2): journal params: device loop2, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 REISERFS (device loop2): checking transaction log (loop2) REISERFS (device loop2): Using r5 hash to sort names REISERFS (device loop2): Created .reiserfs_priv - reserved for xattr storage. REISERFS (device loop2): found reiserfs format "3.6" with non-standard journal REISERFS (device loop2): using ordered data mode reiserfs: using flush barriers REISERFS (device loop2): journal params: device loop2, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 REISERFS (device loop2): checking transaction log (loop2) REISERFS (device loop2): Using r5 hash to sort names REISERFS (device loop2): Created .reiserfs_priv - reserved for xattr storage. REISERFS (device loop2): found reiserfs format "3.6" with non-standard journal REISERFS (device loop2): using ordered data mode reiserfs: using flush barriers REISERFS (device loop2): journal params: device loop2, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 REISERFS (device loop2): checking transaction log (loop2) REISERFS (device loop2): Using r5 hash to sort names REISERFS (device loop2): Created .reiserfs_priv - reserved for xattr storage. input: syz1 as /devices/virtual/input/input26