From: Christoph Hellwig <hch@infradead.org>
To: Yun Zhou <yun.zhou@windriver.com>
Cc: cem@kernel.org, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] xfs: fix nofs context corruption in xfs_btree_split_worker
Date: Mon, 20 Jul 2026 01:35:22 -0700 [thread overview]
Message-ID: <al3dypUNu1VNZErK@infradead.org> (raw)
In-Reply-To: <20260720050522.3101824-1-yun.zhou@windriver.com>
On Mon, Jul 20, 2026 at 01:05:22PM +0800, Yun Zhou wrote:
> current_set_flags_nested(&pflags, new_pflags);
> - xfs_trans_set_context(args->cur->bc_tp);
> + nofs_flags = memalloc_nofs_save();
Note that the above is the only user of current_set_flags_nested.
> args->result = __xfs_btree_split(args->cur, args->level, args->ptrp,
> args->key, args->curp, args->stat);
>
> - xfs_trans_clear_context(args->cur->bc_tp);
> + memalloc_nofs_restore(nofs_flags);
> current_restore_flags_nested(&pflags, new_pflags);
and this is the only caller of current_restore_flags_nested. Both
of which modify the task flags just like memalloc_nofs_save.
I think we'd be much better of just killing all these silly helpers
and do direct current->flags manipulations, which will both clarify
this code and fix the bug it caused.
Similarly xfs_trans_set_context / xfs_trans_set_context need to go
away as they were a part of this problem. And to make this coherent,
it should be combined with your other flags series.
next prev parent reply other threads:[~2026-07-20 8:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 5:05 [PATCH] xfs: fix nofs context corruption in xfs_btree_split_worker Yun Zhou
2026-07-20 8:35 ` Christoph Hellwig [this message]
2026-07-24 7:54 ` Zhou, Yun
2026-07-24 8:06 ` Christoph Hellwig
2026-07-24 8:14 ` Zhou, Yun
2026-07-24 13:42 ` Christoph Hellwig
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=al3dypUNu1VNZErK@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.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