syzbot


possible deadlock in ext4_inline_data_truncate (4)

Status: upstream: reported on 2025/07/01 11:27
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+32ed484f0f32dcc41c43@syzkaller.appspotmail.com
First crash: 9d21h, last: 4d18h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] possible deadlock in ext4_inline_data_truncate (4) 0 (1) 2025/07/01 11:27
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ext4_inline_data_truncate (3) ext4 3 174d 200d 0/29 auto-obsoleted due to no activity on 2025/04/23 23:26
upstream possible deadlock in ext4_inline_data_truncate (2) ext4 3 375d 399d 0/29 auto-obsoleted due to no activity on 2024/10/04 10:20
upstream possible deadlock in ext4_inline_data_truncate ext4 1 841d 837d 0/29 auto-obsoleted due to no activity on 2023/07/17 03:13
linux-5.15 possible deadlock in ext4_inline_data_truncate 1 10d 10d 0/3 upstream: reported on 2025/06/26 19:05

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.16.0-rc4-syzkaller-00013-g66701750d556 #0 Not tainted
------------------------------------------------------
syz-executor/10578 is trying to acquire lock:
ffff88804e7fd6d8 (&ei->xattr_sem){++++}-{4:4}, at: ext4_write_lock_xattr fs/ext4/xattr.h:157 [inline]
ffff88804e7fd6d8 (&ei->xattr_sem){++++}-{4:4}, at: ext4_inline_data_truncate+0x1a9/0xad0 fs/ext4/inline.c:1872

but task is already holding lock:
ffff88802a052618 (sb_internal){++++}-{0:0}, at: percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline]
ffff88802a052618 (sb_internal){++++}-{0:0}, at: __sb_start_write include/linux/fs.h:1795 [inline]
ffff88802a052618 (sb_internal){++++}-{0:0}, at: sb_start_intwrite include/linux/fs.h:1978 [inline]
ffff88802a052618 (sb_internal){++++}-{0:0}, at: ext4_evict_inode+0x2d6/0xee0 fs/ext4/inode.c:215

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #5 (sb_internal){++++}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       percpu_down_write+0x54/0x330 kernel/locking/percpu-rwsem.c:232
       sb_wait_write fs/super.c:1900 [inline]
       freeze_super+0x8b7/0x1130 fs/super.c:2183
       fs_bdev_freeze+0x1a3/0x310 fs/super.c:1529
       bdev_freeze+0xd8/0x220 block/bdev.c:298
       ext4_force_shutdown+0x322/0x560 fs/ext4/ioctl.c:822
       ext4_ioctl_shutdown fs/ext4/ioctl.c:857 [inline]
       __ext4_ioctl fs/ext4/ioctl.c:1587 [inline]
       ext4_ioctl+0x1d39/0x3510 fs/ext4/ioctl.c:1626
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:907 [inline]
       __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:893
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #4 (sb_pagefaults){++++}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       percpu_down_read_internal+0x48/0x1c0 include/linux/percpu-rwsem.h:53
       percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline]
       __sb_start_write include/linux/fs.h:1795 [inline]
       sb_start_pagefault include/linux/fs.h:1960 [inline]
       ext4_page_mkwrite+0x1e3/0x1110 fs/ext4/inode.c:6576
       do_page_mkwrite+0x14d/0x310 mm/memory.c:3378
       do_shared_fault mm/memory.c:5666 [inline]
       do_fault mm/memory.c:5728 [inline]
       do_pte_missing mm/memory.c:4251 [inline]
       handle_pte_fault mm/memory.c:6069 [inline]
       __handle_mm_fault+0x1a60/0x5620 mm/memory.c:6212
       handle_mm_fault+0x40a/0x8e0 mm/memory.c:6381
       do_user_addr_fault+0x764/0x1390 arch/x86/mm/fault.c:1387
       handle_page_fault arch/x86/mm/fault.c:1476 [inline]
       exc_page_fault+0x76/0xf0 arch/x86/mm/fault.c:1532
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

