Re: [PATCH] ocfs2: fix circular locking dependency in reflink

Joseph Qi <[email protected]>
Newsgroups dev.linux.lists.ocfs2-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 8/1/26 2:21 AM, Andrew Morton wrote:
> On Fri, 31 Jul 2026 19:34:25 +0800 Joseph Qi <[email protected]> wrote:
> 
>> Lockdep reports a possible deadlock involving ip_alloc_sem,
>> j_trans_barrier, and ip_xattr_sem:
>>
> 
> Cool.
> 
> Sashiko said a couple of things:
> 	https://sashiko.dev/#/patchset/[email protected]
> 

The issue sashiko has found is real.

After a deep look, I think it can be fixed by breaking j_trans_barrier
-> ip_xattr_sem instread of ip_xattr_sem -> ip_alloc_sem, which is
actually posted by Krystian Kaniewski in thread (I've ACKed):
https://lore.kernel.org/ocfs2-devel/[email protected]/T/#t

So please drop this patch and let's keep the existing order for
ip_xattr_sem -> ip_alloc_sem.

Thanks,
Joseph


>> Fix by swapping the lock order in both functions to acquire
>> ip_alloc_sem before ip_xattr_sem, consistent with the rest of the
>> codebase.
>>
>> Fixes: 09bf27a00020 ("ocfs2: Implement ocfs2_reflink.")
>> Fixes: 8b2c0dba5159 ("ocfs2: Call refcount tree remove process properly.")
> 
> Should we backport this into -stable kernels?
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.