Add copy_file_range() tests
Subsystems (2)
PATCH v4 1/5 generic/392: Add copy to new file test
In reply to Anna SchumakerThis test copies data from various points in a source file to a new file. This is useful for testing the basics of copy_file_range().
--- common/rc | 6 +++ tests/generic/392 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/392.out | 26 +++++++++++++ tests/generic/group | 1 + 4 files changed, 135 insertions(+) create mode 100755 tests/generic/392 create mode 100644 tests/generic/392.out
common/rc +6 -0
@@ -2054,6 +2054,12 @@ _require_xfs_io_command() "chproj") testio=`$XFS_IO_PROG -F -f -c "chproj 0" $testfile 2>&1` ;; + "copy_range") + testcopy=$TEST_DIR/$$.copy.xfs_io + $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile 2>&1 > /dev/null + testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` + rm -f $testcopy 2>&1 > /dev/null + ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1` ;;
tests/generic/392 new file +102 -0
102 lines not on this page · raw message
tests/generic/392.out new file +26 -0
@@ -0,0 +1,26 @@ +QA output created by 392 +Create the original file and then copy +Original md5sums: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-392/file +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-392/copy +Copy beginning of original file +md5sums after copying beginning: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-392/file +cabe45dcc9ae5b66ba86600cca6b8ba8 TEST_DIR/test-392/beginning +Copy middle of original file +md5sums after copying middle: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-392/file +4197de9da5badfc302715486b82bcdf1 TEST_DIR/test-392/middle +Copy end of original file +md5sums after copying end: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-392/file +e68d4a150c4e42f4f9ea3ffe4c9cf4ed TEST_DIR/test-392/end +Copy beyond end of original file +copy_range: Invalid argument +md5sums after copying beyond: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-392/file +e68d4a150c4e42f4f9ea3ffe4c9cf4ed TEST_DIR/test-392/beyond +Copy creates hole in target file +md5sums after creating hole: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-392/file +3ae9aef0992f8cb51c90c9a0ff2dd9d2 TEST_DIR/test-392/hole
tests/generic/group +1 -0
@@ -394,3 +394,4 @@ 389 auto quick acl 390 auto freeze stress dangerous 391 auto quick rw +392 auto quick copy
Signature · 1 line
2.10.2
PATCH v4 2/5 generic/393: Add small copies to new file test
In reply to Anna SchumakerThis test copies single bytes from a source file into various new files just to make sure that we can handle very small copies.
--- tests/generic/393 | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/393.out | 16 ++++++++++ tests/generic/group | 1 + 3 files changed, 100 insertions(+) create mode 100755 tests/generic/393 create mode 100644 tests/generic/393.out
tests/generic/393 new file +83 -0
@@ -0,0 +1,83 @@ +#!/bin/bash +# FS QA Test No. 393 +# +# Tests vfs_copy_file_range(): +# - Copy a small file +# - Small copies from various points in the original file +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file and then copy" +echo -n "abcde" > $testdir/file +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" +echo -n "abcde" | cmp $testdir/copy +echo "Original md5sums:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Small copies from various points in the original file" +$XFS_IO_PROG -f -c "copy_range -s 0 -l 1 $testdir/file" "$testdir/a" +$XFS_IO_PROG -f -c "copy_range -s 1 -l 1 $testdir/file" "$testdir/b" +$XFS_IO_PROG -f -c "copy_range -s 2 -l 1 $testdir/file" "$testdir/c" +$XFS_IO_PROG -f -c "copy_range -s 3 -l 1 $testdir/file" "$testdir/d" +$XFS_IO_PROG -f -c "copy_range -s 4 -l 1 $testdir/file" "$testdir/e" +$XFS_IO_PROG -f -c "copy_range -s 4 -l 1 -d 1 $testdir/file" "$testdir/f" +$XFS_IO_PROG -f -c "copy_range -s 5 -l 1 $testdir/file" "$testdir/g" +echo -n "a" | cmp $testdir/a +echo -n "b" | cmp $testdir/b +echo -n "c" | cmp $testdir/c +echo -n "d" | cmp $testdir/d +echo -n "e" | cmp $testdir/e +echo -en "\0e" | cmp $testdir/f +echo -n "" | cmp $testdir/g +echo "md5sums after small copies" +md5sum $testdir/{file,a,b,c,d,e,f,g} | _filter_test_dir + +#success, all done +status=0 +exit
tests/generic/393.out new file +16 -0
@@ -0,0 +1,16 @@ +QA output created by 393 +Create the original file and then copy +Original md5sums: +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-393/file +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-393/copy +Small copies from various points in the original file +copy_range: Invalid argument +md5sums after small copies +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-393/file +0cc175b9c0f1b6a831c399e269772661 TEST_DIR/test-393/a +92eb5ffee6ae2fec3ad71c777531578f TEST_DIR/test-393/b +4a8a08f09d37b73795649038408b5f33 TEST_DIR/test-393/c +8277e0910d750195b448797616e091ad TEST_DIR/test-393/d +e1671797c52e15f763380b45e841ec32 TEST_DIR/test-393/e +2015eb238d706eceefc784742928054f TEST_DIR/test-393/f +d41d8cd98f00b204e9800998ecf8427e TEST_DIR/test-393/g
tests/generic/group +1 -0
@@ -395,3 +395,4 @@ 390 auto freeze stress dangerous 391 auto quick rw 392 auto quick copy +393 auto quick copy
Signature · 1 line
2.10.2
PATCH v4 3/5 generic/394: Add copy test that overwrites data
In reply to Anna SchumakerUsing copy to overwrite data in the destination file is perfectly valid, so let's make sure this case works as expected.
--- tests/generic/394 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/394.out | 17 +++++++++ tests/generic/group | 1 + 3 files changed, 118 insertions(+) create mode 100755 tests/generic/394 create mode 100644 tests/generic/394.out
tests/generic/394 new file +100 -0
@@ -0,0 +1,100 @@ +#!/bin/bash +# FS QA Test No. 394 +# +# Tests vfs_copy_file_range(): +# - Copy a file +# - Use copy to swap data at beginning and end +# - Use copy to swap data in the middle +# - Use copy to simultaneously overwrite and append to destination file +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file and then copy" +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" +cmp $testdir/file $testdir/copy +echo "Original md5sums:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Swap beginning and end of original file" +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/copy" +$XFS_IO_PROG -f -c "copy_range -d 4000 -l 1000 $testdir/file" "$testdir/copy" +cmp -n 1000 $testdir/file $testdir/copy 4000 +cmp -n 3000 $testdir/file $testdir/copy 1000 1000 +cmp -n 1000 $testdir/file $testdir/copy 0 4000 +echo "md5sums after swapping beginning and end:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Swap middle parts of original file" +$XFS_IO_PROG -f -c "copy_range -s 1000 -d 3000 -l 1000 $testdir/file" "$testdir/copy" +$XFS_IO_PROG -f -c "copy_range -s 3000 -d 1000 -l 1000 $testdir/file" "$testdir/copy" +cmp -n 1000 $testdir/file $testdir/copy 4000 +cmp -n 1000 $testdir/file $testdir/copy 3000 1000 +cmp -n 1000 $testdir/file $testdir/copy 2000 2000 +cmp -n 1000 $testdir/file $testdir/copy 1000 3000 +cmp -n 1000 $testdir/file $testdir/copy 0 4000 +echo "md5sums after swapping middle:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Copy tail of original file onto copy" +$XFS_IO_PROG -f -c "copy_range -s 1000 -d 3000 -l 4000 $testdir/file" "$testdir/copy" +cmp -n 1000 $testdir/file $testdir/copy 4000 +cmp -n 1000 $testdir/file $testdir/copy 3000 1000 +cmp -n 1000 $testdir/file $testdir/copy 2000 2000 +cmp -n 4000 $testdir/file $testdir/copy 1000 3000 +echo "md5sums after copying tail:" +md5sum $testdir/{file,copy} | _filter_test_dir + +#success, all done +status=0 +exit
tests/generic/394.out new file +17 -0
@@ -0,0 +1,17 @@ +QA output created by 394 +Create the original file and then copy +Original md5sums: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-394/file +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-394/copy +Swap beginning and end of original file +md5sums after swapping beginning and end: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-394/file +5f4e111811dd9a810143c9db9bec6d80 TEST_DIR/test-394/copy +Swap middle parts of original file +md5sums after swapping middle: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-394/file +8c81889a5a50b311197110bcf769a695 TEST_DIR/test-394/copy +Copy tail of original file onto copy +md5sums after copying tail: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-394/file +e5fbacd993eaa5e80ebc2b14b969887d TEST_DIR/test-394/copy
tests/generic/group +1 -0
@@ -396,3 +396,4 @@ 391 auto quick rw 392 auto quick copy 393 auto quick copy +394 auto quick copy
Signature · 1 line
2.10.2
PATCH v4 4/5 generic/395: Add a copy test for overwriting small amounts of data
In reply to Anna SchumakerThis test is similar to 345, except that it copies one byte at a time to make sure that this case works as expected.
--- tests/generic/395 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/395.out | 17 ++++++++++ tests/generic/group | 1 + 3 files changed, 105 insertions(+) create mode 100755 tests/generic/395 create mode 100644 tests/generic/395.out
tests/generic/395 new file +87 -0
@@ -0,0 +1,87 @@ +#!/bin/bash +# FS QA Test No. 395 +# +# Tests vfs_copy_file_range(): +# - Copy a small file +# - Use copy to swap data at beginning and end +# - Use copy to swap data in the middle +# - Use copy to swap data in a small file +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file and then copy" +echo -n "abcde" > $testdir/file +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" +cmp $testdir/file $testdir/copy +echo "Original md5sums:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Swap beginning and end of original file" +$XFS_IO_PROG -f -c "copy_range -s 0 -d 4 -l 1 $testdir/file" "$testdir/copy" +$XFS_IO_PROG -f -c "copy_range -s 4 -d 0 -l 1 $testdir/file" "$testdir/copy" +echo -n "ebcda" | cmp $testdir/copy +echo "md5sums after swapping beginning and end:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Swap middle parts of original file" +$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 1 $testdir/file" "$testdir/copy" +$XFS_IO_PROG -f -c "copy_range -s 3 -d 1 -l 1 $testdir/file" "$testdir/copy" +echo -n "edcba" | cmp $testdir/copy +echo "md5sums after swapping middle:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Copy tail of original file onto copy" +$XFS_IO_PROG -f -c "copy_range -s 1 -d 3 -l 4 $testdir/file" "$testdir/copy" +echo -n "edcbcde" | cmp $testdir/copy +echo "md5sums after copying tail:" +md5sum $testdir/{file,copy} | _filter_test_dir + +#success, all done +status=0 +exit
tests/generic/395.out new file +17 -0
@@ -0,0 +1,17 @@ +QA output created by 395 +Create the original file and then copy +Original md5sums: +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-395/file +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-395/copy +Swap beginning and end of original file +md5sums after swapping beginning and end: +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-395/file +32db1f6d06d15f7e38e1ab1c69da498a TEST_DIR/test-395/copy +Swap middle parts of original file +md5sums after swapping middle: +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-395/file +295228f3d82d344bbcf2f0030519c2ea TEST_DIR/test-395/copy +Copy tail of original file onto copy +md5sums after copying tail: +ab56b4d92b40713acc5af89985d4b786 TEST_DIR/test-395/file +0c4aac952f72fa078e2f8419aca70b28 TEST_DIR/test-395/copy
tests/generic/group +1 -0
@@ -397,3 +397,4 @@ 392 auto quick copy 393 auto quick copy 394 auto quick copy +395 auto quick copy
Signature · 1 line
2.10.2
PATCH v4 5/5 generic/396: Add a copy test for invalid input
In reply to Anna SchumakerThis test passes invalid argumnt combinations to the copy_file_range() system call to test that input is verified before attempting to copy.
--- tests/generic/396 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/396.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 77 insertions(+) create mode 100644 tests/generic/396 create mode 100644 tests/generic/396.out
tests/generic/396 new file +68 -0
@@ -0,0 +1,68 @@ +#!/bin/bash +# FS QA Test No. 396 +# +# Tests vfs_copy_file_range() error checking +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file" +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 + +echo "source pos > source size:" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy" + +echo "target read-only" +$XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" + +echo "target append-only" +$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" + +#success, all done +status=0 +exit
tests/generic/396.out new file +8 -0
@@ -0,0 +1,8 @@ +QA output created by 396 +Create the original file +source pos > source size: +copy_range: Invalid argument +target read-only +copy_range: Bad file descriptor +target append-only +copy_range: Bad file descriptor
tests/generic/group +1 -0
@@ -398,3 +398,4 @@ 393 auto quick copy 394 auto quick copy 395 auto quick copy +396 auto quick copy
Signature · 1 line
2.10.2
v4 cover Add copy_file_range() tests
These tests exercise the copy_file_range() system call, and check copying data to both a new file and overwriting data inside an existing file.
The last patch is a duplicate of a patch I already submitted for the xfs_io utility. It adds in fixes for the 'copy_range' command so error checking can work and so some copies won't loop forever.
Thanks,
Anna
Anna Schumaker (5):
generic/392: Add copy to new file test
generic/393: Add small copies to new file test generic/394: Add copy test that overwrites data generic/395: Add a copy test for overwriting small amounts of data generic/396: Add a copy test for invalid input
common/rc | 6 +++ tests/generic/392 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/392.out | 26 +++++++++++++ tests/generic/393 | 83 ++++++++++++++++++++++++++++++++++++++++ tests/generic/393.out | 16 ++++++++ tests/generic/394 | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/394.out | 17 +++++++++ tests/generic/395 | 87 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/395.out | 17 +++++++++ tests/generic/396 | 68 +++++++++++++++++++++++++++++++++ tests/generic/396.out | 8 ++++ tests/generic/group | 5 +++ 12 files changed, 535 insertions(+) create mode 100755 tests/generic/392 create mode 100644 tests/generic/392.out create mode 100755 tests/generic/393 create mode 100644 tests/generic/393.out create mode 100755 tests/generic/394 create mode 100644 tests/generic/394.out create mode 100755 tests/generic/395 create mode 100644 tests/generic/395.out create mode 100644 tests/generic/396 create mode 100644 tests/generic/396.out
Signature · 1 line
2.10.2
[PATCH v4 6/5] xfs_io: Improvements to copy_range return code handling
If copy_file_range() returns 0, then that means no data was copied. We should break out of the loop in this case to prevent looping indefinitely.
Additionally, if an error is returned by copy_file_range() then we need to print out the string form to be used by error checking tests in xfstests.
--- io/copy_file_range.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
io/copy_file_range.c +4 -1
@@ -49,8 +49,11 @@ copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)do { ret =syscall (__NR_copy_file_range, fd, src, file->fd, dst, len,0 ); -if (ret ==-1 ) +if (ret ==-1 ) { +fprintf (stderr,_ ("copy_range: %s\n" ),strerror (errno));return errno; + }else if (ret ==0 ) +break ; len -= ret; }while (len >0 );
Signature · 1 line
2.10.2
Re: [PATCH v4 5/5] generic/396: Add a copy test for invalid input
In reply to Anna SchumakerQuoted 72 lines · Anna Schumaker
This test passes invalid argumnt combinations to the
copy_file_range()system call to test that input is verified before attempting to copy.Signed-off-by Anna Schumaker <[email protected]>--- tests/generic/396 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/396.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 77 insertions(+) create mode 100644 tests/generic/396 create mode 100644 tests/generic/396.outtests/generic/396 new file +54
-0@@ -0,0 +1,68 @@ +#!/bin/bash +# FS QA Test No. 396 +# +# Tests vfs_copy_file_range() error checking +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file"
tests/generic/396 line 64
Quoted 10 lines
tests/generic/396 new file +10
-0+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 + +echo "source pos > source size:" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy" + +echo "target read-only" +$XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" + +echo "target append-only" +$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy"
Good start, though I can think of a few more things...
Copying when one or the other file arguments are directories/device files/etc., copies where pos < size but (pos + len) > size, copies where pos + len overflow, overlapped src/dest ranges, and perhaps even copies across holes and unwritten extents?
--D
Quoted 34 lines
tests/generic/396 new file +4
-0+ +#success, all done +status=0 +exittests/generic/396.out new file +8
-0@@ -0,0 +1,8 @@ +QA output created by 396 +Create the original file +source pos > source size: +copy_range: Invalid argument +target read-only +copy_range: Bad file descriptor +target append-only +copy_range: Bad file descriptortests/generic/group +1
-0@@ -398,3 +398,4 @@ 393 auto quick copy 394 auto quick copy 395 auto quick copy +396 auto quick copySignature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 5/5] generic/396: Add a copy test for invalid input
Quoted 77 lines · Darrick J. Wong
Quoted 76 lines · Anna Schumaker
This test passes invalid argumnt combinations to the
copy_file_range()system call to test that input is verified before attempting to copy.Signed-off-by Anna Schumaker <[email protected]>--- tests/generic/396 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/396.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 77 insertions(+) create mode 100644 tests/generic/396 create mode 100644 tests/generic/396.outtests/generic/396 new file +58
-0@@ -0,0 +1,68 @@ +#!/bin/bash +# FS QA Test No. 396 +# +# Tests vfs_copy_file_range() error checking +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file" +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 + +echo "source pos > source size:" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy"
Quoted 8 lines
tests/generic/396 line 64
Quoted 6 lines
tests/generic/396 new file +6
-0+ +echo "target read-only" +$XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" + +echo "target append-only" +$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy"Good start, though I can think of a few more things...
Thanks!
Quoted 2 lines
Copying when one or the other file arguments are directories/device files/etc.,
Good suggestion, I didn't even think of that one.
Quoted 1 line
copies where pos < size but (pos + len) > size,
This is in the first patch as the "Copy beyond end of original file" test
Quoted 3 lines
copies where pos + len
overflow, overlapped src/dest ranges, and perhaps even copies across holes and unwritten extents?
These are also good suggestions. I'll add them in!
Anna
Quoted 37 lines
--D
Quoted 34 lines
tests/generic/396 new file +4
-0+ +#success, all done +status=0 +exittests/generic/396.out new file +8
-0@@ -0,0 +1,8 @@ +QA output created by 396 +Create the original file +source pos > source size: +copy_range: Invalid argument +target read-only +copy_range: Bad file descriptor +target append-only +copy_range: Bad file descriptortests/generic/group +1
-0@@ -398,3 +398,4 @@ 393 auto quick copy 394 auto quick copy 395 auto quick copy +396 auto quick copySignature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Anna Schumaker
These tests exercise the
copy_file_range()system call, and check copying data to both a new file and overwriting data inside an existing file.
Hi Anna,
Both dedup and reflink have some generic tests to check for invalid cases generic/{157,158}.
I wonder if there are any other dedup/reflink tests that should be duplicated for copy_range. Darrick?
I also wonder if it would make sense to "deduplicate" some of these test to repeat the same relevant checks for all 3 methods.
Quoted 45 lines
The last patch is a duplicate of a patch I already submitted for the
xfs_ioutility. It adds in fixes for the 'copy_range' command so error checking can work and so some copies won't loop forever.Thanks,
AnnaAnna Schumaker (5):
generic/392: Add copy to new file test
generic/393: Add small copies to new file test generic/394: Add copy test that overwrites data generic/395: Add a copy test for overwriting small amounts of data generic/396: Add a copy test for invalid inputcommon/rc | 6 +++ tests/generic/392 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/392.out | 26 +++++++++++++ tests/generic/393 | 83 ++++++++++++++++++++++++++++++++++++++++ tests/generic/393.out | 16 ++++++++ tests/generic/394 | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/394.out | 17 +++++++++ tests/generic/395 | 87 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/395.out | 17 +++++++++ tests/generic/396 | 68 +++++++++++++++++++++++++++++++++ tests/generic/396.out | 8 ++++ tests/generic/group | 5 +++ 12 files changed, 535 insertions(+) create mode 100755 tests/generic/392 create mode 100644 tests/generic/392.out create mode 100755 tests/generic/393 create mode 100644 tests/generic/393.out create mode 100755 tests/generic/394 create mode 100644 tests/generic/394.out create mode 100755 tests/generic/395 create mode 100644 tests/generic/395.out create mode 100644 tests/generic/396 create mode 100644 tests/generic/396.out--
2.10.2--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Amir Goldstein
Quoted 3 lines · Anna Schumaker
These tests exercise the
copy_file_range()system call, and check copying data to both a new file and overwriting data inside an existing file.
Quoted 6 lines
Hi Anna,
Both dedup and reflink have some generic tests to check for invalid cases generic/{157,158}.
I wonder if there are any other dedup/reflink tests that should be duplicated forcopy_range. Darrick?
Yes, feel free to borrow from g/157. :)
Quoted 2 lines
I also wonder if it would make sense to "deduplicate" some of these test to repeat the same relevant checks for all 3 methods.
You could refactor them but for two tests (dedupe is its own weird animal) I don't think it's worth the effort.
--D
Quoted 51 lines
Quoted 40 lines
The last patch is a duplicate of a patch I already submitted for the
xfs_ioutility. It adds in fixes for the 'copy_range' command so error checking can work and so some copies won't loop forever.Thanks,
AnnaAnna Schumaker (5):
generic/392: Add copy to new file test
generic/393: Add small copies to new file test generic/394: Add copy test that overwrites data generic/395: Add a copy test for overwriting small amounts of data generic/396: Add a copy test for invalid inputcommon/rc | 6 +++ tests/generic/392 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/392.out | 26 +++++++++++++ tests/generic/393 | 83 ++++++++++++++++++++++++++++++++++++++++ tests/generic/393.out | 16 ++++++++ tests/generic/394 | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/394.out | 17 +++++++++ tests/generic/395 | 87 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/395.out | 17 +++++++++ tests/generic/396 | 68 +++++++++++++++++++++++++++++++++ tests/generic/396.out | 8 ++++ tests/generic/group | 5 +++ 12 files changed, 535 insertions(+) create mode 100755 tests/generic/392 create mode 100644 tests/generic/392.out create mode 100755 tests/generic/393 create mode 100644 tests/generic/393.out create mode 100755 tests/generic/394 create mode 100644 tests/generic/394.out create mode 100755 tests/generic/395 create mode 100644 tests/generic/395.out create mode 100644 tests/generic/396 create mode 100644 tests/generic/396.outQuoted 7 lines
--
2.10.2--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/5] generic/392: Add copy to new file test
In reply to Anna SchumakerHi Anna,
Quoted 4 lines · Anna Schumaker
This test copies data from various points in a source file to a new file. This is useful for testing the basics of
copy_file_range().Signed-off-by Anna Schumaker <[email protected]>
Sorry for the late review. I tested this patchset on 4.9 kernel and xfs_io with your return code fix applied.
I met some common failures/behaviors in these tests, so I only comment on this patch.
Quoted 16 lines
--- common/rc | 6 +++ tests/generic/392 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/392.out | 26 +++++++++++++ tests/generic/group | 1 + 4 files changed, 135 insertions(+) create mode 100755 tests/generic/392 create mode 100644 tests/generic/392.outcommon/rc +0
-0@@ -2054,6 +2054,12 @@ _require_xfs_io_command() "chproj") testio=`$XFS_IO_PROG -F -f -c "chproj 0" $testfile 2>&1`
common/rc _require_xfs_io_command() · line 2065
Quoted 10 lines
common/rc +6
-0;; + "copy_range") + testcopy=$TEST_DIR/$$.copy.xfs_io + $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile 2>&1 > /dev/null + testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` + rm -f $testcopy 2>&1 > /dev/null + ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1` ;;
This is not able to _notrun as expect on a kernel without copy_file_range syscall support, e.g. 4.4 kernel, xfs_io reports "+copy_range: Function not implemented"
I think we need a new check on $testio after the case switch, e.g.
echo $testio | grep -q "not implemented" \ && _notrun "xfs_io $command is not implemented in kernel"
Quoted 85 lines
tests/generic/392 new file +79
-0@@ -0,0 +1,102 @@ +#!/bin/bash +# FS QA Test No. 392 +# +# Tests vfs_copy_file_range(): +# - Copy a file +# - Copy beginning of original to new file +# - Copy middle of original to a new file +# - Copy end of original to new file +# - Copy middle of original to a new file, creating a hole +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file and then copy" +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" +cmp $testdir/file $testdir/copy +echo "Original md5sums:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Copy beginning of original file" +$XFS_IO_PROG -f -c "copy_range -l 1000 $testdir/file" "$testdir/beginning" +cmp -n 1000 $testdir/file $testdir/beginning +echo "md5sums after copying beginning:" +md5sum $testdir/{file,beginning} | _filter_test_dir + +echo "Copy middle of original file" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 $testdir/file" "$testdir/middle" +cmp -n 3000 $testdir/file $testdir/middle 1000 +echo "md5sums after copying middle:"
tests/generic/392 line 89
Quoted 10 lines
tests/generic/392 new file +10
-0+md5sum $testdir/{file,middle} | _filter_test_dir + +echo "Copy end of original file" +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/end" +cmp -n 1000 $testdir/file $testdir/end 4000 +echo "md5sums after copying end:" +md5sum $testdir/{file,end} | _filter_test_dir + +echo "Copy beyond end of original file" +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond"
This didn't return EINVAL for me on xfs, ext4 and NFS, btrfs reported EINVAL but it failed cmp and md5sum test at many other places. What is the expected behavior?
generic/393 and generic/396 failed in a similar way, missing "copy_range: Invalid argument" in the test output.
And seems copy_range -l option doesn't work well with xfs reflink enabled? I saw many EINVALs when testing reflink enabled xfs, all these 5 tests failed. Kernel bug or xfs_io bug or we just want to _notrun on reflink xfs?
Thanks,
Eryu
Re: [PATCH v4 1/5] generic/392: Add copy to new file test
Quoted 150 lines · Eryu Guan
Hi Anna,
Quoted 4 lines · Anna Schumaker
This test copies data from various points in a source file to a new file. This is useful for testing the basics of
copy_file_range().Signed-off-by Anna Schumaker <[email protected]>Sorry for the late review. I tested this patchset on 4.9 kernel and
xfs_iowith your return code fix applied.I met some common failures/behaviors in these tests, so I only comment on this patch.
Quoted 16 lines
--- common/rc | 6 +++ tests/generic/392 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/392.out | 26 +++++++++++++ tests/generic/group | 1 + 4 files changed, 135 insertions(+) create mode 100755 tests/generic/392 create mode 100644 tests/generic/392.outcommon/rc +0
-0@@ -2054,6 +2054,12 @@ _require_xfs_io_command() "chproj") testio=`$XFS_IO_PROG -F -f -c "chproj 0" $testfile 2>&1`common/rc _require_xfs_io_command() · line 2065
Quoted 10 lines
common/rc +6
-0;; + "copy_range") + testcopy=$TEST_DIR/$$.copy.xfs_io + $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile 2>&1 > /dev/null + testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` + rm -f $testcopy 2>&1 > /dev/null + ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1` ;;This is not able to
_notrunas expect on a kernel withoutcopy_file_rangesyscall support, e.g. 4.4 kernel,xfs_ioreports "+copy_range: Function not implemented"I think we need a new check on $testio after the case switch, e.g.
echo $testio | grep -q "not implemented" \ && _notrun "xfs_io $command is not implemented in kernel"Quoted 85 lines
tests/generic/392 new file +79
-0@@ -0,0 +1,102 @@ +#!/bin/bash +# FS QA Test No. 392 +# +# Tests vfs_copy_file_range(): +# - Copy a file +# - Copy beginning of original to new file +# - Copy middle of original to a new file +# - Copy end of original to new file +# - Copy middle of original to a new file, creating a hole +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file and then copy" +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" +cmp $testdir/file $testdir/copy +echo "Original md5sums:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Copy beginning of original file" +$XFS_IO_PROG -f -c "copy_range -l 1000 $testdir/file" "$testdir/beginning" +cmp -n 1000 $testdir/file $testdir/beginning +echo "md5sums after copying beginning:" +md5sum $testdir/{file,beginning} | _filter_test_dir + +echo "Copy middle of original file" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 $testdir/file" "$testdir/middle" +cmp -n 3000 $testdir/file $testdir/middle 1000 +echo "md5sums after copying middle:"tests/generic/392 line 89
Quoted 10 lines
tests/generic/392 new file +10
-0+md5sum $testdir/{file,middle} | _filter_test_dir + +echo "Copy end of original file" +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/end" +cmp -n 1000 $testdir/file $testdir/end 4000 +echo "md5sums after copying end:" +md5sum $testdir/{file,end} | _filter_test_dir + +echo "Copy beyond end of original file" +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond"This didn't return EINVAL for me on xfs, ext4 and NFS, btrfs reported EINVAL but it failed cmp and md5sum test at many other places. What is the expected behavior?
Quoted 7 lines
generic/393 and generic/396 failed in a similar way, missing "
copy_range: Invalid argument" in the test output.And seems
copy_range-l option doesn't work well with xfs reflink enabled? I saw many EINVALs when testing reflink enabled xfs, all these 5 tests failed. Kernel bug orxfs_iobug or we just want to_notrunon reflink xfs?
Ugggggggghhhhhhhhh...
Prior to hch's vfs patch reorganizing vfs_copy_file_range to try clone first, this happened[1]:
ret = -EOPNOTSUPP;
if (file_out->f_op->copy_file_range)
ret = file_out->f_op->copy_file_range(file_in, pos_in, file_out, pos_out, len, flags); if (ret == -EOPNOTSUPP) ret = do_splice_direct(file_in, &pos_in, file_out, &pos_out, len > MAX_RW_COUNT ? MAX_RW_COUNT : len, 0);
Note that copy_file_range pointed to XFS's clone_range implementation, so if you pass in an offset/length that aren't block aligned, the clone code returns EINVAL and ... we pass that out to userspace instead of falling back.
Now it does this[2]:
if (file_in->f_op->clone_file_range) {
ret = file_in->f_op->clone_file_range(file_in, pos_in,
file_out, pos_out, len);
if (ret == 0) {
ret = len;
goto done;
}
}if (file_out->f_op->copy_file_range) {
ret = file_out->f_op->copy_file_range(file_in, pos_in, file_out,
pos_out, len, flags);
if (ret != -EOPNOTSUPP)
goto done;
}ret = do_splice_direct(file_in, &pos_in, file_out, &pos_out,
len > MAX_RW_COUNT ? MAX_RW_COUNT : len, 0);
XFS removed the copy_file_range pointer, so therefore we'll try to reflink the range and if that doesn't succeed we'll fall back to whatever do_splice_direct does. All those EINVALs should go away shortly, at least on reflink-XFS.
--D
[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/read_write.c?id=ffecee4f2442bb8cb6b34c3335fef4eb50c22fdd#n1545
[2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/read_write.c#n1543
Quoted 7 lines
Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/5] generic/392: Add copy to new file test
Quoted 42 lines · Darrick J. Wong
Quoted 5 lines
And seems
copy_range-l option doesn't work well with xfs reflink enabled? I saw many EINVALs when testing reflink enabled xfs, all these 5 tests failed. Kernel bug orxfs_iobug or we just want to_notrunon reflink xfs?Ugggggggghhhhhhhhh...
Prior to hch's vfs patch reorganizing
vfs_copy_file_rangeto try clone first, this happened[1]:ret =
-EOPNOTSUPP;
if (file_out->f_op->copy_file_range)ret = file_out->f_op->copy_file_range(file_in, pos_in, file_out, pos_out, len, flags); if (ret == -EOPNOTSUPP) ret = do_splice_direct(file_in, &pos_in, file_out, &pos_out, len > MAX_RW_COUNT ? MAX_RW_COUNT : len, 0);Note that
copy_file_rangepointed to XFS'sclone_rangeimplementation, so if you pass in an offset/length that aren't block aligned, the clone code returns EINVAL and ... we pass that out to userspace instead of falling back.Now it does this[2]:
if (file_in->f_op->clone_file_range) { ret = file_in->f_op->clone_file_range(file_in, pos_in, file_out, pos_out, len); if (ret == 0) { ret = len; goto done; } }if (file_out->f_op->copy_file_range) { ret = file_out->f_op->copy_file_range(file_in, pos_in, file_out, pos_out, len, flags); if (ret != -EOPNOTSUPP) goto done; }
Quoted 7 lines
ret = do_splice_direct(file_in,
&pos_in,file_out,&pos_out,len > MAX_RW_COUNT ? MAX_RW_COUNT : len, 0);XFS removed the
copy_file_rangepointer, so therefore we'll try to reflink the range and if that doesn't succeed we'll fall back to whateverdo_splice_directdoes. All those EINVALs should go away shortly, at least on reflink-XFS.
Good to know, thanks for the explanation!
Eryu
Quoted 13 lines
--D
[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/read_write.c?id=ffecee4f2442bb8cb6b34c3335fef4eb50c22fdd#n1545
[2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/read_write.c#n1543Quoted 7 lines
Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html