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

"Zhou, Yun" <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Christoph,

On 7/20/2026 4:35 PM, Christoph Hellwig wrote:
> 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.
> 

Thanks a lot.
I'd like to understand the scope you have in mind. Should the removal of 
xfs_trans_set/clear_context and current_set/restore_flags_nested be part 
of my nofs series, or is that something you'd prefer to handle separately?

BR,
Yun
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.