Re: [PATCH] xfs: fix nofs context corruption in xfs_btree_split_worker

Christoph Hellwig <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.