public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* linux-next: manual merge of the vfs-brauner tree with the nfs-anna tree
@ 2025-01-08 21:45 Stephen Rothwell
  2025-01-20 23:33 ` Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2025-01-08 21:45 UTC (permalink / raw)
  To: Christian Brauner, Anna Schumaker, Trond Myklebust
  Cc: NFS Mailing List, Anna Schumaker, Linux Kernel Mailing List,
	Linux Next Mailing List, Mike Snitzer

[-- Attachment #1: Type: text/plain, Size: 1318 bytes --]

Hi all,

Today's linux-next merge of the vfs-brauner tree got a conflict in:

  fs/nfsd/filecache.c

between commit:

  735aab1241ea ("nfsd: nfsd_file_acquire_local no longer returns GC'd nfsd_file")

from the nfs-anna tree and commits:

  f905e00904cc ("tree-wide: s/revert_creds()/put_cred(revert_creds_light())/g")
  51c0bcf0973a ("tree-wide: s/revert_creds_light()/revert_creds()/g")

from the vfs-brauner 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.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/nfsd/filecache.c
index 2adf95e2b379,dc5c9d8e8202..000000000000
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@@ -1255,8 -1247,8 +1255,8 @@@ nfsd_file_acquire_local(struct net *net
  	__be32 beres;
  
  	beres = nfsd_file_do_acquire(NULL, net, cred, client,
 -				     fhp, may_flags, NULL, pnf, true);
 +				     fhp, may_flags, NULL, pnf, false);
- 	revert_creds(save_cred);
+ 	put_cred(revert_creds(save_cred));
  	return beres;
  }
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: linux-next: manual merge of the vfs-brauner tree with the nfs-anna tree
  2025-01-08 21:45 Stephen Rothwell
@ 2025-01-20 23:33 ` Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2025-01-20 23:33 UTC (permalink / raw)
  To: Anna Schumaker, Trond Myklebust
  Cc: Christian Brauner, NFS Mailing List, Anna Schumaker,
	Linux Kernel Mailing List, Linux Next Mailing List, Mike Snitzer

[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]

Hi all,

On Thu, 9 Jan 2025 08:45:03 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the vfs-brauner tree got a conflict in:
> 
>   fs/nfsd/filecache.c
> 
> between commit:
> 
>   735aab1241ea ("nfsd: nfsd_file_acquire_local no longer returns GC'd nfsd_file")
> 
> from the nfs-anna tree and commits:
> 
>   f905e00904cc ("tree-wide: s/revert_creds()/put_cred(revert_creds_light())/g")
>   51c0bcf0973a ("tree-wide: s/revert_creds_light()/revert_creds()/g")
> 
> from the vfs-brauner 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.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc fs/nfsd/filecache.c
> index 2adf95e2b379,dc5c9d8e8202..000000000000
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@@ -1255,8 -1247,8 +1255,8 @@@ nfsd_file_acquire_local(struct net *net
>   	__be32 beres;
>   
>   	beres = nfsd_file_do_acquire(NULL, net, cred, client,
>  -				     fhp, may_flags, NULL, pnf, true);
>  +				     fhp, may_flags, NULL, pnf, false);
> - 	revert_creds(save_cred);
> + 	put_cred(revert_creds(save_cred));
>   	return beres;
>   }
>   

This is now a conflict between the nfs-anna tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* linux-next: manual merge of the vfs-brauner tree with the nfs-anna tree
@ 2025-11-10 23:38 Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2025-11-10 23:38 UTC (permalink / raw)
  To: Christian Brauner, Anna Schumaker, Trond Myklebust
  Cc: Anna Schumaker, Mike Snitzer, NFS Mailing List,
	Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 7260 bytes --]

Hi all,

Today's linux-next merge of the vfs-brauner tree got a conflict in:

  fs/nfs/localio.c

between commits:

  51a491f2708d ("nfs/localio: remove unecessary ENOTBLK handling in DIO WRITE support")
  f2060bdc21d7 ("nfs/localio: add refcounting for each iocb IO associated with NFS pgio header")
  d0497dd27452 ("nfs/localio: backfill missing partial read support for misaligned DIO")
  6a218b9c3183 ("nfs/localio: do not issue misaligned DIO out-of-order")

from the nfs-anna tree and commit:

  94afb627dfc2 ("nfs: use credential guards in nfs_local_call_read()")

from the vfs-brauner tree.

