Re: [PATCH 09/11] vfs: push copy_file_ranges -EXDEV checks down

Dave Chinner
2018-12-03T23:41:47Z

On Mon, Dec 03, 2018 at 01:53:35PM -0500, Anna Schumaker wrote:
> On Mon, 2018-12-03 at 19:34 +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > We want to enable cross-filesystem copy_file_range functionality
> > where possible, so push the "same superblock only" checks down to
> > the individual filesystem callouts so they can make their own
> > decisions about cross-superblock copy offload.
....
> > diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
> > index d7766a6eb0f4..4783c0c1c49e 100644
> > --- a/fs/nfs/nfs4file.c
> > +++ b/fs/nfs/nfs4file.c
> > @@ -133,16 +133,20 @@ static ssize_t nfs4_copy_file_range(struct file
> > *file_in, loff_t pos_in,
> > struct file *file_out, loff_t pos_out,
> > size_t count, unsigned int flags)
> > {
> > - ssize_t ret;
> > + ssize_t ret = -EXDEV;
> >
> > if (file_inode(file_in) == file_inode(file_out))
> > return -EINVAL;
> > -retry:
> > - ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count);
> > - if (ret == -EAGAIN)
> > - goto retry;
> >
> > - if (ret == -EOPNOTSUPP)
> > + /* only offload copy if superblock is the same */
> > + if (file_inode(file_in)->i_sb == file_inode(file_out)->i_sb) {
> > + do {
> > + ret = nfs42_proc_copy(file_in, pos_in, file_out,
> > + pos_out, count);
> > + } while (ret == -EAGAIN);
>
> I'm not convinced we can actually return -EAGAIN from nfs42_proc_copy(). The
> nfs_get_lock_context() function doesn't return it, and if _nfs42_proc_copy()
> returns -EAGAIN it's immediately retried by nfs42_proc_copy() instead of
> returning.

Not really my concern, nor something that should be fixed in this
patchset. i.e. the function does the same thing before and after
this patch, so whether EAGAIN can occurr or not is irrelevant to
this patchset....

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com