linux-next: manual merge of the nfs tree with Linus' tree
Subsystems (4)
Hi all,
Today's linux-next merge of the nfs tree got a conflict in:
fs/nfs/localio.c
between commits:
94afb627dfc2 ("nfs: use credential guards in nfs_local_call_read()")
bff3c841f7bd ("nfs: use credential guards in nfs_local_call_write()")
1d18101a644e ("Merge tag 'kernel-6.19-rc1.cred' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")
from Linus' tree and commit:
30a4385509b4 ("nfs/localio: fix regression due to out-of-order __put_cred")
from the nfs tree.
I fixed it up (I just dropped the nfs tree commit) 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.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 22 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the nfs tree got a conflict in:
fs/nfs/localio.cbetween commits:
94afb627dfc2("nfs: use credential guards innfs_local_call_read()")
bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")from Linus' tree and commit:
30a4385509b4("nfs/localio: fix regression due to out-of-order__put_cred")from the nfs tree.
Quoted 9 lines
I fixed it up (I just dropped the nfs tree commit) 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.
I'm worried that resolving this is not going to be trivial...
The nfs tree commit is a fix for a regression that appeared in 6.18, and the problem with just dropping it in favour of the scoped cred version in Christian's tree is that that appears to propagate the regression.
Mike, am I wrong?
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected], [email protected]
Quoted 33 lines · Trond Myklebust
Quoted 22 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the nfs tree got a conflict in:
fs/nfs/localio.cbetween commits:
94afb627dfc2("nfs: use credential guards innfs_local_call_read()")
bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")from Linus' tree and commit:
30a4385509b4("nfs/localio: fix regression due to out-of-order__put_cred")from the nfs tree.
Quoted 9 lines
I fixed it up (I just dropped the nfs tree commit) 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.
Quoted 8 lines
I'm worried that resolving this is not going to be trivial...
The nfs tree commit is a fix for a regression that appeared in 6.18, and the problem with just dropping it in favour of the scoped cred version in Christian's tree is that that appears to propagate the regression.
Mike, am I wrong?
You're correct. But I just sent how I think we need to handle this.
Thanks,
Mike
PATCH 1/1 nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
In reply to Stephen RothwellHi Stephen,
Quoted 12 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the nfs tree got a conflict in:
fs/nfs/localio.cbetween commits:
94afb627dfc2("nfs: use credential guards innfs_local_call_read()")
bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")
Quoted 5 lines
from Linus' tree and commit:
30a4385509b4("nfs/localio: fix regression due to out-of-order__put_cred")from the nfs tree.
The NFS tree's commit 30a4385509b4 needed to be rebased (taken care of below), which complicates the 6.18-stable backport (equivalent of the nfs tree's commit 30a4385509b4 must be sent to linux-stable@ rather than it being cherry-picked once the below updated fix applied to Linus' tree).
Quoted 6 lines
I fixed it up (I just dropped the nfs tree commit) 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.
Trond and Linus,
Here is the fix for 6.19 rebased ontop of Linus' tree:
From: Mike Snitzer <[email protected]>
Date: Wed, 26 Nov 2025 01:01:25 -0500
Subject: [PATCH] nfs/localio: fix regression due to out-of-order __put_cred
Commit f2060bdc21d7 ("nfs/localio: add refcounting for each iocb IO associated with NFS pgio header") inadvertantly reintroduced the same potential for __put_cred() triggering BUG_ON(cred == current->cred) that commit 992203a1fba5 ("nfs/localio: restore creds before releasing pageio data") fixed.
Fix this by saving and restoring the cred around each {read,write}_iter call within the respective for loop of nfs_local_call_{read,write} using scoped_with_creds().
NOTE: this fix started by first reverting the following commits:
94afb627dfc2 ("nfs: use credential guards in nfs_local_call_read()")
bff3c841f7bd ("nfs: use credential guards in nfs_local_call_write()")
1d18101a644e ("Merge tag 'kernel-6.19-rc1.cred' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")
followed by narrowly fixing the cred lifetime issue by using scoped_with_creds(). In doing so, this commit's changes appear more extensive than they really are (as evidenced by comparing to v6.18's fs/nfs/localio.c).
fs/nfs/localio.c +17 -31
@@ -615,8 +615,11 @@ static void nfs_local_read_aio_complete(struct kiocb *kiocb, long ret)nfs_local_pgio_aio_complete (iocb);/* Calls nfs_local_read_aio_complete_work */ } -static void do_nfs_local_call_read (struct nfs_local_kiocb *iocb,struct file *filp) +static void nfs_local_call_read (struct work_struct *work) { +struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp;bool force_done = false;ssize_t status;int n_iters;
@@ -633,7 +636,9 @@ static void do_nfs_local_call_read(struct nfs_local_kiocb *iocb, struct file *fi }else iocb->kiocb.ki_flags &= ~IOCB_DIRECT ; - status = filp->f_op->read_iter (&iocb->kiocb, &iocb->iters[i]); +scoped_with_creds (filp->f_cred) + status = filp->f_op->read_iter(&iocb->kiocb, &iocb->iters[i]); +if (status != -EIOCBQUEUED ) {if (unlikely (status >=0 && status < iocb->iters[i].count)) force_done = true;/* Partial read */
@@ -645,16 +650,6 @@ static void do_nfs_local_call_read(struct nfs_local_kiocb *iocb, struct file *fi } } -static void nfs_local_call_read (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; - - scoped_with_creds(filp->f_cred) -do_nfs_local_call_read (iocb, filp); -} -static int nfs_local_do_read (struct nfs_local_kiocb *iocb,const struct rpc_call_ops *call_ops)
@@ -822,13 +817,18 @@ static void nfs_local_write_aio_complete(struct kiocb *kiocb, long ret)nfs_local_pgio_aio_complete (iocb);/* Calls nfs_local_write_aio_complete_work */ } -static ssize_t do_nfs_local_call_write (struct nfs_local_kiocb *iocb, -struct file *filp) +static void nfs_local_call_write (struct work_struct *work) { +struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp; +unsigned long old_flags = current->flags;bool force_done = false;ssize_t status;int n_iters; + current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; +file_start_write (filp); n_iters =atomic_read (&iocb->n_iters);for (int i =0 ; i < n_iters ; i++) {
@@ -842,7 +842,9 @@ static ssize_t do_nfs_local_call_write(struct nfs_local_kiocb *iocb, }else iocb->kiocb.ki_flags &= ~IOCB_DIRECT ; - status = filp->f_op->write_iter (&iocb->kiocb, &iocb->iters[i]); +scoped_with_creds (filp->f_cred) + status = filp->f_op->write_iter(&iocb->kiocb, &iocb->iters[i]); +if (status != -EIOCBQUEUED ) {if (unlikely (status >=0 && status < iocb->iters[i].count)) force_done = true;/* Partial write */
@@ -854,22 +856,6 @@ static ssize_t do_nfs_local_call_write(struct nfs_local_kiocb *iocb, }file_end_write (filp); -return status; -} - -static void nfs_local_call_write (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; -unsigned long old_flags = current->flags; -ssize_t status; - - current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; - -scoped_with_creds (filp->f_cred) - status = do_nfs_local_call_write(iocb, filp); - current->flags = old_flags; }
kernel test robot
build botRe: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
FYI: kernel test robot notices the stable kernel rule is not satisfied.
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1
Rule: add the tag "Cc: [email protected]" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
In reply to Mike SnitzerQuoted 36 lines · Mike Snitzer
Hi Stephen,
Quoted 12 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the nfs tree got a conflict in:
fs/nfs/localio.cbetween commits:
94afb627dfc2("nfs: use credential guards innfs_local_call_read()")
bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")Quoted 5 lines
from Linus' tree and commit:
30a4385509b4("nfs/localio: fix regression due to out-of-order__put_cred")from the nfs tree.
The NFS tree's commit
30a4385509b4needed to be rebased (taken care of below), which complicates the 6.18-stable backport (equivalent of the nfs tree's commit30a4385509b4must be sent to linux-stable@ rather than it being cherry-picked once the below updated fix applied to Linus' tree).Quoted 6 lines
I fixed it up (I just dropped the nfs tree commit) 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.
Trond and Linus,
Quoted 7 lines
Here is the fix for 6.19 rebased ontop of Linus' tree:
From: Mike Snitzer <[email protected]>
Date: Wed, 26 Nov 2025 01:01:25 -0500
Subject: [PATCH] nfs/localio: fix regression due to out-of-order__put_credCommit
f2060bdc21d7("nfs/localio: add refcounting for each iocb IO
Ah, ok. So it reintroduced a bug. Thanks for the explanation and the fix. I was worried we created that bug.
Quoted 126 lines
associated with NFS pgio header") inadvertantly reintroduced the same potential for
__put_cred()triggeringBUG_ON(cred == current->cred)that commit992203a1fba5("nfs/localio: restore creds before releasing pageio data") fixed.Fix this by saving and restoring the cred around each {read,write}_iter call within the respective for loop of nfs_local_call_{read,write} using
scoped_with_creds().NOTE: this fix started by first reverting the following commits:
94afb627dfc2("nfs: use credential guards innfs_local_call_read()")
bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")followed by narrowly fixing the cred lifetime issue by using
scoped_with_creds(). In doing so, this commit's changes appear more extensive than they really are (as evidenced by comparing to v6.18'sfs/nfs/localio.c).Reported-by Zorro Lang <[email protected]>Fixes f2060bdc21d7 ("nfs/localio: add refcounting for each iocb IO associated with NFS pgio header")Cc [email protected] # a custom 6.18-stable backport is requiredSigned-off-by Mike Snitzer <[email protected]>Signed-off-by Trond Myklebust <[email protected]>fs/nfs/localio.c +17
-31@@ -615,8 +615,11 @@ static void nfs_local_read_aio_complete(struct kiocb *kiocb, long ret)nfs_local_pgio_aio_complete (iocb);/* Calls nfs_local_read_aio_complete_work */ } -static void do_nfs_local_call_read (struct nfs_local_kiocb *iocb,struct file *filp) +static void nfs_local_call_read (struct work_struct *work) { +struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp;bool force_done = false;ssize_t status;int n_iters;@@ -633,7 +636,9 @@ static void do_nfs_local_call_read(struct nfs_local_kiocb *iocb, struct file *fi }else iocb->kiocb.ki_flags &= ~IOCB_DIRECT ; - status = filp->f_op->read_iter (&iocb->kiocb, &iocb->iters[i]); +scoped_with_creds (filp->f_cred) + status = filp->f_op->read_iter(&iocb->kiocb, &iocb->iters[i]); +if (status != -EIOCBQUEUED ) {if (unlikely (status >=0 && status < iocb->iters[i].count)) force_done = true;/* Partial read */ @@ -645,16 +650,6 @@ static void do_nfs_local_call_read(struct nfs_local_kiocb *iocb, struct file *fi } } -static void nfs_local_call_read (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; - - scoped_with_creds(filp->f_cred) -do_nfs_local_call_read (iocb, filp); -} -static int nfs_local_do_read (struct nfs_local_kiocb *iocb,const struct rpc_call_ops *call_ops)@@ -822,13 +817,18 @@ static void nfs_local_write_aio_complete(struct kiocb *kiocb, long ret)nfs_local_pgio_aio_complete (iocb);/* Calls nfs_local_write_aio_complete_work */ } -static ssize_t do_nfs_local_call_write (struct nfs_local_kiocb *iocb, -struct file *filp) +static void nfs_local_call_write (struct work_struct *work) { +struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp; +unsigned long old_flags = current->flags;bool force_done = false;ssize_t status;int n_iters; + current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; +file_start_write (filp); n_iters =atomic_read (&iocb->n_iters);for (int i =0 ; i < n_iters ; i++) {@@ -842,7 +842,9 @@ static ssize_t do_nfs_local_call_write(struct nfs_local_kiocb *iocb, }else iocb->kiocb.ki_flags &= ~IOCB_DIRECT ; - status = filp->f_op->write_iter (&iocb->kiocb, &iocb->iters[i]); +scoped_with_creds (filp->f_cred) + status = filp->f_op->write_iter(&iocb->kiocb, &iocb->iters[i]); +if (status != -EIOCBQUEUED ) {if (unlikely (status >=0 && status < iocb->iters[i].count)) force_done = true;/* Partial write */ @@ -854,22 +856,6 @@ static ssize_t do_nfs_local_call_write(struct nfs_local_kiocb *iocb, }file_end_write (filp); -return status; -} - -static void nfs_local_call_write (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; -unsigned long old_flags = current->flags; -ssize_t status; - - current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; - -scoped_with_creds (filp->f_cred) - status = do_nfs_local_call_write(iocb, filp); - current->flags = old_flags; }
Trond Myklebust
maintainerRe: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
In reply to Mike SnitzerQuoted 199 lines · Mike Snitzer
Hi Stephen,
Quoted 15 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the nfs tree got a conflict in:
fs/nfs/localio.cbetween commits:
94afb627dfc2("nfs: use credential guards innfs_local_call_read()")
bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")Quoted 6 lines
from Linus' tree and commit:
30a4385509b4("nfs/localio: fix regression due to out-of-order__put_cred")from the nfs tree.
The NFS tree's commit
30a4385509b4needed to be rebased (taken care of
below), which complicates the 6.18-stable backport (equivalent of the nfs tree's commit30a4385509b4must be sent to linux-stable@ rather than it being cherry-picked once the below updated fix applied to Linus' tree).Quoted 10 lines
I fixed it up (I just dropped the nfs tree commit) 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.Trond and Linus,
Here is the fix for 6.19 rebased ontop of Linus' tree:
From: Mike Snitzer <[email protected]>
Date: Wed, 26 Nov 2025 01:01:25 -0500
Subject: [PATCH] nfs/localio: fix regression due to out-of-order__put_credCommit
f2060bdc21d7("nfs/localio: add refcounting for each iocb IO associated with NFS pgio header") inadvertantly reintroduced the same potential for__put_cred()triggeringBUG_ON(cred == current->cred)that commit992203a1fba5("nfs/localio: restore creds before releasing
pageio data") fixed.Fix this by saving and restoring the cred around each {read,write}_iter
call within the respective for loop of nfs_local_call_{read,write} usingscoped_with_creds().NOTE: this fix started by first reverting the following commits:
94afb627dfc2 ("nfs: use credential guards in
nfs_local_call_read()")bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e ("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")followed by narrowly fixing the cred lifetime issue by using
scoped_with_creds(). In doing so, this commit's changes appear more extensive than they really are (as evidenced by comparing to v6.18'sfs/nfs/localio.c).Reported-by Zorro Lang <[email protected]>Fixes f2060bdc21d7 ("nfs/localio: add refcounting for each iocb IOassociated with NFS pgio header")
Cc: [email protected] # a custom 6.18-stable backport is requiredSigned-off-by Mike Snitzer <[email protected]>Signed-off-by Trond Myklebust <[email protected]>fs/nfs/localio.c +0
-0@@ -615,8 +615,11 @@ static void nfs_local_read_aio_complete(struct kiocb *kiocb, long ret)
nfs_local_pgio_aio_complete(iocb); /* Callsnfs_local_read_aio_complete_work*/
}
-static voiddo_nfs_local_call_read(struct nfs_local_kiocb *iocb, struct file *filp)
+static voidnfs_local_call_read(struct work_struct *work){fs/nfs/localio.c +3
-0+struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp;bool
force_done= false;
ssize_tstatus;
intn_iters;fs/nfs/localio.c +0
-0@@ -633,7 +636,9 @@ static void do_nfs_local_call_read(struct
nfs_local_kiocb*iocb, struct file *fi
} else
iocb->kiocb.ki_flags&= ~IOCB_DIRECT;fs/nfs/localio.c +0
-1- status = filp->f_op->read_iter(&iocb->kiocb, &iocb-Quoted 1 line
iters[i]);
fs/nfs/localio.c +2
-0+scoped_with_creds (filp->f_cred) + status = filp->f_op->read_iter(&iocb->kiocb,&iocb->iters[i]);
+
if (status !=-EIOCBQUEUED) {
if (unlikely(status >= 0 && status < iocb-Quoted 1 line
iters[i].count))
force_done= true; /* Partial read */fs/nfs/localio.c +0
-0@@ -645,16 +650,6 @@ static void do_nfs_local_call_read(struct
nfs_local_kiocb*iocb, struct file *fi
}
}fs/nfs/localio.c +0
-10-static void nfs_local_call_read (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; - - scoped_with_creds(filp->f_cred) -do_nfs_local_call_read (iocb, filp); -} -static int
nfs_local_do_read(structnfs_local_kiocb*iocb, const structrpc_call_ops*call_ops)fs/nfs/localio.c +0
-0@@ -822,13 +817,18 @@ static void nfs_local_write_aio_complete(struct kiocb *kiocb, long ret)
nfs_local_pgio_aio_complete(iocb); /* Callsnfs_local_write_aio_complete_work*/
}fs/nfs/localio.c +1
-2-static ssize_t do_nfs_local_call_write (struct nfs_local_kiocb *iocb, - struct file *filp) +static void nfs_local_call_write (struct work_struct *work){
fs/nfs/localio.c +4
-0+struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp; +unsigned long old_flags = current->flags;bool
force_done= false;
ssize_tstatus;
intn_iters;fs/nfs/localio.c +2
-0+ current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; +
file_start_write(filp);
n_iters=atomic_read(&iocb->n_iters);
for (int i = 0; i <n_iters; i++) {fs/nfs/localio.c +0
-0@@ -842,7 +842,9 @@ static ssize_t do_nfs_local_call_write(structnfs_local_kiocb *iocb, } else iocb->kiocb.ki_flags &= ~IOCB_DIRECT;fs/nfs/localio.c +0
-1- status = filp->f_op->write_iter(&iocb->kiocb, &iocb-Quoted 1 line
iters[i]);
fs/nfs/localio.c +2
-0+scoped_with_creds (filp->f_cred) + status = filp->f_op->write_iter(&iocb-Quoted 1 line
kiocb, &iocb->iters[i]);
+
if (status !=-EIOCBQUEUED) {
if (unlikely(status >= 0 && status < iocb-Quoted 1 line
iters[i].count))
force_done= true; /* Partial write */fs/nfs/localio.c +0
-0@@ -854,22 +856,6 @@ static ssize_t do_nfs_local_call_write(structnfs_local_kiocb *iocb, } file_end_write(filp);fs/nfs/localio.c +0
-16-return status; -} - -static void nfs_local_call_write (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; -unsigned long old_flags = current->flags; -ssize_t status; - - current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; - -scoped_with_creds (filp->f_cred) - status = do_nfs_local_call_write(iocb, filp); -
Quoted 3 lines
current->flags=old_flags;
}
OK, so what is the easiest way to merge this?
Should I just remove the "old" patch from my tree, and submit that patch directly to [email protected] as a fix for 6.18? That would allow Christian to pick up this (after perhaps removing the stable and Fixes tags above), and submit it as part of his merge, thus fixing the 6.19 kernel.
Thoughts? Preferences?
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected], [email protected]
Trond Myklebust
maintainerRe: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
Quoted 227 lines · Trond Myklebust
Quoted 211 lines · Mike Snitzer
Hi Stephen,
Quoted 15 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the nfs tree got a conflict in:
fs/nfs/localio.cbetween commits:
94afb627dfc2("nfs: use credential guards innfs_local_call_read()")
bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")Quoted 6 lines
from Linus' tree and commit:
30a4385509b4("nfs/localio: fix regression due to out-of-order__put_cred")from the nfs tree.
The NFS tree's commit
30a4385509b4needed to be rebased (taken care of
below), which complicates the 6.18-stable backport (equivalent of the
nfs tree's commit30a4385509b4must be sent to linux-stable@ rather than it being cherry-picked once the below updated fix applied to Linus' tree).Quoted 4 lines
I fixed it up (I just dropped the nfs tree commit) and can carry the
fix as necessary. This is now fixed as far as linux-next is concerned,Quoted 8 lines
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.Trond and Linus,
Here is the fix for 6.19 rebased ontop of Linus' tree:
From: Mike Snitzer <[email protected]>
Date: Wed, 26 Nov 2025 01:01:25 -0500
Subject: [PATCH] nfs/localio: fix regression due to out-of-order__put_credCommit
f2060bdc21d7("nfs/localio: add refcounting for each iocb IO associated with NFS pgio header") inadvertantly reintroduced the same
potential for__put_cred()triggeringBUG_ON(cred == current->cred)that commit992203a1fba5("nfs/localio: restore creds before releasing
pageio data") fixed.Fix this by saving and restoring the cred around each {read,write}_iter
call within the respective for loop of nfs_local_call_{read,write} usingscoped_with_creds().NOTE: this fix started by first reverting the following commits:
94afb627dfc2 ("nfs: use credential guards in
nfs_local_call_read()")
bff3c841f7bd ("nfs: use credential guards innfs_local_call_write()")
1d18101a644e ("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")followed by narrowly fixing the cred lifetime issue by using
scoped_with_creds(). In doing so, this commit's changes appear more extensive than they really are (as evidenced by comparing to v6.18'sfs/nfs/localio.c).Reported-by Zorro Lang <[email protected]>Fixes f2060bdc21d7 ("nfs/localio: add refcounting for each iocb IOassociated with NFS pgio header")
Cc: [email protected] # a custom 6.18-stable backport is requiredSigned-off-by Mike Snitzer <[email protected]>Signed-off-by Trond Myklebust <[email protected]>fs/nfs/localio.c +0
-0@@ -615,8 +615,11 @@ static void nfs_local_read_aio_complete(struct kiocb *kiocb, long ret)
nfs_local_pgio_aio_complete(iocb); /* Callsnfs_local_read_aio_complete_work*/
}
-static voiddo_nfs_local_call_read(struct nfs_local_kiocb *iocb, struct file *filp)
+static voidnfs_local_call_read(struct work_struct *work){fs/nfs/localio.c +3
-0+struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp;bool
force_done= false;
ssize_tstatus;
intn_iters;fs/nfs/localio.c +0
-0@@ -633,7 +636,9 @@ static void do_nfs_local_call_read(struct
nfs_local_kiocb*iocb, struct file *fi
} else
iocb->kiocb.ki_flags&= ~IOCB_DIRECT;fs/nfs/localio.c +0
-1- status = filp->f_op->read_iter(&iocb->kiocb,&iocb-
Quoted 1 line
iters[i]);
fs/nfs/localio.c +2
-0+scoped_with_creds (filp->f_cred) + status = filp->f_op->read_iter(&iocb-Quoted 1 line
kiocb,
&iocb->iters[i]);
+
if (status !=-EIOCBQUEUED) {
if (unlikely(status >= 0 && status < iocb-Quoted 1 line
iters[i].count))
force_done= true; /* Partial read */fs/nfs/localio.c +0
-0@@ -645,16 +650,6 @@ static void do_nfs_local_call_read(struct
nfs_local_kiocb*iocb, struct file *fi
}
}fs/nfs/localio.c +0
-10-static void nfs_local_call_read (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; - - scoped_with_creds(filp->f_cred) -do_nfs_local_call_read (iocb, filp); -} -static int
nfs_local_do_read(structnfs_local_kiocb*iocb, const structrpc_call_ops*call_ops)fs/nfs/localio.c +0
-0@@ -822,13 +817,18 @@ static voidnfs_local_write_aio_complete(struct
kiocb *kiocb, long ret)nfs_local_pgio_aio_complete(iocb); /* Callsnfs_local_write_aio_complete_work*/
}
-staticssize_tdo_nfs_local_call_write(structnfs_local_kiocb*iocb,fs/nfs/localio.c +1
-1- struct file *filp) +static void nfs_local_call_write (struct work_struct *work){
fs/nfs/localio.c +4
-0+struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp; +unsigned long old_flags = current->flags;bool
force_done= false;
ssize_tstatus;
intn_iters;fs/nfs/localio.c +2
-0+ current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; +
file_start_write(filp);
n_iters=atomic_read(&iocb->n_iters);
for (int i = 0; i <n_iters; i++) {fs/nfs/localio.c +0
-0@@ -842,7 +842,9 @@ static ssize_t do_nfs_local_call_write(structnfs_local_kiocb *iocb, } else iocb->kiocb.ki_flags &= ~IOCB_DIRECT;fs/nfs/localio.c +0
-1- status = filp->f_op->write_iter(&iocb->kiocb,&iocb-
Quoted 1 line
iters[i]);
fs/nfs/localio.c +2
-0+scoped_with_creds (filp->f_cred) + status = filp->f_op->write_iter(&iocb-Quoted 1 line
kiocb, &iocb->iters[i]);
+
if (status !=-EIOCBQUEUED) {
if (unlikely(status >= 0 && status < iocb-Quoted 1 line
iters[i].count))
force_done= true; /* Partial write
*/fs/nfs/localio.c +0
-0@@ -854,22 +856,6 @@ static ssize_t do_nfs_local_call_write(structnfs_local_kiocb *iocb, } file_end_write(filp);fs/nfs/localio.c +0
-16-return status; -} - -static void nfs_local_call_write (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; -unsigned long old_flags = current->flags; -ssize_t status; - - current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; - -scoped_with_creds (filp->f_cred) - status = do_nfs_local_call_write(iocb, filp); -Quoted 3 lines
current->flags=old_flags;
}OK, so what is the easiest way to merge this?
Should I just remove the "old" patch from my tree, and submit that patch directly to [email protected] as a fix for 6.18? That would
allow Christian to pick up this (after perhaps removing the stable and
Fixes tags above), and submit it as part of his merge, thus fixing the
6.19 kernel.
Quoted 1 line
Thoughts? Preferences?
Never mind... I see Christian's branch has already been merged (Sorry, I was busy this week).
I'll do as I suggested above, to remove the existing patch and submit the 6.18 stable fix separately, then we can push Mike's 6.19-specific fix into Linus' tree after the merge of the main NFS client branch.
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected], [email protected]
Re: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
In reply to Trond MyklebustQuoted 206 lines · Trond Myklebust
Quoted 199 lines · Mike Snitzer
Hi Stephen,
Quoted 15 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the nfs tree got a conflict in:
fs/nfs/localio.cbetween commits:
94afb627dfc2("nfs: use credential guards innfs_local_call_read()")
bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")Quoted 6 lines
from Linus' tree and commit:
30a4385509b4("nfs/localio: fix regression due to out-of-order__put_cred")from the nfs tree.
The NFS tree's commit
30a4385509b4needed to be rebased (taken care of
below), which complicates the 6.18-stable backport (equivalent of the nfs tree's commit30a4385509b4must be sent to linux-stable@ rather than it being cherry-picked once the below updated fix applied to Linus' tree).Quoted 10 lines
I fixed it up (I just dropped the nfs tree commit) 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.Trond and Linus,
Here is the fix for 6.19 rebased ontop of Linus' tree:
From: Mike Snitzer <[email protected]>
Date: Wed, 26 Nov 2025 01:01:25 -0500
Subject: [PATCH] nfs/localio: fix regression due to out-of-order__put_credCommit
f2060bdc21d7("nfs/localio: add refcounting for each iocb IO associated with NFS pgio header") inadvertantly reintroduced the same potential for__put_cred()triggeringBUG_ON(cred == current->cred)that commit992203a1fba5("nfs/localio: restore creds before releasing
pageio data") fixed.Fix this by saving and restoring the cred around each {read,write}_iter
call within the respective for loop of nfs_local_call_{read,write} usingscoped_with_creds().NOTE: this fix started by first reverting the following commits:
94afb627dfc2 ("nfs: use credential guards in
nfs_local_call_read()")bff3c841f7bd("nfs: use credential guards innfs_local_call_write()")
1d18101a644e ("Merge tag 'kernel-6.19-rc1.cred' ofgit://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")followed by narrowly fixing the cred lifetime issue by using
scoped_with_creds(). In doing so, this commit's changes appear more extensive than they really are (as evidenced by comparing to v6.18'sfs/nfs/localio.c).Reported-by Zorro Lang <[email protected]>Fixes f2060bdc21d7 ("nfs/localio: add refcounting for each iocb IOassociated with NFS pgio header")
Cc: [email protected] # a custom 6.18-stable backport is requiredSigned-off-by Mike Snitzer <[email protected]>Signed-off-by Trond Myklebust <[email protected]>fs/nfs/localio.c +0
-0@@ -615,8 +615,11 @@ static void nfs_local_read_aio_complete(struct kiocb *kiocb, long ret)
nfs_local_pgio_aio_complete(iocb); /* Callsnfs_local_read_aio_complete_work*/
}
-static voiddo_nfs_local_call_read(struct nfs_local_kiocb *iocb, struct file *filp)
+static voidnfs_local_call_read(struct work_struct *work){fs/nfs/localio.c +3
-0+struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp;bool
force_done= false;
ssize_tstatus;
intn_iters;fs/nfs/localio.c +0
-0@@ -633,7 +636,9 @@ static void do_nfs_local_call_read(struct
nfs_local_kiocb*iocb, struct file *fi
} else
iocb->kiocb.ki_flags&= ~IOCB_DIRECT;fs/nfs/localio.c +0
-1- status = filp->f_op->read_iter(&iocb->kiocb, &iocb-Quoted 1 line
iters[i]);
fs/nfs/localio.c +2
-0+scoped_with_creds (filp->f_cred) + status = filp->f_op->read_iter(&iocb->kiocb,&iocb->iters[i]);
+
if (status !=-EIOCBQUEUED) {
if (unlikely(status >= 0 && status < iocb-Quoted 1 line
iters[i].count))
force_done= true; /* Partial read */fs/nfs/localio.c +0
-0@@ -645,16 +650,6 @@ static void do_nfs_local_call_read(struct
nfs_local_kiocb*iocb, struct file *fi
}
}fs/nfs/localio.c +0
-10-static void nfs_local_call_read (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; - - scoped_with_creds(filp->f_cred) -do_nfs_local_call_read (iocb, filp); -} -static int
nfs_local_do_read(structnfs_local_kiocb*iocb, const structrpc_call_ops*call_ops)fs/nfs/localio.c +0
-0@@ -822,13 +817,18 @@ static void nfs_local_write_aio_complete(struct kiocb *kiocb, long ret)
nfs_local_pgio_aio_complete(iocb); /* Callsnfs_local_write_aio_complete_work*/
}fs/nfs/localio.c +1
-2-static ssize_t do_nfs_local_call_write (struct nfs_local_kiocb *iocb, - struct file *filp) +static void nfs_local_call_write (struct work_struct *work){
fs/nfs/localio.c +4
-0+struct nfs_local_kiocb *iocb = + container_of(work, struct nfs_local_kiocb, work); +struct file *filp = iocb->kiocb.ki_filp; +unsigned long old_flags = current->flags;bool
force_done= false;
ssize_tstatus;
intn_iters;fs/nfs/localio.c +2
-0+ current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; +
file_start_write(filp);
n_iters=atomic_read(&iocb->n_iters);
for (int i = 0; i <n_iters; i++) {fs/nfs/localio.c +0
-0@@ -842,7 +842,9 @@ static ssize_t do_nfs_local_call_write(structnfs_local_kiocb *iocb, } else iocb->kiocb.ki_flags &= ~IOCB_DIRECT;fs/nfs/localio.c +0
-1- status = filp->f_op->write_iter(&iocb->kiocb, &iocb-Quoted 1 line
iters[i]);
fs/nfs/localio.c +2
-0+scoped_with_creds (filp->f_cred) + status = filp->f_op->write_iter(&iocb-Quoted 1 line
kiocb, &iocb->iters[i]);
+
if (status !=-EIOCBQUEUED) {
if (unlikely(status >= 0 && status < iocb-Quoted 1 line
iters[i].count))
force_done= true; /* Partial write */fs/nfs/localio.c +0
-0@@ -854,22 +856,6 @@ static ssize_t do_nfs_local_call_write(structnfs_local_kiocb *iocb, } file_end_write(filp);fs/nfs/localio.c +0
-16-return status; -} - -static void nfs_local_call_write (struct work_struct *work) -{ -struct nfs_local_kiocb *iocb = - container_of(work, struct nfs_local_kiocb, work); -struct file *filp = iocb->kiocb.ki_filp; -unsigned long old_flags = current->flags; -ssize_t status; - - current->flags |=PF_LOCAL_THROTTLE |PF_MEMALLOC_NOIO ; - -scoped_with_creds (filp->f_cred) - status = do_nfs_local_call_write(iocb, filp); -Quoted 3 lines
current->flags=old_flags;
}OK, so what is the easiest way to merge this?
Quoted 2 lines
Should I just remove the "old" patch from my tree, and submit that patch directly to [email protected] as a fix for 6.18?
Yes, that will need to happen no matter what.
Quoted 5 lines
That would allow Christian to pick up this (after perhaps removing the stable and Fixes tags above), and submit it as part of his merge, thus fixing the 6.19 kernel.
Thoughts? Preferences?
Christian already sent his merge, at the top you'll see Stephen referenced commits that are in Linus' tree. Those are the commits I referenced in the above updated patch's header as having reverted.
Maybe you prepare a 2nd post-merge NFS client pull that is based on tip of Linus' tree with only my patch applied? (after adjusting tags like you suggested).
Or Linus picks up my patch directly but first adjusts its tags?
Christian provided his Reviewed-by earlier today, if Linus were to pick it up you'd do well to first provide your Reviewed-by: (which would replace the Signed-off-by I mistakenly left attributed to you in the updated patch).
However you all decide to skin this cat: sorry for the trouble!
Thanks,
Mike
Re: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
Quoted 2 lines · Mike Snitzer
Or Linus picks up my patch directly but first adjusts its tags?
Let me do that once I finish my "merge various architecture updates". I'm almost done with that side - just one more SoC pull to go, I htink
- and can go back to looking at filesystem changes.
Linus
Re: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
Quoted 4 lines · Linus Torvalds
Let me do that once I finish my "merge various architecture updates". I'm almost done with that side - just one more SoC pull to go, I think
- and can go back to looking at filesystem changes.
Ok, done and pushed out. Can you please verify that the current git tree looks like you expected?
Linus
Re: [6.19 PATCH] nfs/localio: fix regression due to out-of-order __put_cred [was: Re: linux-next: manual merge of the nfs tree with Linus' tree]
Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Linus Torvalds
Let me do that once I finish my "merge various architecture updates". I'm almost done with that side - just one more SoC pull to go, I think
- and can go back to looking at filesystem changes.Ok, done and pushed out. Can you please verify that the current git tree looks like you expected?
Looks good. Thanks