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: 20d, last: 3d12h
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 733d 949d 22/28 fixed on 2023/06/08 14:41
linux-5.15 possible deadlock in freeze_super 1 279d 279d 0/3 auto-obsoleted due to no activity on 2024/11/18 15:18
upstream possible deadlock in freeze_super gfs2 938 1505d 1636d 0/28 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 7d01h 162d 0/3 upstream: reported C repro on 2024/12/05 16:25

Sample crash report:
EXT4-fs (loop7): shut down requested (0)
======================================================
WARNING: possible circular locking dependency detected
6.15.0-rc6-syzkaller-00047-ge9565e23cd89 #0 Not tainted
------------------------------------------------------
syz.7.680/12580 is trying to acquire lock:
ffff88807f22e610 (sb_internal){++++}-{0:0}, at: sb_wait_write fs/super.c:1855 [inline]
ffff88807f22e610 (sb_internal){++++}-{0:0}, at: freeze_super+0x7aa/0xeb0 fs/super.c:2063

but task is already holding lock:
ffff88807f22e518 (sb_pagefaults){++++}-{0:0}, at: sb_wait_write fs/super.c:1855 [inline]
ffff88807f22e518 (sb_pagefaults){++++}-{0:0}, at: freeze_super+0x4f1/0xeb0 fs/super.c:2049

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:5866
       percpu_down_read+0x44/0x1b0 include/linux/percpu-rwsem.h:52
       __sb_start_write include/linux/fs.h:1783 [inline]
       sb_start_pagefault include/linux/fs.h:1948 [inline]
       ext4_page_mkwrite+0x1de/0x1110 fs/ext4/inode.c:6220
       do_page_mkwrite+0x14d/0x310 mm/memory.c:3287
       do_shared_fault mm/memory.c:5594 [inline]
       do_fault mm/memory.c:5656 [inline]
       do_pte_missing mm/memory.c:4160 [inline]
       handle_pte_fault mm/memory.c:5997 [inline]
       __handle_mm_fault+0x18d2/0x5380 mm/memory.c:6140
       handle_mm_fault+0x2d5/0x7f0 mm/memory.c:6309
       do_user_addr_fault+0x764/0x1390 arch/x86/mm/fault.c:1388
       handle_page_fault arch/x86/mm/fault.c:1480 [inline]
       exc_page_fault+0x68/0x110 arch/x86/mm/fault.c:1538
       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:5866
       __might_fault+0xcc/0x130 mm/memory.c:7151
       _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+0x1638/0x1eb0 fs/ioctl.c:840
       __do_sys_ioctl fs/ioctl.c:904 [inline]
       __se_sys_ioctl+0x82/0x170 fs/ioctl.c:892
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xf6/0x210 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:5866
       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_create+0x1a5/0x440 fs/ocfs2/namei.c:673
       lookup_open fs/namei.c:3701 [inline]
       open_last_lookups fs/namei.c:3800 [inline]
       path_openat+0x14f1/0x3830 fs/namei.c:4036
       do_filp_open+0x1fa/0x410 fs/namei.c:4066
       do_sys_openat2+0x121/0x1c0 fs/open.c:1429
       do_sys_open fs/open.c:1444 [inline]
       __do_sys_creat fs/open.c:1522 [inline]
       __se_sys_creat fs/open.c:1516 [inline]
       __x64_sys_creat+0x8f/0xc0 fs/open.c:1516
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xf6/0x210 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:5866
       __mutex_lock_common kernel/locking/mutex.c:601 [inline]
       __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:746
       dquot_release+0x66/0x600 fs/quota/dquot.c:531
       ext4_release_dquot+0x3ee/0x6c0 fs/ext4/ext4_jbd2.h:-1
       quota_release_workfn+0x35c/0x610 fs/quota/dquot.c:840
       process_one_work kernel/workqueue.c:3238 [inline]
       process_scheduled_works+0xadb/0x17a0 kernel/workqueue.c:3319
       worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
       kthread+0x70e/0x8a0 kernel/kthread.c:464
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:153
       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:3166 [inline]
       check_prevs_add kernel/locking/lockdep.c:3285 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3909
       __lock_acquire+0xaac/0xd20 kernel/locking/lockdep.c:5235
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5866
       percpu_down_write+0x54/0x330 kernel/locking/percpu-rwsem.c:229
       sb_wait_write fs/super.c:1855 [inline]
       freeze_super+0x7aa/0xeb0 fs/super.c:2063
       fs_bdev_freeze+0x19f/0x310 fs/super.c:1484
       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:1581 [inline]
       ext4_ioctl+0x1d1d/0x34f0 fs/ext4/ioctl.c:1620
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:906 [inline]
       __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:892
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xf6/0x210 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.7.680/12580:
 #0: ffff888022850d30 (&bdev->bd_fsfreeze_mutex){+.+.}-{4:4}, at: bdev_freeze+0x2a/0x220 block/bdev.c:289
 #1: ffff88807f22e420 (sb_writers#4){++++}-{0:0}, at: sb_wait_write fs/super.c:1855 [inline]
 #1: ffff88807f22e420 (sb_writers#4){++++}-{0:0}, at: freeze_super+0x4c2/0xeb0 fs/super.c:2044
 #2: ffff88807f22e0e0 (&type->s_umount_key#31){++++}-{4:4}, at: __super_lock fs/super.c:56 [inline]
 #2: ffff88807f22e0e0 (&type->s_umount_key#31){++++}-{4:4}, at: __super_lock_excl fs/super.c:71 [inline]
 #2: ffff88807f22e0e0 (&type->s_umount_key#31){++++}-{4:4}, at: freeze_super+0x4ca/0xeb0 fs/super.c:2045
 #3: ffff88807f22e518 (sb_pagefaults){++++}-{0:0}, at: sb_wait_write fs/super.c:1855 [inline]
 #3: ffff88807f22e518 (sb_pagefaults){++++}-{0:0}, at: freeze_super+0x4f1/0xeb0 fs/super.c:2049

stack backtrace:
CPU: 1 UID: 0 PID: 12580 Comm: syz.7.680 Not tainted 6.15.0-rc6-syzkaller-00047-ge9565e23cd89 #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:2079
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2211
 check_prev_add kernel/locking/lockdep.c:3166 [inline]
 check_prevs_add kernel/locking/lockdep.c:3285 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3909
 __lock_acquire+0xaac/0xd20 kernel/locking/lockdep.c:5235
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5866
 percpu_down_write+0x54/0x330 kernel/locking/percpu-rwsem.c:229
 sb_wait_write fs/super.c:1855 [inline]
 freeze_super+0x7aa/0xeb0 fs/super.c:2063
 fs_bdev_freeze+0x19f/0x310 fs/super.c:1484
 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:1581 [inline]
 ext4_ioctl+0x1d1d/0x34f0 fs/ext4/ioctl.c:1620
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:892
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f96a878e969
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:00007f96a960a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f96a89b5fa0 RCX: 00007f96a878e969
RDX: 0000200000000080 RSI: 000000008004587d RDI: 0000000000000005
RBP: 00007f96a8810ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f96a89b5fa0 R15: 00007fff5ec077c8
 </TASK>

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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
* Struck through repros no longer work on HEAD.