possible deadlock in ext4_map_blocks

Status: upstream: reported on 2026/08/19 19:36
Reported-by: syzbot+93dedfad80ba9d409623@syzkaller.appspotmail.com
First crash: 3d17h, last: 3d17h
Similar bugs (6)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ext4_map_blocks (2) ext4 4 14 583d 627d 0/29 closed as dup on 2024/12/12 23:41
linux-6.1 possible deadlock in ext4_map_blocks origin:lts-only 4 syz, C inconclusive 747 5d05h 1264d 0/3 upstream: reported C repro on 2023/03/08 04:51
linux-4.19 possible deadlock in ext4_map_blocks ext4 4 11 1273d 1410d 0/1 upstream: reported on 2022/10/12 20:37
upstream possible deadlock in ext4_map_blocks ext4 4 480 1197d 1418d 0/29 auto-obsoleted due to no activity on 2023/08/11 20:48
upstream possible deadlock in ext4_map_blocks (3) prio:low ext4 4 1 100d 96d 0/29 auto-obsoleted due to no activity on 2026/08/23 05:50
linux-5.15 possible deadlock in ext4_map_blocks origin:lts-only 4 syz, C done 664 5d21h 1260d 0/3 upstream: reported C repro on 2023/03/11 16:28

Sample crash report:
EXT4-fs (loop9): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: writeback.
ext4 filesystem being mounted at /202/file0 supports timestamps until 2038-01-19 (0x7fffffff)
============================================
WARNING: possible recursive locking detected
syzkaller #0 Not tainted
--------------------------------------------
syz.9.2380/13900 is trying to acquire lock:
ffff88805baa5c88 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_map_blocks+0x918/0x1a90 fs/ext4/inode.c:647

but task is already holding lock:
ffff88805baa0288 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x98d/0x1140 fs/ext4/inode.c:4274

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&ei->i_data_sem/2);
  lock(&ei->i_data_sem/2);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

7 locks held by syz.9.2380/13900:
 #0: ffff888024f88418 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412
 #1: ffff88805baa0410 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
 #1: ffff88805baa0410 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: do_truncate+0x19c/0x240 fs/open.c:64
 #2: ffff88805baa05a0 (mapping.invalidate_lock#2){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:849 [inline]
 #2: ffff88805baa05a0 (mapping.invalidate_lock#2){++++}-{3:3}, at: ext4_setattr+0x1102/0x1f10 fs/ext4/inode.c:5567
 #3: ffff88805baa0288 (&ei->i_data_sem/2){++++}-{3:3}, at: ext4_truncate+0x98d/0x1140 fs/ext4/inode.c:4274
 #4: ffffffff8d287a50 (dquot_srcu){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:116 [inline]
 #4: ffffffff8d287a50 (dquot_srcu){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:215 [inline]
 #4: ffffffff8d287a50 (dquot_srcu){.+.+}-{0:0}, at: __dquot_free_space+0x187/0xbe0 fs/quota/dquot.c:1938
 #5: ffff88805f9fcce8 (&dquot->dq_lock){+.+.}-{3:3}, at: dquot_commit+0x5e/0x440 fs/quota/dquot.c:534
 #6: ffff888024f88210 (&s->s_dquot.dqio_sem){++++}-{3:3}, at: v2_write_dquot+0x8c/0x1a0 fs/quota/quota_v2.c:359

stack backtrace:
CPU: 0 PID: 13900 Comm: syz.9.2380 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
 check_deadlock kernel/locking/lockdep.c:3062 [inline]
 validate_chain kernel/locking/lockdep.c:3856 [inline]
 __lock_acquire+0x6809/0x7d80 kernel/locking/lockdep.c:5137
 lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
 down_write+0x97/0x200 kernel/locking/rwsem.c:1573
 ext4_map_blocks+0x918/0x1a90 fs/ext4/inode.c:647
 ext4_getblk+0x1c9/0x720 fs/ext4/inode.c:864
 ext4_bread+0x2a/0x170 fs/ext4/inode.c:920
 ext4_quota_write+0x23b/0x580 fs/ext4/super.c:7317
 qtree_write_dquot+0x250/0x5d0 fs/quota/quota_tree.c:462
 v2_write_dquot+0x10c/0x1a0 fs/quota/quota_v2.c:361
 dquot_commit+0x361/0x440 fs/quota/dquot.c:541
 ext4_write_dquot+0x207/0x370 fs/ext4/super.c:6929
 mark_dquot_dirty fs/quota/dquot.c:399 [inline]
 mark_all_dquot_dirty+0x1e3/0x400 fs/quota/dquot.c:439
 __dquot_free_space+0x80d/0xbe0 fs/quota/dquot.c:1965
 dquot_free_space_nodirty include/linux/quotaops.h:372 [inline]
 dquot_free_space include/linux/quotaops.h:377 [inline]
 dquot_free_block include/linux/quotaops.h:388 [inline]
 ext4_mb_clear_bb fs/ext4/mballoc.c:6628 [inline]
 ext4_free_blocks+0x1b65/0x24e0 fs/ext4/mballoc.c:6757
 ext4_remove_blocks fs/ext4/extents.c:2536 [inline]
 ext4_ext_rm_leaf fs/ext4/extents.c:2719 [inline]
 ext4_ext_remove_space+0x21e4/0x4240 fs/ext4/extents.c:2967
 ext4_ext_truncate+0x17d/0x2d0 fs/ext4/extents.c:4544
 ext4_truncate+0xa36/0x1140 fs/ext4/inode.c:4279
 ext4_setattr+0x1298/0x1f10 fs/ext4/inode.c:5656
 notify_change+0xb05/0xde0 fs/attr.c:499
 do_truncate+0x1b0/0x240 fs/open.c:66
 handle_truncate fs/namei.c:3342 [inline]
 do_open fs/namei.c:3687 [inline]
 path_openat+0x2a7e/0x3270 fs/namei.c:3844
 do_filp_open+0x1f2/0x430 fs/namei.c:3871
 do_sys_openat2+0x134/0x1d0 fs/open.c:1422
 do_sys_open fs/open.c:1437 [inline]
 __do_sys_openat fs/open.c:1453 [inline]
 __se_sys_openat fs/open.c:1448 [inline]
 __x64_sys_openat+0x139/0x160 fs/open.c:1448
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f9f5119e0d9
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:00007f9f4f3f6028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f9f51425fa0 RCX: 00007f9f5119e0d9
RDX: 000000000014b302 RSI: 0000200000000180 RDI: ffffffffffffff9c
RBP: 00007f9f51235024 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000008c R11: 0000000000000246 R12: 0000000000000000
R13: 00007f9f51426038 R14: 00007f9f51425fa0 R15: 00007ffc4dffbe68
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/19 19:35 linux-6.6.y c610b395b0a5 1e72964b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ext4_map_blocks
* Struck through repros no longer work on HEAD.