syzbot


possible deadlock in ocfs2_evict_inode

Status: upstream: reported on 2025/03/13 00:58
Reported-by: syzbot+36dbcd0899bcc5fe5a5e@syzkaller.appspotmail.com
First crash: 66d, last: 66d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ocfs2_evict_inode ocfs2 362 3h16m 272d 0/28 upstream: reported on 2024/08/18 23:22

Sample crash report:
Quota error (device loop4): qtree_read_dquot: Can't read quota structure for id 0
(syz-executor,4033,1):ocfs2_acquire_dquot:873 ERROR: status = -5
======================================================
WARNING: possible circular locking dependency detected
5.15.178-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor/4033 is trying to acquire lock:
ffff0000d85f3488 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
ffff0000d85f3488 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: ocfs2_remove_inode fs/ocfs2/inode.c:655 [inline]
ffff0000d85f3488 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: ocfs2_wipe_inode fs/ocfs2/inode.c:818 [inline]
ffff0000d85f3488 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: ocfs2_delete_inode fs/ocfs2/inode.c:1079 [inline]
ffff0000d85f3488 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: ocfs2_evict_inode+0x1e18/0x45ec fs/ocfs2/inode.c:1216

but task is already holding lock:
ffff0000d85f5108 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
ffff0000d85f5108 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: ocfs2_wipe_inode fs/ocfs2/inode.c:776 [inline]
ffff0000d85f5108 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: ocfs2_delete_inode fs/ocfs2/inode.c:1079 [inline]
ffff0000d85f5108 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: ocfs2_evict_inode+0x2cec/0x45ec fs/ocfs2/inode.c:1216

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}:
       down_write+0xbc/0x12c kernel/locking/rwsem.c:1551
       inode_lock include/linux/fs.h:789 [inline]
       ocfs2_del_inode_from_orphan+0x134/0x74c fs/ocfs2/namei.c:2713
       ocfs2_dio_end_io_write fs/ocfs2/aops.c:2333 [inline]
       ocfs2_dio_end_io+0x49c/0x10cc fs/ocfs2/aops.c:2431
       dio_complete+0x208/0x68c fs/direct-io.c:272
       do_blockdev_direct_IO fs/direct-io.c:1336 [inline]
       __blockdev_direct_IO+0x30e4/0x3824 fs/direct-io.c:1368
       ocfs2_direct_IO+0x208/0x280 fs/ocfs2/aops.c:2468
       generic_file_direct_write+0x234/0x538 mm/filemap.c:3687
       __generic_file_write_iter+0x280/0x454 mm/filemap.c:3869
       ocfs2_file_write_iter+0x1540/0x1e60 fs/ocfs2/file.c:2472
       call_write_iter include/linux/fs.h:2174 [inline]
       aio_write+0x604/0x8dc fs/aio.c:1594
       io_submit_one+0x878/0x161c fs/aio.c:2013
       __do_sys_io_submit fs/aio.c:2072 [inline]
       __se_sys_io_submit fs/aio.c:2042 [inline]
       __arm64_sys_io_submit+0x26c/0x3ec fs/aio.c:2042
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
       do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
       el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
       el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
       el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #3 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}:
       down_write+0xbc/0x12c kernel/locking/rwsem.c:1551
       ocfs2_lock_global_qf+0x1d4/0x260 fs/ocfs2/quota_global.c:314
       ocfs2_acquire_dquot+0x258/0xa90 fs/ocfs2/quota_global.c:811
       dqget+0x664/0xd0c fs/quota/dquot.c:988
       __dquot_initialize+0x344/0xc04 fs/quota/dquot.c:1517
       dquot_initialize+0x24/0x34 fs/quota/dquot.c:1579
       ocfs2_get_init_inode+0x14c/0x1c0 fs/ocfs2/namei.c:202
       ocfs2_mknod+0x89c/0x24f8 fs/ocfs2/namei.c:310
       ocfs2_create+0x184/0x4c8 fs/ocfs2/namei.c:674
       lookup_open fs/namei.c:3462 [inline]
       open_last_lookups fs/namei.c:3532 [inline]
       path_openat+0xf18/0x26cc fs/namei.c:3739
       do_filp_open+0x1a8/0x3b4 fs/namei.c:3769
       do_sys_openat2+0x128/0x3e0 fs/open.c:1253
       do_sys_open fs/open.c:1269 [inline]
       __do_sys_openat fs/open.c:1285 [inline]
       __se_sys_openat fs/open.c:1280 [inline]
       __arm64_sys_openat+0x1f0/0x240 fs/open.c:1280
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
       do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
       el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
       el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
       el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #2 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}:
       down_write+0xbc/0x12c kernel/locking/rwsem.c:1551
       inode_lock include/linux/fs.h:789 [inline]
       ocfs2_lock_global_qf+0x1b8/0x260 fs/ocfs2/quota_global.c:313
       ocfs2_acquire_dquot+0x258/0xa90 fs/ocfs2/quota_global.c:811
       dqget+0x664/0xd0c fs/quota/dquot.c:988
       __dquot_initialize+0x344/0xc04 fs/quota/dquot.c:1517
       dquot_initialize+0x24/0x34 fs/quota/dquot.c:1579
       ocfs2_get_init_inode+0x14c/0x1c0 fs/ocfs2/namei.c:202
       ocfs2_mknod+0x89c/0x24f8 fs/ocfs2/namei.c:310
       ocfs2_create+0x184/0x4c8 fs/ocfs2/namei.c:674
       lookup_open fs/namei.c:3462 [inline]
       open_last_lookups fs/namei.c:3532 [inline]
       path_openat+0xf18/0x26cc fs/namei.c:3739
       do_filp_open+0x1a8/0x3b4 fs/namei.c:3769
       do_sys_openat2+0x128/0x3e0 fs/open.c:1253
       do_sys_open fs/open.c:1269 [inline]
       __do_sys_openat fs/open.c:1285 [inline]
       __se_sys_openat fs/open.c:1280 [inline]
       __arm64_sys_openat+0x1f0/0x240 fs/open.c:1280
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
       do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
       el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
       el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
       el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #1 (&dquot->dq_lock){+.+.}-{3:3}:
       __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743
       wait_on_dquot fs/quota/dquot.c:356 [inline]
       dqget+0x5f4/0xd0c fs/quota/dquot.c:983
       __dquot_initialize+0x344/0xc04 fs/quota/dquot.c:1517
       dquot_initialize+0x24/0x34 fs/quota/dquot.c:1579
       ocfs2_get_init_inode+0x14c/0x1c0 fs/ocfs2/namei.c:202
       ocfs2_mknod+0x89c/0x24f8 fs/ocfs2/namei.c:310
       ocfs2_create+0x184/0x4c8 fs/ocfs2/namei.c:674
       lookup_open fs/namei.c:3462 [inline]
       open_last_lookups fs/namei.c:3532 [inline]
       path_openat+0xf18/0x26cc fs/namei.c:3739
       do_filp_open+0x1a8/0x3b4 fs/namei.c:3769
       do_sys_openat2+0x128/0x3e0 fs/open.c:1253
       do_sys_open fs/open.c:1269 [inline]
       __do_sys_openat fs/open.c:1285 [inline]
       __se_sys_openat fs/open.c:1280 [inline]
       __arm64_sys_openat+0x1f0/0x240 fs/open.c:1280
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
       do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
       el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
       el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
       el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #0 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{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+0x32d4/0x7638 kernel/locking/lockdep.c:5012
       lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623
       down_write+0xbc/0x12c kernel/locking/rwsem.c:1551
       inode_lock include/linux/fs.h:789 [inline]
       ocfs2_remove_inode fs/ocfs2/inode.c:655 [inline]
       ocfs2_wipe_inode fs/ocfs2/inode.c:818 [inline]
       ocfs2_delete_inode fs/ocfs2/inode.c:1079 [inline]
       ocfs2_evict_inode+0x1e18/0x45ec fs/ocfs2/inode.c:1216
       evict+0x418/0x894 fs/inode.c:622
       iput_final fs/inode.c:1744 [inline]
       iput+0x744/0x824 fs/inode.c:1770
       d_delete_notify include/linux/fsnotify.h:267 [inline]
       vfs_rmdir+0x2f8/0x3f0 fs/namei.c:4162
       do_rmdir+0x2e8/0x84c fs/namei.c:4210
       __do_sys_unlinkat fs/namei.c:4390 [inline]
       __se_sys_unlinkat fs/namei.c:4384 [inline]
       __arm64_sys_unlinkat+0xe0/0xfc fs/namei.c:4384
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
       do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
       el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
       el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
       el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