-> #3 (&mm->mmap_lock){++++}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       __might_fault+0xcc/0x130 mm/memory.c:6971
       _inline_copy_to_user include/linux/uaccess.h:192 [inline]
       _copy_to_user+0x2c/0xb0 lib/usercopy.c:26
       copy_to_user include/linux/uaccess.h:225 [inline]
       fiemap_fill_next_extent+0x1c0/0x390 fs/ioctl.c:145
       ocfs2_fiemap+0x888/0xc90 fs/ocfs2/extent_map.c:806
       ioctl_fiemap fs/ioctl.c:220 [inline]
       do_vfs_ioctl+0x16d3/0x1990 fs/ioctl.c:841
       __do_sys_ioctl fs/ioctl.c:905 [inline]
       __se_sys_ioctl+0x82/0x170 fs/ioctl.c:893
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&ocfs2_quota_ip_alloc_sem_key){++++}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1577
       ocfs2_create_local_dquot+0x19d/0x1a40 fs/ocfs2/quota_local.c:1227
       ocfs2_acquire_dquot+0x80f/0xb30 fs/ocfs2/quota_global.c:883
       dqget+0x7b1/0xf10 fs/quota/dquot.c:977
       ocfs2_setattr+0xd72/0x1b40 fs/ocfs2/file.c:1233
       notify_change+0xb36/0xe40 fs/attr.c:552
       chown_common+0x40c/0x5c0 fs/open.c:790
       vfs_fchown fs/open.c:858 [inline]
       ksys_fchown+0xea/0x160 fs/open.c:870
       __do_sys_fchown fs/open.c:875 [inline]
       __se_sys_fchown fs/open.c:873 [inline]
       __x64_sys_fchown+0x7a/0x90 fs/open.c:873
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&dquot->dq_lock){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       __mutex_lock_common kernel/locking/mutex.c:602 [inline]
       __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:747
       wait_on_dquot fs/quota/dquot.c:354 [inline]
       dqget+0x72a/0xf10 fs/quota/dquot.c:972
       dquot_transfer+0x2f8/0x6d0 fs/quota/dquot.c:2140
       ext4_setattr+0x865/0x1bc0 fs/ext4/inode.c:5817
       notify_change+0xb36/0xe40 fs/attr.c:552
       chown_common+0x40c/0x5c0 fs/open.c:790
       do_fchownat+0x161/0x270 fs/open.c:821
       __do_sys_lchown fs/open.c:846 [inline]
       __se_sys_lchown fs/open.c:844 [inline]
       __x64_sys_lchown+0x85/0xa0 fs/open.c:844
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ei->xattr_sem){++++}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3168 [inline]
       check_prevs_add kernel/locking/lockdep.c:3287 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1577
       ext4_write_lock_xattr fs/ext4/xattr.h:157 [inline]
       ext4_inline_data_truncate+0x1a9/0xad0 fs/ext4/inline.c:1872
       ext4_truncate+0x3b5/0x1100 fs/ext4/inode.c:4528
       ext4_evict_inode+0x8cf/0xee0 fs/ext4/inode.c:261
       evict+0x504/0x9c0 fs/inode.c:810
       d_delete_notify include/linux/fsnotify.h:402 [inline]
       vfs_rmdir+0x3ec/0x520 fs/namei.c:4483
       do_rmdir+0x2ac/0x630 fs/namei.c:4525
       __do_sys_unlinkat fs/namei.c:4699 [inline]
       __se_sys_unlinkat fs/namei.c:4693 [inline]
       __x64_sys_unlinkat+0xc2/0xf0 fs/namei.c:4693
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &ei->xattr_sem --> sb_pagefaults --> sb_internal

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_internal);
                               lock(sb_pagefaults);
                               lock(sb_internal);
  lock(&ei->xattr_sem);

 *** DEADLOCK ***

3 locks held by syz-executor/10578:
 #0: ffff88802a052428 (sb_writers#4){++++}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:557
 #1: ffff88804e41bd40 (&type->i_mutex_dir_key#3/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:914 [inline]
 #1: ffff88804e41bd40 (&type->i_mutex_dir_key#3/1){+.+.}-{4:4}, at: do_rmdir+0x1b2/0x630 fs/namei.c:4517
 #2: ffff88802a052618 (sb_internal){++++}-{0:0}, at: percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline]
 #2: ffff88802a052618 (sb_internal){++++}-{0:0}, at: __sb_start_write include/linux/fs.h:1795 [inline]
 #2: ffff88802a052618 (sb_internal){++++}-{0:0}, at: sb_start_intwrite include/linux/fs.h:1978 [inline]
 #2: ffff88802a052618 (sb_internal){++++}-{0:0}, at: ext4_evict_inode+0x2d6/0xee0 fs/ext4/inode.c:215

stack backtrace:
CPU: 0 UID: 0 PID: 10578 Comm: syz-executor Not tainted 6.16.0-rc4-syzkaller-00013-g66701750d556 #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2046
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3168 [inline]
 check_prevs_add kernel/locking/lockdep.c:3287 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1577
 ext4_write_lock_xattr fs/ext4/xattr.h:157 [inline]
 ext4_inline_data_truncate+0x1a9/0xad0 fs/ext4/inline.c:1872
 ext4_truncate+0x3b5/0x1100 fs/ext4/inode.c:4528
 ext4_evict_inode+0x8cf/0xee0 fs/ext4/inode.c:261
 evict+0x504/0x9c0 fs/inode.c:810
 d_delete_notify include/linux/fsnotify.h:402 [inline]
 vfs_rmdir+0x3ec/0x520 fs/namei.c:4483
 do_rmdir+0x2ac/0x630 fs/namei.c:4525
 __do_sys_unlinkat fs/namei.c:4699 [inline]
 __se_sys_unlinkat fs/namei.c:4693 [inline]
 __x64_sys_unlinkat+0xc2/0xf0 fs/namei.c:4693
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdbbc18df07
Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 07 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc2bafec38 EFLAGS: 00000207 ORIG_RAX: 0000000000000107
RAX: ffffffffffffffda RBX: 0000000000000065 RCX: 00007fdbbc18df07
RDX: 0000000000000200 RSI: 00007ffc2baffde0 RDI: 00000000ffffff9c
RBP: 00007fdbbc210925 R08: 0000555592b2166b R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000207 R12: 00007ffc2baffde0
R13: 00007fdbbc210925 R14: 000000000007dbb3 R15: 00007ffc2bb01fa0
 </TASK>
EXT4-fs (loop8): unmounting filesystem 00000000-0000-0000-0000-000000000000.

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/02 13:43 upstream 66701750d556 0cd59a8f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ext4_inline_data_truncate
2025/06/27 11:23 linux-next 2aeda9592360 803ce19b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ext4_inline_data_truncate
* Struck through repros no longer work on HEAD.