Re: linux-next: manual merge of the fs-next tree with the mm tree

From: Carlos Maiolino

Date: Fri Sep 25 2026 - 08:26:45 EST


Hi Mark.

On Thu, Sep 24, 2026 at 01:09:09PM +0100, Mark Brown wrote:
> Hi all,
>
> Today's linux-next merge of the fs-next tree got a conflict in:
>
> fs/xfs/libxfs/xfs_btree.c
>
> between commit:
>
> 4d1d71f8b90dc ("xfs: remove dead kswapd flag inheritance from btree split worker")
>
> from the mm tree and commit:
>
> 26f42375404e5 ("xfs: fix NOFS state corruption in btree split worker")
>
> from the xfs tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

Do you mean non-trivial conflicts with linux-next? I always attempt a
merge against Linus's tree before sending a pull-request to check and
annotate any possible conflict, but I have never done that for
linux-next. I can do that, no problems. Where should I send a
notification to? linux-next@vger?

Cheers.
Carlos

>
> diff --combined fs/xfs/libxfs/xfs_btree.c
> index 6738d9d1511bc,7effebe297ea0..0000000000000
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@@ -2994,6 -2994,7 +2994,6 @@@ struct xfs_btree_split_args
> struct xfs_btree_cur **curp;
> int *stat; /* success/failure */
> int result;
> - bool kswapd; /* allocation in kswapd context */
> struct completion *done;
> struct work_struct work;
> };
> @@@ -3007,18 -3008,39 +3007,18 @@@ xfs_btree_split_worker
> {
> struct xfs_btree_split_args *args = container_of(work,
> struct xfs_btree_split_args, work);
> - unsigned long pflags;
> - unsigned long new_pflags = 0;
> - unsigned int nofs_flags;
> -
> - /*
> - * we are in a transaction context here, but may also be doing work
> - * in kswapd context, and hence we may need to inherit that state
> - * temporarily to ensure that we don't block waiting for memory reclaim
> - * in any way.
> - */
> - if (args->kswapd)
> - new_pflags |= PF_MEMALLOC | PF_KSWAPD;
> -
> - current_set_flags_nested(&pflags, new_pflags);
> -
> - /*
> - * Don't use xfs_trans_set_context() here: it would overwrite the
> - * caller's saved NOFS state in tp->t_pflags. Use a local scope.
> - */
> - nofs_flags = memalloc_nofs_save();
> + xfs_trans_set_context(args->cur->bc_tp);
>
> args->result = __xfs_btree_split(args->cur, args->level, args->ptrp,
> args->key, args->curp, args->stat);
>
> - memalloc_nofs_restore(nofs_flags);
> - current_restore_flags_nested(&pflags, new_pflags);
> + xfs_trans_clear_context(args->cur->bc_tp);
>
> /*
> * Do not access args after complete() has run here. We don't own args
> * and the owner may run and free args before we return here.
> */
> complete(args->done);
> -
> }
>
> /*
> @@@ -3062,7 -3084,7 +3062,7 @@@ xfs_btree_split
> args.curp = curp;
> args.stat = stat;
> args.done = &done;
> - args.kswapd = current_is_kswapd();
> +
> INIT_WORK_ONSTACK(&args.work, xfs_btree_split_worker);
> queue_work(xfs_alloc_wq, &args.work);
> wait_for_completion(&done);