]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ocfs2: avoid potential ABBA deadlock by reordering tl_inode lock
authorIvan Pravdin <ipravdin.official@gmail.com>
Tue, 8 Jul 2025 02:06:40 +0000 (22:06 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 20 Jul 2025 02:08:27 +0000 (19:08 -0700)
commit08eabe4b9e98d940d2dd6cdb70c7a9187ca54aca
tree56c37e4d7efdcf219a8629a6652eca27ff906744
parent97103dcec292b8688de142f7a48bd0d46038d3f6
ocfs2: avoid potential ABBA deadlock by reordering tl_inode lock

In ocfs2_move_extent(), tl_inode is currently locked after the global
bitmap inode.  However, in ocfs2_flush_truncate_log(), the lock order is
reversed: tl_inode is locked first, followed by the global bitmap inode.

This creates a classic ABBA deadlock scenario if two threads attempt these
operations concurrently and acquire the locks in different orders.

To prevent this, move the tl_inode locking earlier in ocfs2_move_extent(),
so that it always precedes the global bitmap inode lock.

No functional changes beyond lock ordering.

Link: https://lkml.kernel.org/r/20250708020640.387741-1-ipravdin.official@gmail.com
Reported-by: syzbot+6bf948e47f9bac7aacfa@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/67d5645c.050a0220.1dc86f.0004.GAE@google.com/
Signed-off-by: Ivan Pravdin <ipravdin.official@gmail.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/move_extents.c