[syzbot] [ocfs2?] WARNING in __rt_mutex_slowlock_locked (3)

1 view
Skip to first unread message

syzbot

unread,
Jun 19, 2026, 11:59:25 PM (11 hours ago) Jun 19
to jl...@evilplan.org, jose...@linux.alibaba.com, linux-...@vger.kernel.org, ma...@fasheh.com, ocfs2...@lists.linux.dev, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: b1cbabe84ca1 Merge tag 'for-7.2/dm-changes' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11b26986580000
kernel config: https://syzkaller.appspot.com/x/.config?x=effd10de8797244
dashboard link: https://syzkaller.appspot.com/bug?extid=ce129763ce7d7e914739
compiler: Debian clang version 22.1.6 (++20260514074242+fc4aad7b5db3-1~exp1~20260514074407.73), Debian LLD 22.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11a7e4ae580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=100063b6580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/965fde89d8ba/disk-b1cbabe8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6e68a7e15b8d/vmlinux-b1cbabe8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6ffa4967bc81/bzImage-b1cbabe8.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/d0c566fd1884/mount_0.gz
fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=1344c4ae580000)

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+ce1297...@syzkaller.appspotmail.com

------------[ cut here ]------------
rtmutex deadlock detected
WARNING: kernel/locking/rtmutex.c:1698 at rt_mutex_handle_deadlock kernel/locking/rtmutex.c:1698 [inline], CPU#1: syz.2.19/6001
WARNING: kernel/locking/rtmutex.c:1698 at __rt_mutex_slowlock kernel/locking/rtmutex.c:1760 [inline], CPU#1: syz.2.19/6001
WARNING: kernel/locking/rtmutex.c:1698 at __rt_mutex_slowlock_locked+0xeeb/0x25b0 kernel/locking/rtmutex.c:1787, CPU#1: syz.2.19/6001
Modules linked in:
CPU: 1 UID: 0 PID: 6001 Comm: syz.2.19 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
RIP: 0010:rt_mutex_handle_deadlock kernel/locking/rtmutex.c:1698 [inline]
RIP: 0010:__rt_mutex_slowlock kernel/locking/rtmutex.c:1760 [inline]
RIP: 0010:__rt_mutex_slowlock_locked+0xeeb/0x25b0 kernel/locking/rtmutex.c:1787
Code: 0d 48 8b bc 24 88 00 00 00 e8 51 1a 7c 09 83 7c 24 40 dd 0f 85 3a 0b 00 00 48 8b 7c 24 18 e8 2c 1b 7c 09 48 8d 3d 45 3a cc 0d <67> 48 0f b9 3a 48 8b 9c 24 80 00 00 00 4c 8b b4 24 90 00 00 00 43
RSP: 0018:ffffc900040f6ae0 EFLAGS: 00010286
RAX: 0000000080000000 RBX: ffff888045214e28 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff8b87bf80 RDI: ffffffff8f6c4fb0
RBP: ffffc900040f6cb0 R08: ffffffff8f692af7 R09: 1ffffffff1ed255e
R10: dffffc0000000000 R11: fffffbfff1ed255f R12: ffff88803bd7f550
R13: ffff88803bd7dd18 R14: ffff888045213d68 R15: dffffc0000000000
FS: 00007f5edd08e6c0(0000) GS:ffff88812647d000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000000293cc000 CR4: 00000000003526f0
Call Trace:
<TASK>
rt_mutex_slowlock+0xbd/0x170 kernel/locking/rtmutex.c:1827
__rt_mutex_lock kernel/locking/rtmutex.c:1842 [inline]
rwbase_write_lock+0x14c/0x720 kernel/locking/rwbase_rt.c:251
inode_lock include/linux/fs.h:1029 [inline]
ocfs2_del_inode_from_orphan+0x12e/0x7b0 fs/ocfs2/namei.c:2728
ocfs2_dio_end_io_write fs/ocfs2/aops.c:2379 [inline]
ocfs2_dio_end_io+0xfe3/0x13b0 fs/ocfs2/aops.c:2418
dio_complete+0x254/0x760 fs/direct-io.c:281
__blockdev_direct_IO+0x2d43/0x33d0 fs/direct-io.c:1296
ocfs2_direct_IO+0x24b/0x2c0 fs/ocfs2/aops.c:2455
generic_file_direct_write+0x1d1/0x3f0 mm/filemap.c:4270
__generic_file_write_iter+0x120/0x240 mm/filemap.c:4439
ocfs2_file_write_iter+0x1709/0x1f20 fs/ocfs2/file.c:2476
do_iter_readv_writev+0x624/0x8d0 fs/read_write.c:-1
vfs_writev+0x34c/0x990 fs/read_write.c:1058
do_pwritev fs/read_write.c:1154 [inline]
__do_sys_pwritev2 fs/read_write.c:1212 [inline]
__se_sys_pwritev2+0x17a/0x2a0 fs/read_write.c:1203
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5edda2ce59
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:00007f5edd08e028 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f5eddca5fa0 RCX: 00007f5edda2ce59
RDX: 0000000000000001 RSI: 0000200000000240 RDI: 0000000000000004
RBP: 00007f5eddac2d6f R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000005a00 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5eddca6038 R14: 00007f5eddca5fa0 R15: 00007ffef8036c98
</TASK>
----------------
Code disassembly (best guess):
0: 0d 48 8b bc 24 or $0x24bc8b48,%eax
5: 88 00 mov %al,(%rax)
7: 00 00 add %al,(%rax)
9: e8 51 1a 7c 09 call 0x97c1a5f
e: 83 7c 24 40 dd cmpl $0xffffffdd,0x40(%rsp)
13: 0f 85 3a 0b 00 00 jne 0xb53
19: 48 8b 7c 24 18 mov 0x18(%rsp),%rdi
1e: e8 2c 1b 7c 09 call 0x97c1b4f
23: 48 8d 3d 45 3a cc 0d lea 0xdcc3a45(%rip),%rdi # 0xdcc3a6f
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 48 8b 9c 24 80 00 00 mov 0x80(%rsp),%rbx
36: 00
37: 4c 8b b4 24 90 00 00 mov 0x90(%rsp),%r14
3e: 00
3f: 43 rex.XB


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
1:30 AM (9 hours ago) 1:30 AM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: [PATCH] ocfs2: fix deadlock between dio write and orphan dir inode lock
Author: karti...@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


