From: Heming Zhao <heming.zhao@suse.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
Joseph Qi <joseph.qi@linux.alibaba.com>,
jiangyiwen <jiangyiwen@huawei.com>,
Andrew Morton <akpm@linux-foundation.org>,
ocfs2-devel@lists.linux.dev,
Diogo Jahchan Koike <djahchankoike@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ocfs2: kill osb->system_file_mutex lock
Date: Tue, 24 Jun 2025 10:40:15 +0800 [thread overview]
Message-ID: <c9467d9e-5cac-49b8-b839-179dc79d0bce@suse.com> (raw)
In-Reply-To: <675ea747-5c05-410c-888c-fe6dd2b48d87@I-love.SAKURA.ne.jp>
On 6/24/25 10:17, Tetsuo Handa wrote:
> On 2025/06/24 10:33, Heming Zhao wrote:
>>> @@ -112,11 +110,10 @@ struct inode *ocfs2_get_system_file_inode(struct ocfs2_super *osb,
>>> inode = _ocfs2_get_system_file_inode(osb, type, slot);
>>
>> In my view, the key of commit 43b10a20372d is to avoid calling
>> _ocfs2_get_system_file_inode() twice, which lead refcnt+1 but no place to
>> do refcnt-1.
>
> My understanding is that concurrently calling _ocfs2_get_system_file_inode() itself
> is OK, for the caller of ocfs2_get_system_file_inode() is responsible for calling
> iput().
We have different perspectives on calling _ocfs2_get_system_file_inode().
In the current code logic, _ocfs2_get_system_file_inode() is expected to
be called only once. Subsequent local system inodes will be retrieved from
the cache (via get_local_system_inode()).
>
> The problem commit 43b10a20372d fixed is that there was no mechanism to avoid
> concurrently calling
>
> *arr = igrab(inode);
>
> which will result in failing to call iput() for raced references when
> ocfs2_release_system_inodes() is called.
>
>>
>>> /* add one more if putting into array for first time */
>>> - if (arr && inode) {
>>> - *arr = igrab(inode);
>>> - BUG_ON(!*arr);
>>> + if (inode && arr && !*arr && !cmpxchg(&(*arr), NULL, inode)) {
>>
>> Bypassing the refcnt+1 here is not a good idea. We should do refcnt+1
>> before returning to the caller.
>>
>>> + inode = igrab(inode);
>
> We do refcnt+1 immediately after cmpxchg() succeeds, for
> ocfs2_release_system_inodes() which clears *arr is the place for
> doing refcnt-1.
>
>>> + BUG_ON(!inode);
>>> }
>>> - mutex_unlock(&osb->system_file_mutex);
>>> return inode;
>>> }
>>>
>>
>
In my view, your patch has logical errors - at least from my perspective,
I have to vote NAK.
In my view, for this syzbot bug, the better solution is to block/deny write
operations during the ocfs2 mounting phase.
There are many syzbot bugs related to writing data during the mounting phase.
I don't believe there is any reason a user would want to write data before the
filesystem is mounted.
next prev parent reply other threads:[~2025-06-24 2:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-21 15:56 Tetsuo Handa
2025-06-24 1:33 ` Heming Zhao
2025-06-24 1:55 ` Tetsuo Handa
2025-06-24 2:51 ` Heming Zhao
2025-06-24 2:17 ` Tetsuo Handa
2025-06-24 2:40 ` Heming Zhao [this message]
2025-06-24 3:05 ` Tetsuo Handa
2026-05-14 7:09 ` Tetsuo Handa
2026-05-15 15:35 ` Heming Zhao
2026-05-15 15:51 ` Tetsuo Handa
2026-05-15 23:56 ` Heming Zhao
2026-05-15 23:53 ` Heming Zhao
2026-05-16 5:52 ` Tetsuo Handa
2026-05-16 12:27 ` Heming Zhao
2026-05-16 13:10 ` Tetsuo Handa
2026-05-18 2:52 ` Heming Zhao
2026-05-18 4:23 ` [PATCH v2] " Tetsuo Handa
2026-05-18 4:56 ` Heming Zhao
2026-05-18 6:20 ` Joseph Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c9467d9e-5cac-49b8-b839-179dc79d0bce@suse.com \
--to=heming.zhao@suse.com \
--cc=akpm@linux-foundation.org \
--cc=djahchankoike@gmail.com \
--cc=jiangyiwen@huawei.com \
--cc=jlbec@evilplan.org \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@lists.linux.dev \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®