other info that might help us debug this:

Chain exists of:
  &ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2 --> &ocfs2_quota_ip_alloc_sem_key --> &ocfs2_sysfile_lock_key[args->fi_sysfile_type]

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]);
                               lock(&ocfs2_quota_ip_alloc_sem_key);
                               lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]);
  lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2);

 *** DEADLOCK ***

4 locks held by syz-executor/4033:
 #0: ffff0000d801c460 (sb_writers#15){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:377
 #1: ffff0000dbf7a648 (&type->i_mutex_dir_key#9/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:824 [inline]
 #1: ffff0000dbf7a648 (&type->i_mutex_dir_key#9/1){+.+.}-{3:3}, at: do_rmdir+0x1e0/0x84c fs/namei.c:4197
 #2: ffff0000f5324ab0 (&osb->nfs_sync_rwlock){.+.+}-{3:3}, at: ocfs2_nfs_sync_lock+0x100/0x31c fs/ocfs2/dlmglue.c:2874
 #3: ffff0000d85f5108 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
 #3: ffff0000d85f5108 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: ocfs2_wipe_inode fs/ocfs2/inode.c:776 [inline]
 #3: ffff0000d85f5108 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: ocfs2_delete_inode fs/ocfs2/inode.c:1079 [inline]
 #3: ffff0000d85f5108 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}, at: ocfs2_evict_inode+0x2cec/0x45ec fs/ocfs2/inode.c:1216

