The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Zhou, Yun" <yun.zhou@windriver.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	cem@kernel.org, linux-xfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: restore nofs context unconditionally in xfs_trans_roll
Date: Mon, 13 Jul 2026 06:28:38 -0700	[thread overview]
Message-ID: <alToBmAN_HyeXth9@infradead.org> (raw)
In-Reply-To: <7a053113-f678-486e-a78b-8f5e94e73acb@windriver.com>

On Mon, Jul 13, 2026 at 06:06:38PM +0800, Zhou, Yun wrote:
> 
> 
> On 7/13/26 17:09, Christoph Hellwig wrote:
> > 
> > On Mon, Jul 13, 2026 at 11:55:05AM +0800, Yun Zhou wrote:
> > > 
> > > diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> > > index 7bfbd9f6f0df..1b36cf12d4e3 100644
> > > --- a/fs/xfs/xfs_trans.c
> > > +++ b/fs/xfs/xfs_trans.c
> > > @@ -1029,6 +1029,15 @@ xfs_trans_roll(
> > >         * duplicate transaction that gets returned.
> > >         */
> > >        error = __xfs_trans_commit(tp, true);
> > > +
> > > +     tp = *tpp;
> > > +     /*
> > > +      * __xfs_trans_commit cleared the NOFS flag by calling into
> > > +      * xfs_trans_free.  Set it again here before doing memory
> > > +      * allocations.
> > > +      */
> > > +     xfs_trans_set_context(tp);
> > 
> > The tp assignment above now returns the incorrect transaction when
> > __xfs_trans_commit fails, so you can't do this.
> > 
> > Otherwise yes, this call should move up.  I don't really see how
> > it fixes the syzbot report, though.
> > 
> 
> Thank you very much for your reply. The tp here is a local variable only
> used for convenience within the function. The caller always gets the new
> transaction through *tpp, which was set by xfs_trans_dup() before the commit
> call. Moving tp = *tpp before the error check doesn't change what the caller
> sees - *tpp still points to the new (dup'd) transaction regardless.

Ah, right.  Tis should be fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>


  reply	other threads:[~2026-07-13 13:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  3:55 [PATCH] xfs: restore nofs context unconditionally in xfs_trans_roll Yun Zhou
2026-07-13  9:09 ` Christoph Hellwig
2026-07-13 10:06   ` Zhou, Yun
2026-07-13 13:28     ` Christoph Hellwig [this message]
2026-07-13 23:04       ` Darrick J. Wong
2026-07-14  2:15         ` Zhou, Yun

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=alToBmAN_HyeXth9@infradead.org \
    --to=hch@infradead.org \
    --cc=cem@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=yun.zhou@windriver.com \
    /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