Warning: Permanently added '10.128.1.85' (ECDSA) to the list of known hosts. [ 69.805921][ T8450] md: md1 stopped. [ 69.827158][ T5] [ 69.829485][ T5] ====================================================== [ 69.836489][ T5] WARNING: possible circular locking dependency detected [ 69.843507][ T5] 5.13.0-rc2-next-20210518-syzkaller #0 Not tainted [ 69.850085][ T5] ------------------------------------------------------ [ 69.857106][ T5] kworker/0:0/5 is trying to acquire lock: [ 69.862915][ T5] ffff88814608aea0 (&bdev->bd_mutex){+.+.}-{3:3}, at: del_gendisk+0x250/0x9e0 [ 69.871822][ T5] [ 69.871822][ T5] but task is already holding lock: [ 69.879213][ T5] ffffffff8c9e4c70 (bdev_lookup_sem){++++}-{3:3}, at: del_gendisk+0x222/0x9e0 [ 69.888083][ T5] [ 69.888083][ T5] which lock already depends on the new lock. [ 69.888083][ T5] [ 69.898471][ T5] [ 69.898471][ T5] the existing dependency chain (in reverse order) is: [ 69.907477][ T5] [ 69.907477][ T5] -> #5 (bdev_lookup_sem){++++}-{3:3}: [ 69.915222][ T5] down_write+0x92/0x150 [ 69.919987][ T5] del_gendisk+0x222/0x9e0 [ 69.924920][ T5] md_free+0xcb/0x200 [ 69.929438][ T5] kobject_put+0x1c8/0x540 [ 69.934368][ T5] process_one_work+0x98d/0x1600 [ 69.939835][ T5] worker_thread+0x64c/0x1120 [ 69.945274][ T5] kthread+0x3b1/0x4a0 [ 69.949860][ T5] ret_from_fork+0x1f/0x30 [ 69.954789][ T5] [ 69.954789][ T5] -> #4 ((work_completion)(&mddev->del_work)){+.+.}-{0:0}: [ 69.964165][ T5] process_one_work+0x8fc/0x1600 [ 69.969641][ T5] worker_thread+0x64c/0x1120 [ 69.974836][ T5] kthread+0x3b1/0x4a0 [ 69.979432][ T5] ret_from_fork+0x1f/0x30 [ 69.984379][ T5] [ 69.984379][ T5] -> #3 ((wq_completion)md_misc){+.+.}-{0:0}: [ 69.992629][ T5] flush_workqueue+0x110/0x13e0 [ 69.997993][ T5] md_alloc+0x29/0x1170 [ 70.002692][ T5] md_probe+0x69/0x70 [ 70.007187][ T5] blk_request_module+0x111/0x1d0 [ 70.012736][ T5] blkdev_get_no_open+0x225/0x2b0 [ 70.018294][ T5] blkdev_get_by_dev+0x76/0x660 [ 70.023661][ T5] blkdev_open+0x154/0x2b0 [ 70.028602][ T5] do_dentry_open+0x4b9/0x11c0 [ 70.033893][ T5] path_openat+0x1c09/0x27d0 [ 70.039006][ T5] do_filp_open+0x190/0x3d0 [ 70.044017][ T5] do_sys_openat2+0x16d/0x420 [ 70.049240][ T5] __x64_sys_openat+0x13f/0x1f0 [ 70.054620][ T5] do_syscall_64+0x31/0xb0 [ 70.059549][ T5] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 70.065961][ T5] [ 70.065961][ T5] -> #2 (major_names_lock){+.+.}-{3:3}: [ 70.073684][ T5] __mutex_lock+0x139/0x1120 [ 70.078827][ T5] __register_blkdev+0x2b/0x3e0 [ 70.084222][ T5] register_mtd_blktrans+0x85/0x3c0 [ 70.089990][ T5] do_one_initcall+0x103/0x650 [ 70.095268][ T5] kernel_init_freeable+0x643/0x6cc [ 70.101006][ T5] kernel_init+0xd/0x1c0 [ 70.105760][ T5] ret_from_fork+0x1f/0x30 [ 70.110690][ T5] [ 70.110690][ T5] -> #1 (mtd_table_mutex){+.+.}-{3:3}: [ 70.118324][ T5] __mutex_lock+0x139/0x1120 [ 70.123444][ T5] blktrans_open+0x69/0x600 [ 70.128467][ T5] __blkdev_get+0x135/0xa30 [ 70.133488][ T5] blkdev_get_by_dev+0x200/0x660 [ 70.138949][ T5] blkdev_open+0x154/0x2b0 [ 70.143913][ T5] do_dentry_open+0x4b9/0x11c0 [ 70.149223][ T5] path_openat+0x1c09/0x27d0 [ 70.154332][ T5] do_filp_open+0x190/0x3d0 [ 70.159349][ T5] do_sys_openat2+0x16d/0x420 [ 70.164540][ T5] __x64_sys_open+0x119/0x1c0 [ 70.169758][ T5] do_syscall_64+0x31/0xb0 [ 70.174693][ T5] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 70.181101][ T5] [ 70.181101][ T5] -> #0 (&bdev->bd_mutex){+.+.}-{3:3}: [ 70.188745][ T5] __lock_acquire+0x2a17/0x5230 [ 70.194108][ T5] lock_acquire+0x1ab/0x740 [ 70.199170][ T5] __mutex_lock+0x139/0x1120 [ 70.204277][ T5] del_gendisk+0x250/0x9e0 [ 70.209231][ T5] md_free+0xcb/0x200 [ 70.213723][ T5] kobject_put+0x1c8/0x540 [ 70.218647][ T5] process_one_work+0x98d/0x1600 [ 70.224118][ T5] worker_thread+0x64c/0x1120 [ 70.229316][ T5] kthread+0x3b1/0x4a0 [ 70.233908][ T5] ret_from_fork+0x1f/0x30 [ 70.238838][ T5] [ 70.238838][ T5] other info that might help us debug this: [ 70.238838][ T5] [ 70.249048][ T5] Chain exists of: [ 70.249048][ T5] &bdev->bd_mutex --> (work_completion)(&mddev->del_work) --> bdev_lookup_sem [ 70.249048][ T5] [ 70.263832][ T5] Possible unsafe locking scenario: [ 70.263832][ T5] [ 70.271268][ T5] CPU0 CPU1 [ 70.276632][ T5] ---- ---- [ 70.282000][ T5] lock(bdev_lookup_sem); [ 70.286409][ T5] lock((work_completion)(&mddev->del_work)); [ 70.295073][ T5] lock(bdev_lookup_sem); [ 70.302010][ T5] lock(&bdev->bd_mutex); [ 70.306428][ T5] [ 70.306428][ T5] *** DEADLOCK *** [ 70.306428][ T5] [ 70.314551][ T5] 3 locks held by kworker/0:0/5: [ 70.319499][ T5] #0: ffff888141988538 ((wq_completion)md_misc){+.+.}-{0:0}, at: process_one_work+0x871/0x1600 [ 70.329984][ T5] #1: ffffc90000ca7da8 ((work_completion)(&mddev->del_work)){+.+.}-{0:0}, at: process_one_work+0x8a5/0x1600 [ 70.341589][ T5] #2: ffffffff8c9e4c70 (bdev_lookup_sem){++++}-{3:3}, at: del_gendisk+0x222/0x9e0 [ 70.350894][ T5] [ 70.350894][ T5] stack backtrace: [ 70.356762][ T5] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.13.0-rc2-next-20210518-syzkaller #0 [ 70.366136][ T5] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 [ 70.376203][ T5] Workqueue: md_misc mddev_delayed_delete [ 70.381926][ T5] Call Trace: [ 70.385214][ T5] dump_stack_lvl+0x13e/0x1d6 [ 70.389924][ T5] check_noncircular+0x25f/0x2e0 [ 70.394873][ T5] ? print_circular_bug+0x1e0/0x1e0 [ 70.400109][ T5] ? arch_stack_walk+0x7d/0xe0 [ 70.404867][ T5] ? lockdep_lock+0xc6/0x200 [ 70.409461][ T5] ? call_rcu_zapped+0xb0/0xb0 [ 70.414223][ T5] __lock_acquire+0x2a17/0x5230 [ 70.419090][ T5] ? lockdep_hardirqs_on_prepare+0x400/0x400 [ 70.425090][ T5] lock_acquire+0x1ab/0x740 [ 70.429591][ T5] ? del_gendisk+0x250/0x9e0 [ 70.434192][ T5] ? lock_release+0x720/0x720 [ 70.438893][ T5] ? lockdep_hardirqs_on_prepare+0x400/0x400 [ 70.444876][ T5] __mutex_lock+0x139/0x1120 [ 70.449476][ T5] ? del_gendisk+0x250/0x9e0 [ 70.454073][ T5] ? del_gendisk+0x250/0x9e0 [ 70.458820][ T5] ? mutex_lock_io_nested+0xf70/0xf70 [ 70.464191][ T5] ? down_write+0xe0/0x150 [ 70.468634][ T5] ? down_write_killable+0x170/0x170 [ 70.473958][ T5] ? sysfs_remove_files+0x87/0xf0 [ 70.478980][ T5] del_gendisk+0x250/0x9e0 [ 70.483417][ T5] md_free+0xcb/0x200 [ 70.487448][ T5] kobject_put+0x1c8/0x540 [ 70.491876][ T5] process_one_work+0x98d/0x1600 [ 70.496813][ T5] ? pwq_dec_nr_in_flight+0x320/0x320 [ 70.502182][ T5] ? rwlock_bug.part.0+0x90/0x90 [ 70.507142][ T5] ? _raw_spin_lock_irq+0x41/0x50 [ 70.512164][ T5] worker_thread+0x64c/0x1120 [ 70.516847][ T5] ? process_one_work+0x1600/0x1600 [ 70.522057][ T5] kthread+0x3b1/0x4a0 [ 70.526139][ T5] ? __kthread_bind_mask+0xc