stack backtrace:
CPU: 0 PID: 4033 Comm: syz-executor Not tainted 5.15.178-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 dump_stack+0x1c/0x58 lib/dump_stack.c:113
 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011
 check_noncircular+0x2cc/0x378 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+0x32d4/0x7638 kernel/locking/lockdep.c:5012
 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623
 down_write+0xbc/0x12c kernel/locking/rwsem.c:1551
 inode_lock include/linux/fs.h:789 [inline]
 ocfs2_remove_inode fs/ocfs2/inode.c:655 [inline]
 ocfs2_wipe_inode fs/ocfs2/inode.c:818 [inline]
 ocfs2_delete_inode fs/ocfs2/inode.c:1079 [inline]
 ocfs2_evict_inode+0x1e18/0x45ec fs/ocfs2/inode.c:1216
 evict+0x418/0x894 fs/inode.c:622
 iput_final fs/inode.c:1744 [inline]
 iput+0x744/0x824 fs/inode.c:1770
 d_delete_notify include/linux/fsnotify.h:267 [inline]
 vfs_rmdir+0x2f8/0x3f0 fs/namei.c:4162
 do_rmdir+0x2e8/0x84c fs/namei.c:4210
 __do_sys_unlinkat fs/namei.c:4390 [inline]
 __se_sys_unlinkat fs/namei.c:4384 [inline]
 __arm64_sys_unlinkat+0xe0/0xfc fs/namei.c:4384
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
ocfs2: Unmounting device (7,4) on (node local)

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/13 00:57 linux-5.15.y c16c81c81336 1a5d9317 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ocfs2_evict_inode
* Struck through repros no longer work on HEAD.