From: "Zhou, Yun" <yun.zhou@windriver.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: cem@kernel.org, djwong@kernel.org, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf
Date: Thu, 30 Jul 2026 21:43:44 +0800 [thread overview]
Message-ID: <537b5885-8829-4291-b588-28e54d0b3aed@windriver.com> (raw)
In-Reply-To: <ams1vhkIBQOXQI_l@infradead.org>
On 7/30/2026 7:30 PM, Christoph Hellwig wrote:
> On Wed, Jul 22, 2026 at 09:38:44PM +0800, Yun Zhou wrote:
>> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
>> index 47322adb7690..929677ad95b4 100644
>> --- a/fs/xfs/libxfs/xfs_sb.c
>> +++ b/fs/xfs/libxfs/xfs_sb.c
>> @@ -1470,36 +1470,35 @@ xfs_sync_sb_buf(
>> bool update_rtsb)
>> {
>> struct xfs_trans *tp;
>> int error;
>>
>> error = xfs_trans_alloc(mp, &M_RES(mp)->tr_sb, 0, 0, 0, &tp);
>> if (error)
>> return error;
>>
>> xfs_log_sb(tp);
>> + if (update_rtsb)
>> + xfs_log_rtsb(tp, xfs_trans_getsb(tp));
>> xfs_trans_set_sync(tp);
>
> No new here, but I don't think the transaction reservation is correct
> here. If we're writing both the sb and rtsb buffers, we need a log
> reservation for two buffers, not just for one. Separate patch,
> though.
>
Good catch. I will leave that for a separate fix later.
>>
>> error = xfs_trans_commit(tp);
>> if (error)
>> + return error;
>> +
>> + /* Re-acquire and write the sb and rtsb to disk. */
>> + xfs_buf_lock(mp->m_sb_bp);
>> + xfs_buf_hold(mp->m_sb_bp);
>> + error = xfs_bwrite(mp->m_sb_bp);
>> + xfs_buf_relse(mp->m_sb_bp);
>> + if (error)
>> + return error;
>> +
>> + if (update_rtsb && mp->m_rtsb_bp) {
>> + xfs_buf_lock(mp->m_rtsb_bp);
>> + xfs_buf_hold(mp->m_rtsb_bp);
>> + error = xfs_bwrite(mp->m_rtsb_bp);
>> + xfs_buf_relse(mp->m_rtsb_bp);
>> + }
>
> I don't think we need an extra hold here for both buffers, just
> a lock/unlock, or am I missing something?
>
You are right. I will change it in v3.
Thanks,
Yun
prev parent reply other threads:[~2026-07-30 13:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 13:38 [PATCH v2] xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf Yun Zhou
2026-07-30 9:17 ` Zhou, Yun
2026-07-30 11:30 ` Christoph Hellwig
2026-07-30 13:43 ` Zhou, Yun [this message]
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=537b5885-8829-4291-b588-28e54d0b3aed@windriver.com \
--to=yun.zhou@windriver.com \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).