====================================================== WARNING: possible circular locking dependency detected 4.19.211-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/21934 is trying to acquire lock: 0000000040fb9be4 (sb_internal#4){.+.+}, at: sb_start_intwrite include/linux/fs.h:1626 [inline] 0000000040fb9be4 (sb_internal#4){.+.+}, at: start_transaction+0xa37/0xf90 fs/btrfs/transaction.c:528 but task is already holding lock: 00000000f5771832 (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x152/0x200 mm/util.c:355 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 (&mm->mmap_sem){++++}: __do_page_fault+0x97f/0xd60 arch/x86/mm/fault.c:1348 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1205 fault_in_pages_readable include/linux/pagemap.h:602 [inline] iov_iter_fault_in_readable+0x18b/0x3f0 lib/iov_iter.c:421 generic_perform_write+0x15d/0x4d0 mm/filemap.c:3160 __generic_file_write_iter+0x24b/0x610 mm/filemap.c:3295 ext4_file_write_iter+0x2fe/0xf20 fs/ext4/file.c:272 call_write_iter include/linux/fs.h:1821 [inline] new_sync_write fs/read_write.c:474 [inline] __vfs_write+0x51b/0x770 fs/read_write.c:487 vfs_write+0x1f3/0x540 fs/read_write.c:549 ksys_write+0x12b/0x2a0 fs/read_write.c:599 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #4 (&sb->s_type->i_mutex_key#10){++++}: inode_lock include/linux/fs.h:748 [inline] __generic_file_fsync+0xb0/0x1f0 fs/libfs.c:989 ext4_sync_file+0xa35/0x1420 fs/ext4/fsync.c:118 vfs_fsync_range fs/sync.c:197 [inline] vfs_fsync+0x127/0x1f0 fs/sync.c:211 __loop_update_dio+0x4cd/0x690 drivers/block/loop.c:209 loop_update_dio drivers/block/loop.c:636 [inline] loop_set_fd drivers/block/loop.c:1000 [inline] lo_ioctl+0xeee/0x20e0 drivers/block/loop.c:1576 __blkdev_driver_ioctl block/ioctl.c:303 [inline] blkdev_ioctl+0x5cb/0x1a80 block/ioctl.c:601 block_ioctl+0xe9/0x130 fs/block_dev.c:1906 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #3 (loop_ctl_mutex){+.+.}: lo_open+0x19/0xd0 drivers/block/loop.c:1771 __blkdev_get+0x372/0x1480 fs/block_dev.c:1494 blkdev_get+0xb0/0x940 fs/block_dev.c:1627 blkdev_open+0x202/0x290 fs/block_dev.c:1788 do_dentry_open+0x4aa/0x1160 fs/open.c:796 do_last fs/namei.c:3421 [inline] path_openat+0x793/0x2df0 fs/namei.c:3537 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #2 (&bdev->bd_mutex){+.+.}: blkdev_put+0x30/0x520 fs/block_dev.c:1839 btrfs_close_bdev fs/btrfs/volumes.c:1033 [inline] btrfs_close_one_device fs/btrfs/volumes.c:1057 [inline] close_fs_devices.part.0+0x24d/0x8e0 fs/btrfs/volumes.c:1085 close_fs_devices fs/btrfs/volumes.c:1117 [inline] btrfs_close_devices+0x95/0x1f0 fs/btrfs/volumes.c:1103 open_ctree+0x26b/0x61e0 fs/btrfs/disk-io.c:3326 btrfs_fill_super fs/btrfs/super.c:1209 [inline] btrfs_mount_root+0x12e5/0x1830 fs/btrfs/super.c:1613 mount_fs+0xa3/0x310 fs/super.c:1261 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961 vfs_kern_mount+0x3c/0x60 fs/namespace.c:951 btrfs_mount+0x23a/0xaa0 fs/btrfs/super.c:1681 mount_fs+0xa3/0x310 fs/super.c:1261 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961 vfs_kern_mount fs/namespace.c:951 [inline] do_new_mount fs/namespace.c:2492 [inline] do_mount+0x115c/0x2f50 fs/namespace.c:2822 ksys_mount+0xcf/0x130 fs/namespace.c:3038 __do_sys_mount fs/namespace.c:3052 [inline] __se_sys_mount fs/namespace.c:3049 [inline] __x64_sys_mount+0xba/0x150 fs/namespace.c:3049 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #1 (&fs_devs->device_list_mutex){+.+.}: btrfs_finish_chunk_alloc+0x27b/0xf90 fs/btrfs/volumes.c:4938 btrfs_create_pending_block_groups+0x242/0x590 fs/btrfs/extent-tree.c:10134 __btrfs_end_transaction+0x21a/0xb00 fs/btrfs/transaction.c:855 flush_space+0xa41/0xee0 fs/btrfs/extent-tree.c:4861 btrfs_async_reclaim_metadata_space+0x466/0x1050 fs/btrfs/extent-tree.c:4977 process_one_work+0x864/0x1570 kernel/workqueue.c:2153 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 -> #0 (sb_internal#4){.+.+}: 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+0x6e/0x2a0 fs/super.c:1366 sb_start_intwrite include/linux/fs.h:1626 [inline] start_transaction+0xa37/0xf90 fs/btrfs/transaction.c:528 btrfs_dirty_inode+0xe3/0x210 fs/btrfs/inode.c:6165 btrfs_update_time+0x33b/0x3d0 fs/btrfs/inode.c:6207 update_time fs/inode.c:1675 [inline] touch_atime+0x23c/0x2a0 fs/inode.c:1746 file_accessed include/linux/fs.h:2123 [inline] btrfs_file_mmap+0x11b/0x160 fs/btrfs/file.c:2274 call_mmap include/linux/fs.h:1826 [inline] mmap_region+0xc94/0x16b0 mm/mmap.c:1757 do_mmap+0x8e8/0x1080 mm/mmap.c:1530 do_mmap_pgoff include/linux/mm.h:2329 [inline] vm_mmap_pgoff+0x197/0x200 mm/util.c:357 ksys_mmap_pgoff+0x298/0x5a0 mm/mmap.c:1580 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: sb_internal#4 --> &sb->s_type->i_mutex_key#10 --> &mm->mmap_sem Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_sem); lock(&sb->s_type->i_mutex_key#10); lock(&mm->mmap_sem); lock(sb_internal#4); *** DEADLOCK *** 2 locks held by syz-executor.4/21934: #0: 00000000f5771832 (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x152/0x200 mm/util.c:355 #1: 00000000554c2ccc (sb_writers#32){.+.+}, at: sb_start_write_trylock include/linux/fs.h:1584 [inline] #1: 00000000554c2ccc (sb_writers#32){.+.+}, at: touch_atime+0x152/0x2a0 fs/inode.c:1731 stack backtrace: CPU: 1 PID: 21934 Comm: syz-executor.4 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222 check_prev_add kernel/locking/lockdep.c:1866 [inline] check_prevs_add kernel/locking/lockdep.c:1979 [inline] validate_chain kernel/locking/lockdep.c:2420 [inline] __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908 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+0x6e/0x2a0 fs/super.c:1366 sb_start_intwrite include/linux/fs.h:1626 [inline] start_transaction+0xa37/0xf90 fs/btrfs/transaction.c:528 btrfs_dirty_inode+0xe3/0x210 fs/btrfs/inode.c:6165 btrfs_update_time+0x33b/0x3d0 fs/btrfs/inode.c:6207 update_time fs/inode.c:1675 [inline] touch_atime+0x23c/0x2a0 fs/inode.c:1746 file_accessed include/linux/fs.h:2123 [inline] btrfs_file_mmap+0x11b/0x160 fs/btrfs/file.c:2274 call_mmap include/linux/fs.h:1826 [inline] mmap_region+0xc94/0x16b0 mm/mmap.c:1757 do_mmap+0x8e8/0x1080 mm/mmap.c:1530 do_mmap_pgoff include/linux/mm.h:2329 [inline] vm_mmap_pgoff+0x197/0x200 mm/util.c:357 ksys_mmap_pgoff+0x298/0x5a0 mm/mmap.c:1580 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f9f84f480f9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9f834ba168 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007f9f85067f80 RCX: 00007f9f84f480f9 RDX: 000000000000000b RSI: 0000000000b36000 RDI: 0000000020000000 RBP: 00007f9f84fa3ae9 R08: 000000000000000b R09: 0000000000000000 R10: 0000000000028011 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe043f520f R14: 00007f9f834ba300 R15: 0000000000022000 JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti@ is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "." or missing value jfs: Unrecognized mount option "." or missing value JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti@ is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: charset not found JFS: discard option not supported on device JFS: ¬Òö?\3!UcontiL is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti€ is an invalid error handler JFS: discard option not supported on device JFS: charset not found jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti€ is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: charset not found jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: discard option not supported on device JFS: ¬Òö?\3!UcontiÀ is an invalid error handler tmpfs: Bad value 'C3ep4' for mount option 'nr_inodes' jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device tmpfs: Bad value 'C3ep4' for mount option 'nr_inodes' JFS: discard option not supported on device JFS: discard option not supported on device JFS: ¬Òö?\3!UcontiÀ is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti] is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: charset not found JFS: discard option not supported on device JFS: ¬Òö?\3!Uconti is an invalid error handler jfs: Unrecognized mount option "0x0000000000000003" or missing value JFS: discard option not supported on device JFS: discard option not supported on device