common/nfs: add FSX_AVOID when testing on NFS
diff mbox series

Message ID 20181229085304.4310-1-xzhou@redhat.com
State New
Headers show
Series
  • common/nfs: add FSX_AVOID when testing on NFS
Related show

Commit Message

Xiong Murphy Zhou Dec. 29, 2018, 8:53 a.m. UTC
copy_file_range on NFSv4.2 requires that src offset and dest offset
are aligned with server blocksize. So does copy count, except that
after this copy, we'll reach the EOF. See Linux commit 811b7b85.

ltp/fsx.c tests copy_file_range on random offset with random size
by default. This makes these tests get EINVAL on NFS.

Signed-off-by: Xiong Murphy Zhou <xzhou@redhat.com>
---
 common/nfs | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Darrick J. Wong Dec. 29, 2018, 7:01 p.m. UTC | #1
On Sat, Dec 29, 2018 at 04:53:04PM +0800, Xiong Murphy Zhou wrote:
> copy_file_range on NFSv4.2 requires that src offset and dest offset
> are aligned with server blocksize. So does copy count, except that
> after this copy, we'll reach the EOF. See Linux commit 811b7b85.
> 
> ltp/fsx.c tests copy_file_range on random offset with random size
> by default. This makes these tests get EINVAL on NFS.
> 
> Signed-off-by: Xiong Murphy Zhou <xzhou@redhat.com>
> ---
>  common/nfs | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/common/nfs b/common/nfs
> index a03eaf48..5600147d 100644
> --- a/common/nfs
> +++ b/common/nfs
> @@ -33,3 +33,12 @@ _require_scratch_nfs_version()
>  	fi
>  	_scratch_unmount
>  }
> +
> +# copy_file_range on NFSv4.2 requires src offset and dest offset
> +# are aligned with server blocksize. So does copy count, except that
> +# after this copy, we'll reach the EOF. See Linux commit 811b7b85
> +# for details.
> +# ltp/fsx.c tests copy_file_range on random offset with random size
> +# by default. This makes these tests get EINVAL on NFS.

I think it's more appropriate to fix the vfs copy_file_range to fall
back to page cache copy when the nfs server declines to do it.

And, since we already know Dave Chinner is working on that, just wait
for the v2 patches.

> +# Now add FSX_AVOID to make fsx tests on NFS rational.
> +FSX_AVOID="-r 4096 -w 4096 -O -o 4096 -Z $FSX_AVOID"

How do you know the server blocksize is 4k?

Also, this forces /every/ fsx operation to be page aligned directio, I
don't think we want to apply such a big hammer.

--D

> 2.17.0.252.gfe0a9ea
>
Xiong Murphy Zhou Dec. 30, 2018, 3:01 p.m. UTC | #2
On Sat, Dec 29, 2018 at 11:01:17AM -0800, Darrick J. Wong wrote:
> On Sat, Dec 29, 2018 at 04:53:04PM +0800, Xiong Murphy Zhou wrote:
> > copy_file_range on NFSv4.2 requires that src offset and dest offset
> > are aligned with server blocksize. So does copy count, except that
> > after this copy, we'll reach the EOF. See Linux commit 811b7b85.
> > 
> > ltp/fsx.c tests copy_file_range on random offset with random size
> > by default. This makes these tests get EINVAL on NFS.
> > 
> > Signed-off-by: Xiong Murphy Zhou <xzhou@redhat.com>
> > ---
> >  common/nfs | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/common/nfs b/common/nfs
> > index a03eaf48..5600147d 100644
> > --- a/common/nfs
> > +++ b/common/nfs
> > @@ -33,3 +33,12 @@ _require_scratch_nfs_version()
> >  	fi
> >  	_scratch_unmount
> >  }
> > +
> > +# copy_file_range on NFSv4.2 requires src offset and dest offset
> > +# are aligned with server blocksize. So does copy count, except that
> > +# after this copy, we'll reach the EOF. See Linux commit 811b7b85
> > +# for details.
> > +# ltp/fsx.c tests copy_file_range on random offset with random size
> > +# by default. This makes these tests get EINVAL on NFS.
> 
> I think it's more appropriate to fix the vfs copy_file_range to fall
> back to page cache copy when the nfs server declines to do it.
> 
> And, since we already know Dave Chinner is working on that, just wait
> for the v2 patches.

Great to know that! Thanks for the info!

> 
> > +# Now add FSX_AVOID to make fsx tests on NFS rational.
> > +FSX_AVOID="-r 4096 -w 4096 -O -o 4096 -Z $FSX_AVOID"
> 
> How do you know the server blocksize is 4k?

Ha, I don't know. Very good point. :)

> 
> Also, this forces /every/ fsx operation to be page aligned directio, I
> don't think we want to apply such a big hammer.

Adding -Z was to make the IO size aligned with readbdy. O_DIRECT is not
necessary here. I just found -Z can do that for me. Maybe we need another
option to archive this:
	if (some_option)
		size -= size % readbdy;
in ltp/fsx.c

Thanks for the reviewing!

Xiong
> 
> --D
> 
> > 2.17.0.252.gfe0a9ea
> >

Patch
diff mbox series

diff --git a/common/nfs b/common/nfs
index a03eaf48..5600147d 100644
--- a/common/nfs
+++ b/common/nfs
@@ -33,3 +33,12 @@  _require_scratch_nfs_version()
 	fi
 	_scratch_unmount
 }
+
+# copy_file_range on NFSv4.2 requires src offset and dest offset
+# are aligned with server blocksize. So does copy count, except that
+# after this copy, we'll reach the EOF. See Linux commit 811b7b85
+# for details.
+# ltp/fsx.c tests copy_file_range on random offset with random size
+# by default. This makes these tests get EINVAL on NFS.
+# Now add FSX_AVOID to make fsx tests on NFS rational.
+FSX_AVOID="-r 4096 -w 4096 -O -o 4096 -Z $FSX_AVOID"