md: could not open device unknown-block(1,0). ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.3.937/7948 is trying to acquire lock: ffff88807de0a878 (kn->active#64){++++}-{0:0}, at: __kernfs_remove+0x493/0x910 fs/kernfs/dir.c:1629 but task is already holding lock: ffff88807c73c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_lock drivers/md/md.h:713 [inline] ffff88807c73c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: array_state_store+0x4d0/0xec0 drivers/md/md.c:4731 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mddev->reconfig_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 mddev_lock drivers/md/md.h:713 [inline] mddev_suspend_and_lock drivers/md/md.h:1026 [inline] location_store+0xc6/0xc80 drivers/md/md-bitmap.c:2634 md_attr_store+0x3b7/0x640 drivers/md/md.c:6188 kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:580 [inline] vfs_write+0x612/0xba0 fs/read_write.c:672 ksys_write+0x150/0x270 fs/read_write.c:1021 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 (kn->active#64){++++}-{0:0}: 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 kernfs_drain+0x293/0x640 fs/kernfs/dir.c:534 __kernfs_remove+0x493/0x910 fs/kernfs/dir.c:1629 kernfs_remove_by_name_ns+0xc0/0x140 fs/kernfs/dir.c:1847 kernfs_remove_by_name include/linux/kernfs.h:653 [inline] remove_files fs/sysfs/group.c:28 [inline] sysfs_remove_group+0x101/0x2e0 fs/sysfs/group.c:328 md_bitmap_sysfs_del drivers/md/md.c:732 [inline] md_bitmap_destroy drivers/md/md.c:6675 [inline] __md_stop+0x22a/0x3a0 drivers/md/md.c:7129 do_md_stop+0x2e2/0x1120 drivers/md/md.c:7233 array_state_store+0x82d/0xec0 drivers/md/md.c:4739 md_attr_store+0x3b7/0x640 drivers/md/md.c:6188 kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:580 [inline] vfs_write+0x612/0xba0 fs/read_write.c:672 ksys_write+0x150/0x270 fs/read_write.c:1021 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: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mddev->reconfig_mutex); lock(kn->active#64); lock(&mddev->reconfig_mutex); lock(kn->active#64); *** DEADLOCK *** locks held by syz.3.937/7948: 5, on CPU#1: #0: ffff888035ab4478 (sb_writers#7){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2769 [inline] #0: ffff888035ab4478 (sb_writers#7){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:668 #1: ffff88807e7c9d08 (&of->prealloc_mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x147/0x540 fs/kernfs/file.c:320 #2: ffff88807e7c9c80 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x1d8/0x540 fs/kernfs/file.c:336 #3: ffff8880325e3c38 (kn->active#63){.+.+}-{0:0}, at: kernfs_get_active_of fs/kernfs/file.c:73 [inline] #3: ffff8880325e3c38 (kn->active#63){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x22b/0x540 fs/kernfs/file.c:337 #4: ffff88807c73c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_lock drivers/md/md.h:713 [inline] #4: ffff88807c73c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: array_state_store+0x4d0/0xec0 drivers/md/md.c:4731 stack backtrace: CPU: 1 UID: 0 PID: 7948 Comm: syz.3.937 Not tainted syzkaller #0 PREEMPT(full) 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 kernfs_drain+0x293/0x640 fs/kernfs/dir.c:534 __kernfs_remove+0x493/0x910 fs/kernfs/dir.c:1629 kernfs_remove_by_name_ns+0xc0/0x140 fs/kernfs/dir.c:1847 kernfs_remove_by_name include/linux/kernfs.h:653 [inline] remove_files fs/sysfs/group.c:28 [inline] sysfs_remove_group+0x101/0x2e0 fs/sysfs/group.c:328 md_bitmap_sysfs_del drivers/md/md.c:732 [inline] md_bitmap_destroy drivers/md/md.c:6675 [inline] __md_stop+0x22a/0x3a0 drivers/md/md.c:7129 do_md_stop+0x2e2/0x1120 drivers/md/md.c:7233 array_state_store+0x82d/0xec0 drivers/md/md.c:4739 md_attr_store+0x3b7/0x640 drivers/md/md.c:6188 kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:580 [inline] vfs_write+0x612/0xba0 fs/read_write.c:672 ksys_write+0x150/0x270 fs/read_write.c:1021 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:0x00007f22713a9559 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:00007ffe0b1b0938 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f2271625fa0 RCX: 00007f22713a9559 RDX: 0000000000000009 RSI: 0000200000000580 RDI: 0000000000000008 RBP: 00007f2271438136 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f2271625fac R14: 00007f2271625fa0 R15: 00007f2271625fa0