syzbot


possible deadlock in freeze_super (3)

Status: upstream: reported on 2025/04/30 22:14
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+ddfdaf196c473805d049@syzkaller.appspotmail.com
First crash: 66d, last: 3d19h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] possible deadlock in freeze_super (3) 0 (1) 2025/04/30 22:14
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in freeze_super (2) gfs2 C error done 15 779d 995d 22/29 fixed on 2023/06/08 14:41
linux-5.15 possible deadlock in freeze_super 1 325d 325d 0/3 auto-obsoleted due to no activity on 2024/11/18 15:18
upstream possible deadlock in freeze_super gfs2 938 1550d 1682d 0/29 auto-closed as invalid on 2021/07/02 04:50
linux-5.15 possible deadlock in freeze_super (2) origin:lts-only C error 10 37d 208d 0/3 upstream: reported C repro on 2024/12/05 16:25

Sample crash report:
EXT4-fs (loop5): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: writeback.
EXT4-fs (loop5): shut down requested (0)
======================================================
WARNING: possible circular locking dependency detected
6.16.0-rc3-syzkaller-00190-g67a993863163 #0 Not tainted
------------------------------------------------------
syz.5.353/9178 is trying to acquire lock:
ffff88802f9ea618 (sb_internal){++++}-{0:0}, at: sb_wait_write fs/super.c:1900 [inline]
ffff88802f9ea618 (sb_internal){++++}-{0:0}, at: freeze_super+0x8b7/0x1130 fs/super.c:2183

but task is already holding lock:
ffff88802f9ea520 (sb_pagefaults){++++}-{0:0}, at: sb_wait_write fs/super.c:1900 [inline]
ffff88802f9ea520 (sb_pagefaults){++++}-{0:0}, at: freeze_super+0x50a/0x1130 fs/super.c:2169

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #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+0x14a/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+0x2d5/0x7f0 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
       __dquot_initialize+0x3b3/0xcb0 fs/quota/dquot.c:1505
       ocfs2_get_init_inode+0x13b/0x1b0 fs/ocfs2/namei.c:202
       ocfs2_mknod+0x863/0x2050 fs/ocfs2/namei.c:310
       ocfs2_mkdir+0x191/0x440 fs/ocfs2/namei.c:656
       vfs_mkdir+0x306/0x510 fs/namei.c:4375
       do_mkdirat+0x247/0x590 fs/namei.c:4408
       __do_sys_mkdirat fs/namei.c:4425 [inline]
       __se_sys_mkdirat fs/namei.c:4423 [inline]
       __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4423
       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
       dquot_release+0x66/0x600 fs/quota/dquot.c:531
       ext4_release_dquot+0x3ee/0x6c0 fs/ext4/ext4_jbd2.h:-1
       quota_release_workfn+0x35f/0x610 fs/quota/dquot.c:840
       process_one_work kernel/workqueue.c:3238 [inline]
       process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3321
       worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
       kthread+0x70e/0x8a0 kernel/kthread.c:464
       ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #0 (sb_internal){++++}-{0:0}:
       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
       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+0xd5/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+0xf9/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

other info that might help us debug this:

Chain exists of:
  sb_internal --> &mm->mmap_lock --> sb_pagefaults

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_pagefaults);
                               lock(&mm->mmap_lock);
                               lock(sb_pagefaults);
  lock(sb_internal);

 *** DEADLOCK ***

4 locks held by syz.5.353/9178:
 #0: ffff888148d45230 (&bdev->bd_fsfreeze_mutex){+.+.}-{4:4}, at: bdev_freeze+0x2a/0x220 block/bdev.c:289
 #1: ffff88802f9ea428 (sb_writers#4){++++}-{0:0}, at: sb_wait_write fs/super.c:1900 [inline]
 #1: ffff88802f9ea428 (sb_writers#4){++++}-{0:0}, at: freeze_super+0x4db/0x1130 fs/super.c:2164
 #2: ffff88802f9ea0e0 (&type->s_umount_key#30){++++}-{4:4}, at: __super_lock fs/super.c:57 [inline]
 #2: ffff88802f9ea0e0 (&type->s_umount_key#30){++++}-{4:4}, at: __super_lock_excl fs/super.c:72 [inline]
 #2: ffff88802f9ea0e0 (&type->s_umount_key#30){++++}-{4:4}, at: freeze_super+0x4e3/0x1130 fs/super.c:2165
 #3: ffff88802f9ea520 (sb_pagefaults){++++}-{0:0}, at: sb_wait_write fs/super.c:1900 [inline]
 #3: ffff88802f9ea520 (sb_pagefaults){++++}-{0:0}, at: freeze_super+0x50a/0x1130 fs/super.c:2169

stack backtrace:
CPU: 1 UID: 0 PID: 9178 Comm: syz.5.353 Not tainted 6.16.0-rc3-syzkaller-00190-g67a993863163 #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
 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+0xd5/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+0xf9/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
RIP: 0033:0x7f62c818e929
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f62c8fcc038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f62c83b5fa0 RCX: 00007f62c818e929
RDX: 0000200000000080 RSI: 000000008004587d RDI: 0000000000000005
RBP: 00007f62c8210b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f62c83b5fa0 R15: 00007ffea0f3d678
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/28 06:36 upstream 67a993863163 fc9d8ee5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in freeze_super
2025/05/13 19:03 upstream e9565e23cd89 7344edeb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in freeze_super
2025/04/26 22:06 upstream 5bc1018675ec c6b4fb39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in freeze_super
2025/06/23 19:28 linux-next f817b6dd2b62 1a7fb460 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in freeze_super
* Struck through repros no longer work on HEAD.