The following deadlock is detected by PREEMPT_RT's rtmutex detector:

Thread 1 (pwritev2 -> ocfs2_file_write_iter):
inode_lock(file_inode) <- held here
ocfs2_dio_end_io_write()
ocfs2_inode_lock() <- cluster lock
ocfs2_del_inode_from_orphan()
inode_lock(orphan_dir) <- deadlock!

Thread 2 (recovery path):
inode_lock(orphan_dir) <- held first
inode_lock(file_inode) <- reverse order!

ocfs2_file_write_iter() acquires inode_lock(file_inode) and holds it
across the entire write including the synchronous DIO completion
callback ocfs2_dio_end_io_write(). When dwc->dw_orphaned is set,
ocfs2_dio_end_io_write() calls ocfs2_del_inode_from_orphan() which
acquires inode_lock(orphan_dir_inode), creating an AB-BA lock
inversion with recovery paths that acquire orphan_dir lock first.

Fix this by:
- Saving the orphaned state before releasing locks
- Moving ocfs2_inode_unlock() and brelse(di_bh) BEFORE the call to
ocfs2_del_inode_from_orphan() in ocfs2_dio_end_io_write()
- Passing NULL for di_bh to ocfs2_del_inode_from_orphan() to signal
it should acquire its own cluster lock and di_bh internally
- In ocfs2_del_inode_from_orphan(), changing di initialization from
a declaration+assignment to just a declaration, then acquiring a
fresh ocfs2_inode_lock() when di_bh is NULL, and releasing it
in the bail path

