block nbd3: shutting down sockets ====================================================== WARNING: possible circular locking dependency detected 4.19.211-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/13309 is trying to acquire lock: 00000000b16339f0 ((wq_completion)"knbd%d-recv"nbd->index){+.+.}, at: flush_workqueue+0xe8/0x13e0 kernel/workqueue.c:2658 but task is already holding lock: 000000008f6e32c5 (&nbd->config_lock){+.+.}, at: refcount_dec_and_mutex_lock lib/refcount.c:311 [inline] 000000008f6e32c5 (&nbd->config_lock){+.+.}, at: refcount_dec_and_mutex_lock+0x4a/0x80 lib/refcount.c:306 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #8 (&nbd->config_lock){+.+.}: nbd_open+0x2e2/0x6f0 drivers/block/nbd.c:1428 __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 -> #7 (nbd_index_mutex){+.+.}: nbd_open+0x73/0x6f0 drivers/block/nbd.c:1415 __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 -> #6 (&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 close_ctree+0x3c8/0x850 fs/btrfs/disk-io.c:4047 generic_shutdown_super+0x144/0x370 fs/super.c:456 kill_anon_super+0x36/0x60 fs/super.c:1032 btrfs_kill_super+0x49/0x550 fs/btrfs/super.c:2221 deactivate_locked_super+0x94/0x160 fs/super.c:329 deactivate_super+0x174/0x1a0 fs/super.c:360 cleanup_mnt+0x1a8/0x290 fs/namespace.c:1098 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #5 (&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 -> #4 (sb_internal#2){.+.+}: 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 -> #3 (&mm->mmap_sem){++++}: _copy_to_iter+0x3d0/0xea0 lib/iov_iter.c:564 copy_to_iter include/linux/uio.h:106 [inline] skb_copy_datagram_iter+0x469/0x9e0 net/core/datagram.c:431 skb_copy_datagram_msg include/linux/skbuff.h:3347 [inline] unix_dgram_recvmsg+0x3b7/0xdb0 net/unix/af_unix.c:2180 sock_recvmsg_nosec net/socket.c:859 [inline] sock_recvmsg net/socket.c:866 [inline] sock_recvmsg net/socket.c:862 [inline] __sys_recvfrom+0x249/0x3a0 net/socket.c:1956 __do_sys_recvfrom net/socket.c:1974 [inline] __se_sys_recvfrom net/socket.c:1970 [inline] __x64_sys_recvfrom+0xdd/0x1b0 net/socket.c:1970 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #2 (&u->iolock){+.+.}: unix_stream_read_generic+0x2de/0x1a40 net/unix/af_unix.c:2322 unix_stream_recvmsg+0xb1/0xf0 net/unix/af_unix.c:2505 sock_recvmsg_nosec net/socket.c:859 [inline] sock_recvmsg net/socket.c:866 [inline] sock_recvmsg+0xca/0x110 net/socket.c:862 sock_xmit+0x37d/0x5c0 drivers/block/nbd.c:439 nbd_read_stat drivers/block/nbd.c:633 [inline] recv_work+0x1e9/0x1100 drivers/block/nbd.c:732 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 -> #1 ((work_completion)(&args->work)){+.+.}: 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 ((wq_completion)"knbd%d-recv"nbd->index){+.+.}: flush_workqueue+0x117/0x13e0 kernel/workqueue.c:2661 drain_workqueue+0x1a5/0x460 kernel/workqueue.c:2826 destroy_workqueue+0x75/0x790 kernel/workqueue.c:4183 nbd_config_put+0x3c5/0x870 drivers/block/nbd.c:1175 nbd_release+0xf4/0x170 drivers/block/nbd.c:1461 __blkdev_put+0x636/0x870 fs/block_dev.c:1819 blkdev_close+0x86/0xb0 fs/block_dev.c:1888 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: (wq_completion)"knbd%d-recv"nbd->index --> nbd_index_mutex --> &nbd->config_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&nbd->config_lock); lock(nbd_index_mutex); lock(&nbd->config_lock); lock((wq_completion)"knbd%d-recv"nbd->index); *** DEADLOCK *** 2 locks held by syz-executor.3/13309: #0: 00000000af00b7a3 (&bdev->bd_mutex){+.+.}, at: __blkdev_put+0xfc/0x870 fs/block_dev.c:1806 #1: 000000008f6e32c5 (&nbd->config_lock){+.+.}, at: refcount_dec_and_mutex_lock lib/refcount.c:311 [inline] #1: 000000008f6e32c5 (&nbd->config_lock){+.+.}, at: refcount_dec_and_mutex_lock+0x4a/0x80 lib/refcount.c:306 stack backtrace: CPU: 1 PID: 13309 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 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 flush_workqueue+0x117/0x13e0 kernel/workqueue.c:2661 drain_workqueue+0x1a5/0x460 kernel/workqueue.c:2826 destroy_workqueue+0x75/0x790 kernel/workqueue.c:4183 nbd_config_put+0x3c5/0x870 drivers/block/nbd.c:1175 nbd_release+0xf4/0x170 drivers/block/nbd.c:1461 __blkdev_put+0x636/0x870 fs/block_dev.c:1819 blkdev_close+0x86/0xb0 fs/block_dev.c:1888 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f82723ba109 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:00007f827092c168 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 00007f82724d9f80 RCX: 00007f82723ba109 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00007f8272415ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe43fe5c2f R14: 00007f827092c300 R15: 0000000000022000 block nbd3: shutting down sockets netlink: 52 bytes leftover after parsing attributes in process `syz-executor.0'. block nbd3: shutting down sockets bridge0: port 2(bridge_slave_1) entered disabled state device bridge_slave_1 left promiscuous mode bridge0: port 2(bridge_slave_1) entered disabled state netlink: 52 bytes leftover after parsing attributes in process `syz-executor.0'. block nbd3: shutting down sockets netlink: 52 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 52 bytes leftover after parsing attributes in process `syz-executor.1'. device bridge_slave_1 left promiscuous mode bridge0: port 2(bridge_slave_1) entered disabled state EXT4-fs (loop3): Unrecognized mount option "smackfsfloor=(" or missing value netlink: 52 bytes leftover after parsing attributes in process `syz-executor.0'. EXT4-fs (loop3): Unrecognized mount option "smackfsfloor=(" or missing value netlink: 52 bytes leftover after parsing attributes in process `syz-executor.1'. audit: type=1800 audit(1669250069.420:207): pid=13538 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.0" name="bus" dev="sda1" ino=13894 res=0 audit: type=1804 audit(1669250069.420:208): pid=13538 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1798866365/syzkaller.giaQAP/1348/bus" dev="sda1" ino=13894 res=1 EXT4-fs (loop3): Unrecognized mount option "smackfsfloor=(" or missing value netlink: 52 bytes leftover after parsing attributes in process `syz-executor.1'. base_sock_release(000000001208e6f1) sk=00000000e59db609 EXT4-fs (loop3): Unrecognized mount option "smackfsfloor=(" or missing value base_sock_release(000000004f30acf2) sk=00000000acb891e0 base_sock_release(000000007e4cf550) sk=00000000a4fbb7c9 audit: type=1800 audit(1669250070.240:209): pid=13612 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.0" name="bus" dev="sda1" ino=13912 res=0 audit: type=1804 audit(1669250070.240:210): pid=13612 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1798866365/syzkaller.giaQAP/1349/bus" dev="sda1" ino=13912 res=1 audit: type=1800 audit(1669250070.420:211): pid=13630 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.3" name="bus" dev="sda1" ino=13920 res=0 audit: type=1804 audit(1669250070.440:212): pid=13630 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir3363194935/syzkaller.0uvR8h/1306/bus" dev="sda1" ino=13920 res=1 audit: type=1800 audit(1669250071.160:213): pid=13651 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=13912 res=0 audit: type=1804 audit(1669250071.190:214): pid=13651 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir1213818898/syzkaller.N2st10/1293/bus" dev="sda1" ino=13912 res=1 audit: type=1800 audit(1669250071.210:215): pid=13656 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.0" name="bus" dev="sda1" ino=13936 res=0 audit: type=1804 audit(1669250071.210:216): pid=13656 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1798866365/syzkaller.giaQAP/1350/bus" dev="sda1" ino=13936 res=1 audit: type=1800 audit(1669250071.470:217): pid=13680 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.3" name="bus" dev="sda1" ino=13947 res=0 audit: type=1804 audit(1669250071.470:218): pid=13680 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir3363194935/syzkaller.0uvR8h/1307/bus" dev="sda1" ino=13947 res=1 audit: type=1800 audit(1669250071.790:219): pid=13693 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.0" name="bus" dev="sda1" ino=13916 res=0 audit: type=1804 audit(1669250071.820:220): pid=13693 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1798866365/syzkaller.giaQAP/1351/bus" dev="sda1" ino=13916 res=1 audit: type=1800 audit(1669250072.080:221): pid=13709 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.3" name="bus" dev="sda1" ino=13951 res=0 audit: type=1800 audit(1669250072.080:222): pid=13712 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=13952 res=0 kauditd_printk_skb: 4 callbacks suppressed audit: type=1800 audit(1669250076.550:227): pid=14163 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.3" name="bus" dev="sda1" ino=13872 res=0 audit: type=1800 audit(1669250076.550:228): pid=14165 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.0" name="bus" dev="sda1" ino=13967 res=0 audit: type=1800 audit(1669250076.550:229): pid=14164 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.1" name="bus" dev="sda1" ino=13977 res=0 audit: type=1804 audit(1669250076.550:230): pid=14163 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir3363194935/syzkaller.0uvR8h/1309/bus" dev="sda1" ino=13872 res=1 audit: type=1804 audit(1669250076.580:231): pid=14164 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir3600564644/syzkaller.XaDzKV/1440/bus" dev="sda1" ino=13977 res=1 audit: type=1804 audit(1669250076.580:232): pid=14165 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1798866365/syzkaller.giaQAP/1352/bus" dev="sda1" ino=13967 res=1 audit: type=1800 audit(1669250076.620:233): pid=14175 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=13979 res=0