I fixed it up (I think - 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.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/nfs/localio.c
index 656976b4f42c,0c89a9d1e089..000000000000
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@@ -620,37 -595,30 +620,34 @@@ static void nfs_local_call_read(struct 
  	struct nfs_local_kiocb *iocb =
  		container_of(work, struct nfs_local_kiocb, work);
  	struct file *filp = iocb->kiocb.ki_filp;
- 	const struct cred *save_cred;
 +	bool force_done = false;
  	ssize_t status;
 +	int n_iters;
  
- 	save_cred = override_creds(filp->f_cred);
+ 	scoped_with_creds(filp->f_cred) {
 -		for (int i = 0; i < iocb->n_iters ; i++) {
++		n_iters = atomic_read(&iocb->n_iters);
++		for (int i = 0; i < n_iters ; i++) {
+ 			if (iocb->iter_is_dio_aligned[i]) {
+ 				iocb->kiocb.ki_flags |= IOCB_DIRECT;
 -				iocb->kiocb.ki_complete = nfs_local_read_aio_complete;
 -				iocb->aio_complete_work = nfs_local_read_aio_complete_work;
 -			}
++				/* Only use AIO completion if DIO-aligned segment is last */
++				if (i == iocb->end_iter_index) {
++					iocb->kiocb.ki_complete = nfs_local_read_aio_complete;
++					iocb->aio_complete_work = nfs_local_read_aio_complete_work;
++				}
++			} else
++				iocb->kiocb.ki_flags &= ~IOCB_DIRECT;
  
- 	n_iters = atomic_read(&iocb->n_iters);
- 	for (int i = 0; i < n_iters ; i++) {
- 		if (iocb->iter_is_dio_aligned[i]) {
- 			iocb->kiocb.ki_flags |= IOCB_DIRECT;
- 			/* Only use AIO completion if DIO-aligned segment is last */
- 			if (i == iocb->end_iter_index) {
- 				iocb->kiocb.ki_complete = nfs_local_read_aio_complete;
- 				iocb->aio_complete_work = nfs_local_read_aio_complete_work;
- 			}
- 		} else
- 			iocb->kiocb.ki_flags &= ~IOCB_DIRECT;
- 
- 		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 */
- 			if (nfs_local_pgio_done(iocb, status, force_done)) {
- 				nfs_local_read_iocb_done(iocb);
- 				break;
 -			iocb->kiocb.ki_pos = iocb->offset[i];
+ 			status = filp->f_op->read_iter(&iocb->kiocb, &iocb->iters[i]);
+ 			if (status != -EIOCBQUEUED) {
 -				nfs_local_pgio_done(iocb->hdr, status);
 -				if (iocb->hdr->task.tk_status)
++				if (unlikely(status >= 0 && status < iocb->iters[i].count))
++					force_done = true; /* Partial read */
++				if (nfs_local_pgio_done(iocb, status, force_done)) {
++					nfs_local_read_iocb_done(iocb);
+ 					break;
++				}
  			}
  		}
  	}
--
- 	revert_creds(save_cred);
 -	if (status != -EIOCBQUEUED) {
 -		nfs_local_read_done(iocb, status);
 -		nfs_local_pgio_release(iocb);
 -	}
  }
  
  static int
@@@ -820,47 -781,78 +817,55 @@@ static void nfs_local_write_aio_complet
  	nfs_local_pgio_aio_complete(iocb); /* Calls nfs_local_write_aio_complete_work */
  }
  
- static void nfs_local_call_write(struct work_struct *work)
+ static ssize_t do_nfs_local_call_write(struct nfs_local_kiocb *iocb,
+ 				       struct file *filp)
  {
- 	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;
- 	const struct cred *save_cred;
 +	bool force_done = false;
  	ssize_t status;
 +	int n_iters;
  
- 	current->flags |= PF_LOCAL_THROTTLE | PF_MEMALLOC_NOIO;
- 	save_cred = override_creds(filp->f_cred);
- 
  	file_start_write(filp);
 -	for (int i = 0; i < iocb->n_iters ; i++) {
 +	n_iters = atomic_read(&iocb->n_iters);
 +	for (int i = 0; i < n_iters ; i++) {
  		if (iocb->iter_is_dio_aligned[i]) {
  			iocb->kiocb.ki_flags |= IOCB_DIRECT;
 -			iocb->kiocb.ki_complete = nfs_local_write_aio_complete;
 -			iocb->aio_complete_work = nfs_local_write_aio_complete_work;
 -		}
 -retry:
 -		iocb->kiocb.ki_pos = iocb->offset[i];
 +			/* Only use AIO completion if DIO-aligned segment is last */
 +			if (i == iocb->end_iter_index) {
 +				iocb->kiocb.ki_complete = nfs_local_write_aio_complete;
 +				iocb->aio_complete_work = nfs_local_write_aio_complete_work;
 +			}
 +		} else
 +			iocb->kiocb.ki_flags &= ~IOCB_DIRECT;
 +
  		status = filp->f_op->write_iter(&iocb->kiocb, &iocb->iters[i]);
  		if (status != -EIOCBQUEUED) {
 -			if (unlikely(status >= 0 && status < iocb->iters[i].count)) {
 -				/* partial write */
 -				if (i == iocb->end_iter_index) {
 -					/* Must not account partial end, otherwise, due
 -					 * to end being issued before middle: the partial
 -					 * write accounting in nfs_local_write_done()
 -					 * would incorrectly advance hdr->args.offset
 -					 */
 -					status = 0;
 -				} else {
 -					/* Partial write at start or buffered middle,
 -					 * exit early.
 -					 */
 -					nfs_local_pgio_done(iocb->hdr, status);
 -					break;
 -				}
 -			} else if (unlikely(status == -ENOTBLK &&
 -					    (iocb->kiocb.ki_flags & IOCB_DIRECT))) {
 -				/* VFS will return -ENOTBLK if DIO WRITE fails to
 -				 * invalidate the page cache. Retry using buffered IO.
 -				 */
 -				iocb->kiocb.ki_flags &= ~IOCB_DIRECT;
 -				iocb->kiocb.ki_complete = NULL;
 -				iocb->aio_complete_work = NULL;
 -				goto retry;
 -			}
 -			nfs_local_pgio_done(iocb->hdr, status);
 -			if (iocb->hdr->task.tk_status)
 +			if (unlikely(status >= 0 && status < iocb->iters[i].count))
 +				force_done = true; /* Partial write */
 +			if (nfs_local_pgio_done(iocb, status, force_done)) {
 +				nfs_local_write_iocb_done(iocb);
  				break;
 +			}
  		}
  	}
  	file_end_write(filp);
  
- 	revert_creds(save_cred);
+ 	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;
 -
 -	if (status != -EIOCBQUEUED) {
 -		nfs_local_write_done(iocb, status);
 -		nfs_local_vfs_getattr(iocb);
 -		nfs_local_pgio_release(iocb);
 -	}
  }
  
  static int

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-10 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 23:38 linux-next: manual merge of the vfs-brauner tree with the nfs-anna tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2025-01-08 21:45 Stephen Rothwell
2025-01-20 23:33 ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox