]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ocfs2: kill osb->system_file_mutex lock
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Mon, 18 May 2026 04:23:40 +0000 (13:23 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 29 May 2026 04:24:57 +0000 (21:24 -0700)
commitf5b1910e23f1233c8d4185268b2e659df2bc5dbf
tree562b4c93a89b5c16ed609e371d4bf69340bcb389
parentf7ea0d13735ef812f7c777d5c0a79ff6a4b369c3
ocfs2: kill osb->system_file_mutex lock

Commit 43b10a20372d ("ocfs2: avoid system inode ref confusion by adding
mutex lock") tried to avoid a refcount leak caused by allowing multiple
threads to call igrab(inode).  But addition of osb->system_file_mutex made
locking dependency complicated and is causing lockdep to warn about
possibility of AB-BA deadlock.

Since _ocfs2_get_system_file_inode() returns the same inode for the same
input arguments, we don't need to serialize
_ocfs2_get_system_file_inode().  What we need to make sure is that
igrab(inode) is called for only once().  Therefore, replace
osb->system_file_mutex with cmpxchg()-based locking.

Link: https://lore.kernel.org/fea8d1fd-afb0-4302-a560-c202e2ef7afd@I-love.SAKURA.ne.jp
Fixes: 43b10a20372d ("ocfs2: avoid system inode ref confusion by adding mutex lock")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Heming Zhao <heming.zhao@suse.com>
Acked-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/ocfs2.h
fs/ocfs2/super.c
fs/ocfs2/sysfile.c