syzbot
possible deadlock in blkdev_put
Status:
upstream: reported on 2026/09/13 04:41
Reported-by: syzbot+8c43b66a9902a069438e@syzkaller.appspotmail.com
First crash: 7d19h, last: 7d19h
Sample crash report:
(syz.4.14,4315,0):__ocfs2_flush_truncate_log:6055 ERROR: status = -30
(syz.4.14,4315,1):ocfs2_try_to_free_truncate_log:6135 ERROR: status = -30
(syz.4.14,4315,1):ocfs2_write_begin_nolock:1878 ERROR: status = -30
(syz.4.14,4315,1):ocfs2_dio_end_io:2448 ERROR: Direct IO failed, bytes = -5
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.4.14/4315 is trying to acquire lock:
ffff888020999118 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0xf1/0x780 block/bdev.c:911
but task is already holding lock:
ffff88807c774990 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x12d5/0x1560 fs/jbd2/transaction.c:462
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #7 (jbd2_handle){++++}-{0:0}:
wait_transaction_locked+0x1bb/0x270 fs/jbd2/transaction.c:178
add_transaction_credits+0x104/0xcb0 fs/jbd2/transaction.c:242
start_this_handle+0x723/0x1560 fs/jbd2/transaction.c:423
jbd2__journal_start+0x2b7/0x5a0 fs/jbd2/transaction.c:521
jbd2_journal_start+0x26/0x30 fs/jbd2/transaction.c:560
ocfs2_start_trans+0x3b2/0x6f0 fs/ocfs2/journal.c:376
ocfs2_del_inode_from_orphan+0x169/0x7b0 fs/ocfs2/namei.c:2722
ocfs2_dio_end_io_write fs/ocfs2/aops.c:2416 [inline]
ocfs2_dio_end_io+0x10ed/0x1400 fs/ocfs2/aops.c:2451
dio_complete+0x255/0x700 fs/direct-io.c:272
do_blockdev_direct_IO fs/direct-io.c:1336 [inline]
__blockdev_direct_IO+0x2eb0/0x3b20 fs/direct-io.c:1368
ocfs2_direct_IO+0x233/0x2a0 fs/ocfs2/aops.c:2488
generic_file_direct_write+0x222/0x470 mm/filemap.c:3687
__generic_file_write_iter+0x2b2/0x4e0 mm/filemap.c:3869
ocfs2_file_write_iter+0x171a/0x1ee0 fs/ocfs2/file.c:2472
do_iter_readv_writev+0x47d/0x5f0 fs/read_write.c:-1
do_iter_write+0x1f8/0x7a0 fs/read_write.c:855
iter_file_splice_write+0x6be/0xcf0 fs/splice.c:689
do_splice_from fs/splice.c:767 [inline]
direct_splice_actor+0xe1/0x130 fs/splice.c:956
splice_direct_to_actor+0x4e8/0xc00 fs/splice.c:902
do_splice_direct+0x1d4/0x2f0 fs/splice.c:1008
do_sendfile+0x524/0xe30 fs/read_write.c:1249
__do_sys_sendfile64 fs/read_write.c:1317 [inline]
__se_sys_sendfile64+0x141/0x1a0 fs/read_write.c:1303
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #6 (&journal->j_trans_barrier){.+.+}-{3:3}:
down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
ocfs2_start_trans+0x3a6/0x6f0 fs/ocfs2/journal.c:374
ocfs2_mknod+0xf70/0x2510 fs/ocfs2/namei.c:361
ocfs2_create+0x192/0x420 fs/ocfs2/namei.c:674
lookup_open fs/namei.c:3513 [inline]
open_last_lookups fs/namei.c:3583 [inline]
path_openat+0x120a/0x2fb0 fs/namei.c:3790
do_filp_open+0x1df/0x400 fs/namei.c:3820
do_sys_openat2+0x14b/0x500 fs/open.c:1255
do_sys_open fs/open.c:1271 [inline]
__do_sys_openat fs/open.c:1287 [inline]
__se_sys_openat fs/open.c:1282 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1282
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #5 (sb_internal#4){.+.+}-{0:0}:
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
__sb_start_write include/linux/fs.h:1817 [inline]
sb_start_intwrite include/linux/fs.h:1934 [inline]
ocfs2_start_trans+0x2a7/0x6f0 fs/ocfs2/journal.c:372
ocfs2_update_inode_atime+0xed/0x580 fs/ocfs2/file.c:257
ocfs2_inode_lock_atime+0x338/0x530 fs/ocfs2/dlmglue.c:2606
ocfs2_mmap+0xe4/0x250 fs/ocfs2/mmap.c:165
call_mmap include/linux/fs.h:2184 [inline]
mmap_file+0x5d/0xb0 mm/util.c:1092
__mmap_region mm/mmap.c:1796 [inline]
mmap_region+0x1048/0x1730 mm/mmap.c:2933
do_mmap+0x801/0xe30 mm/mmap.c:1586
vm_mmap_pgoff+0x1c1/0x2d0 mm/util.c:551
ksys_mmap_pgoff+0x4e2/0x790 mm/mmap.c:1635
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #4 (&mm->mmap_lock){++++}-{3:3}
:
down_write+0x38/0x60 kernel/locking/rwsem.c:1551
mmap_write_lock include/linux/mmap_lock.h:71 [inline]
mpol_rebind_mm+0x33/0x2c0 mm/mempolicy.c:381
cpuset_attach+0x333/0x610 kernel/cgroup/cpuset.c:2381
cgroup_migrate_execute+0x7ee/0xff0 kernel/cgroup/cgroup.c:2598
cgroup_attach_task+0x593/0x830 kernel/cgroup/cgroup.c:2893
__cgroup1_procs_write+0x2ea/0x3f0 kernel/cgroup/cgroup-v1.c:527
cgroup_file_write+0x2c4/0x670 kernel/cgroup/cgroup.c:3967
kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296
call_write_iter include/linux/fs.h:2179 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x748/0xd70 fs/read_write.c:594
ksys_write+0x153/0x260 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #3 (cpuset_mutex){+.+.}-{3:3}:
__mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
cpuset_write_u64+0x52/0x210 kernel/cgroup/cpuset.c:2443
cgroup_file_write+0x564/0x670 kernel/cgroup/cgroup.c:3983
kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296
call_write_iter include/linux/fs.h:2179 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x748/0xd70 fs/read_write.c:594
ksys_write+0x153/0x260 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #2 (cpu_hotplug_lock){++++}-{0:0}:
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
cpus_read_lock+0x40/0x150 kernel/cpu.c:309
alloc_and_link_pwqs kernel/workqueue.c:4249 [inline]
alloc_workqueue+0xe27/0x1450 kernel/workqueue.c:4365
loop_configure+0x5bc/0x1480 drivers/block/loop.c:1260
lo_ioctl+0x2e1/0x20e0 drivers/block/loop.c:1853
blkdev_ioctl+0x347/0x6f0 block/ioctl.c:604
block_ioctl+0xac/0xf0 block/fops.c:496
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #1 (&lo->lo_mutex){+.+.}-{3:3}:
__mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_killable_nested+0x17/0x20 kernel/locking/mutex.c:758
lo_open+0x6a/0x100 drivers/block/loop.c:2056
blkdev_get_whole+0x90/0x390 block/bdev.c:665
blkdev_get_by_dev+0x2da/0xa50 block/bdev.c:823
blkdev_open+0x128/0x2c0 block/fops.c:466
do_dentry_open+0x7f7/0xf90 fs/open.c:826
do_open fs/namei.c:3659 [inline]
path_openat+0x2718/0x2fb0 fs/namei.c:3793
do_filp_open+0x1df/0x400 fs/namei.c:3820
do_sys_openat2+0x14b/0x500 fs/open.c:1255
do_sys_open fs/open.c:1271 [inline]
__do_sys_openat fs/open.c:1287 [inline]
__se_sys_openat fs/open.c:1282 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1282
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #0 (&disk->open_mutex){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012
lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
blkdev_put+0xf1/0x780 block/bdev.c:911
blkdev_close+0x76/0xa0 block/fops.c:478
__fput+0x212/0x8c0 fs/file_table.c:311
task_work_run+0x125/0x1a0 kernel/task_work.c:188
get_signal+0x123e/0x12e0 kernel/signal.c:2681
arch_do_signal_or_restart+0xe6/0x12a0 arch/x86/kernel/signal.c:867
handle_signal_work kernel/entry/common.c:154 [inline]
exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
other info that might help us debug this:
Chain exists of:
&disk->open_mutex --> &journal->j_trans_barrier --> jbd2_handle
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(jbd2_handle);
lock(&journal->j_trans_barrier);
lock(jbd2_handle);
lock(&disk->open_mutex);
*** DEADLOCK ***
3 locks held by syz.4.14/4315:
#0: ffff888079988650 (sb_internal#4){.+.+}-{0:0}, at: ocfs2_replay_truncate_records fs/ocfs2/alloc.c:5938 [inline]
#0: ffff888079988650 (sb_internal#4){.+.+}-{0:0}, at: __ocfs2_flush_truncate_log+0x49f/0x1110 fs/ocfs2/alloc.c:6052
#1: ffff888027f87ce8 (&journal->j_trans_barrier){.+.+}-{3:3}, at: ocfs2_start_trans+0x3a6/0x6f0 fs/ocfs2/journal.c:374
#2: ffff88807c774990 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x12d5/0x1560 fs/jbd2/transaction.c:462
stack backtrace:
CPU: 1 PID: 4315 Comm: syz.4.14 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/08/2026
Call Trace:
<TASK>
dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012
lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
blkdev_put+0xf1/0x780 block/bdev.c:911
blkdev_close+0x76/0xa0 block/fops.c:478
__fput+0x212/0x8c0 fs/file_table.c:311
task_work_run+0x125/0x1a0 kernel/task_work.c:188
get_signal+0x123e/0x12e0 kernel/signal.c:2681
arch_do_signal_or_restart+0xe6/0x12a0 arch/x86/kernel/signal.c:867
handle_signal_work kernel/entry/common.c:154 [inline]
exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f0d72ba5159
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:00007f0d70dfd028 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: 0000000000510000 RBX: 00007f0d72e2cfa0 RCX: 00007f0d72ba5159
RDX: 0000000000000000 RSI: 000000000000000a RDI: 0000000000000004
RBP: 00007f0d72c3c03b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000fffe82 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f0d72e2d038 R14: 00007f0d72e2cfa0 R15: 00007ffe905c2288
</TASK>
syz.4.14 (4315) used greatest stack depth: 19488 bytes left
* Struck through repros no longer work on HEAD.