Reported-by: syzbot+ce1297...@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=ce129763ce7d7e914739
Signed-off-by: Deepanshu kartikey <karti...@gmail.com>
---
fs/ocfs2/aops.c | 14 ++++++++------
fs/ocfs2/namei.c | 17 ++++++++++++++++-
2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 6ec198bdab12..d1d22019dc61 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -2280,6 +2280,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
handle_t *handle = NULL;
loff_t end = offset + bytes;
int ret = 0, credits = 0, batch = 0;
+ bool orphaned = false;

ocfs2_init_dealloc_ctxt(&dealloc);

@@ -2371,17 +2372,18 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
ocfs2_commit_trans(osb, handle);
unlock:
up_write(&oi->ip_alloc_sem);
+ orphaned = (!ret && dwc->dw_orphaned);
+ ocfs2_inode_unlock(inode, 1);
+ brelse(di_bh);
+ di_bh = NULL;

- /* everything looks good, let's start the cleanup */
- if (!ret && dwc->dw_orphaned) {
+ /* everything looks good, let's start the orphan cleanup */
+ if (orphaned) {
BUG_ON(dwc->dw_writer_pid != task_pid_nr(current));
-
- ret = ocfs2_del_inode_from_orphan(osb, inode, di_bh, 0, 0);
+ ret = ocfs2_del_inode_from_orphan(osb, inode, NULL, 0, 0);
if (ret < 0)
mlog_errno(ret);
}
- ocfs2_inode_unlock(inode, 1);
- brelse(di_bh);
out:
if (data_ac)
ocfs2_free_alloc_context(data_ac);
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 1277666c77cd..25bbe2a9776e 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -2712,10 +2712,21 @@ int ocfs2_del_inode_from_orphan(struct ocfs2_super *osb,
{
struct inode *orphan_dir_inode = NULL;
struct buffer_head *orphan_dir_bh = NULL;
- struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
+ struct ocfs2_dinode *di;
handle_t *handle = NULL;
int status = 0;
+ struct buffer_head *local_di_bh = NULL;

+ if (!di_bh) {
+ status = ocfs2_inode_lock(inode, &local_di_bh, 1);
+ if (status < 0) {
+ mlog_errno(status);
+ return status;
+ }
+ di_bh = local_di_bh;
+ }
+
+ di = (struct ocfs2_dinode *)di_bh->b_data;
orphan_dir_inode = ocfs2_get_system_file_inode(osb,
ORPHAN_DIR_SYSTEM_INODE,
le16_to_cpu(di->i_dio_orphaned_slot));
@@ -2779,6 +2790,10 @@ int ocfs2_del_inode_from_orphan(struct ocfs2_super *osb,
iput(orphan_dir_inode);

bail:
+ if (local_di_bh) {
+ ocfs2_inode_unlock(inode, 1);
+ brelse(local_di_bh);
+ }
return status;
}

--
2.43.0

syzbot

unread,
2:07 AM (9 hours ago) 2:07 AM
to karti...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
lost connection to test machine



Tested on:

commit: 1a3746cc Merge tag 'strncpy-removal-v7.2-rc1' of git:/..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12cb6bd2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7d60cd58d53b939b
dashboard link: https://syzkaller.appspot.com/bug?extid=ce129763ce7d7e914739
compiler: Debian clang version 22.1.6 (++20260514074242+fc4aad7b5db3-1~exp1~20260514074407.73), Debian LLD 22.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=16eb07f2580000

syzbot

unread,
3:06 AM (8 hours ago) 3:06 AM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com

syzbot

unread,
3:37 AM (7 hours ago) 3:37 AM
to karti...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
lost connection to test machine



Tested on:

commit: 1a3746cc Merge tag 'strncpy-removal-v7.2-rc1' of git:/..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16b14641580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7d60cd58d53b939b
dashboard link: https://syzkaller.appspot.com/bug?extid=ce129763ce7d7e914739
compiler: Debian clang version 22.1.6 (++20260514074242+fc4aad7b5db3-1~exp1~20260514074407.73), Debian LLD 22.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=1349050e580000

Reply all
Reply to author
Forward
0 new messages