Skip to contentSkip to conversation

generic/158,304: filter dedupe error message

PATCH Superseded Eryu Guan 2 participants 3 messages Dec 30, 2016 – Jan 4, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/1 generic/158,304: filter dedupe error message

Kernel commit 22725ce4e4a0 ("vfs: fix isize/pos/len checks for reflink & dedupe") added more checks on reflink and dedupe, rejected dedupe past EOF early and explicitly, and causes generic/158 and generic/304 to fail.

Try dedupe from past EOF
-dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument
Try dedupe to past EOF, destination offset beyond EOF

Fix it by replacing fs-specific ioctl in error message to "dedupe".

---
 common/reflink        | 7 +++++++
 tests/generic/158     | 7 +++++--
 tests/generic/158.out | 4 ++--
 tests/generic/304     | 9 ++++++---
 tests/generic/304.out | 2 +-
 5 files changed, 21 insertions(+), 8 deletions(-)
common/reflink +7 -0
index 64ee04f..7306efd 100644
@@ -241,6 +241,13 @@ _dedupe_range() {
 	$XFS_IO_PROG $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
 }
 
+# Filter fs-specific ioctl in error message to "dedupe"
+# e.g. replace XFS_IOC_FILE_EXTENT_SAME with dedupe
+_filter_dedupe()
+{
+	sed -e 's/XFS_IOC_FILE_EXTENT_SAME/dedupe/g'
+}
+
 # Create a file of interleaved unwritten and reflinked blocks
 _weave_reflink_unwritten() {
 	blksz=$1
tests/generic/158 +5 -2
index 086c522..77ab1ce 100755
@@ -81,10 +81,12 @@ mkfifo $testdir1/fifo1
 sync
 
 _filter_enotty() {
+	_filter_dedupe | \
 	sed -e 's/Inappropriate ioctl for device/Invalid argument/g'
 }
 
 _filter_eperm() {
+	_filter_dedupe | \
 	sed -e 's/Permission denied/Invalid argument/g'
 }
 
@@ -98,7 +100,8 @@ echo "Try overlapping dedupe"
 _dedupe_range $testdir1/file1 0 $testdir1/file1 1 $((blksz * 2))
 
 echo "Try dedupe from past EOF"
-_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz
+_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz \
+	2>&1 | _filter_dedupe
 
 echo "Try dedupe to past EOF, destination offset beyond EOF"
 _dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks + 10) * blksz)) \
@@ -109,7 +112,7 @@ _dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks - 1) * blksz)) \
 	$((blksz * 2))
 
 echo "Try to dedupe a dir"
-_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz
+_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_dedupe
 
 echo "Try to dedupe a device"
 _dedupe_range $testdir1/dev1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_enotty
tests/generic/158.out +2 -2
index 9b82ddf..3a9596f 100644
@@ -14,9 +14,9 @@ dedupe: Invalid argument
 Try dedupe to past EOF, destination offset behind EOF
 dedupe: Invalid argument
 Try to dedupe a dir
-XFS_IOC_FILE_EXTENT_SAME: Is a directory
+dedupe: Is a directory
 Try to dedupe a device
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+dedupe: Invalid argument
 Try to dedupe to a dir
 TEST_DIR/test-158/dir1: Is a directory
 Try to dedupe to a device
tests/generic/304 +6 -3
index b7ee7b9..8f0a3b4 100755
@@ -75,13 +75,16 @@ echo "Dedupe high offset to low offset"
 _dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
 
 echo "Dedupe past source file EOF (should fail)"
-_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
+_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 \
+	2>&1 >> $seqres.full | _filter_dedupe
 
 echo "Dedupe max size at nonzero offset (should fail)"
-_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
+_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len \
+	2>&1 >> $seqres.full | _filter_dedupe
 
 echo "Dedupe with huge off/len (should fail)"
-_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
+_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k \
+	2>&1 >> $seqres.full | _filter_dedupe
 
 echo "Check file creation"
 _test_cycle_mount
tests/generic/304.out +1 -1
index 7b5ff0e..fbba6f3 100644
@@ -14,7 +14,7 @@ dedupe: Invalid argument
 Dedupe max size at nonzero offset (should fail)
 dedupe: Invalid argument
 Dedupe with huge off/len (should fail)
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+dedupe: Invalid argument
 Check file creation
 file3
 7ffffffffffffffe:  61  a
Signature · 1 line
2.9.3
#1 lore raw
Quoted 25 lines · Eryu Guan

Kernel commit 22725ce4e4a0 ("vfs: fix isize/pos/len checks for reflink & dedupe") added more checks on reflink and dedupe, rejected dedupe past EOF early and explicitly, and causes generic/158 and generic/304 to fail.

Try dedupe from past EOF
-dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument
Try dedupe to past EOF, destination offset beyond EOF

Fix it by replacing fs-specific ioctl in error message to "dedupe".

---
 common/reflink        | 7 +++++++
 tests/generic/158     | 7 +++++--
 tests/generic/158.out | 4 ++--
 tests/generic/304     | 9 ++++++---
 tests/generic/304.out | 2 +-
 5 files changed, 21 insertions(+), 8 deletions(-)
common/reflink +0 -0
index 64ee04f..7306efd 100644

common/reflink _dedupe_range() { · line 249

Quoted 9 lines
common/reflink +6 -0
@@ -241,6 +241,13 @@ _dedupe_range() {
 	$XFS_IO_PROG $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
 }
 
+# Filter fs-specific ioctl in error message to "dedupe"
+# e.g. replace XFS_IOC_FILE_EXTENT_SAME with dedupe
+_filter_dedupe()
+{
+	sed -e 's/XFS_IOC_FILE_EXTENT_SAME/dedupe/g'
+}

I sent a patch to the xfs list last month ("xfs_io: prefix dedupe command error messages consistently") changing all the error message prefixes to "XFS_IOC_FILE_EXTENT_SAME". Was going to send a patch to fix up xfstests too... but evidently didn't.

If you change the sed command to 's/dedupe:/XFS_IOC_FILE_EXTENT_SAME:/g' that'll suffice, I think.

--D

Quoted 100 lines
common/reflink +1 -0
+
 # Create a file of interleaved unwritten and reflinked blocks
 _weave_reflink_unwritten() {
 	blksz=$1
tests/generic/158 +5 -2
index 086c522..77ab1ce 100755
@@ -81,10 +81,12 @@ mkfifo $testdir1/fifo1
 sync
 
 _filter_enotty() {
+	_filter_dedupe | \
 	sed -e 's/Inappropriate ioctl for device/Invalid argument/g'
 }
 
 _filter_eperm() {
+	_filter_dedupe | \
 	sed -e 's/Permission denied/Invalid argument/g'
 }
 
@@ -98,7 +100,8 @@ echo "Try overlapping dedupe"
 _dedupe_range $testdir1/file1 0 $testdir1/file1 1 $((blksz * 2))
 
 echo "Try dedupe from past EOF"
-_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz
+_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz \
+	2>&1 | _filter_dedupe
 
 echo "Try dedupe to past EOF, destination offset beyond EOF"
 _dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks + 10) * blksz)) \
@@ -109,7 +112,7 @@ _dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks - 1) * blksz)) \
 	$((blksz * 2))
 
 echo "Try to dedupe a dir"
-_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz
+_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_dedupe
 
 echo "Try to dedupe a device"
 _dedupe_range $testdir1/dev1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_enotty
tests/generic/158.out +2 -2
index 9b82ddf..3a9596f 100644
@@ -14,9 +14,9 @@ dedupe: Invalid argument
 Try dedupe to past EOF, destination offset behind EOF
 dedupe: Invalid argument
 Try to dedupe a dir
-XFS_IOC_FILE_EXTENT_SAME: Is a directory
+dedupe: Is a directory
 Try to dedupe a device
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+dedupe: Invalid argument
 Try to dedupe to a dir
 TEST_DIR/test-158/dir1: Is a directory
 Try to dedupe to a device
tests/generic/304 +6 -3
index b7ee7b9..8f0a3b4 100755
@@ -75,13 +75,16 @@ echo "Dedupe high offset to low offset"
 _dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
 
 echo "Dedupe past source file EOF (should fail)"
-_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
+_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 \
+	2>&1 >> $seqres.full | _filter_dedupe
 
 echo "Dedupe max size at nonzero offset (should fail)"
-_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
+_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len \
+	2>&1 >> $seqres.full | _filter_dedupe
 
 echo "Dedupe with huge off/len (should fail)"
-_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
+_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k \
+	2>&1 >> $seqres.full | _filter_dedupe
 
 echo "Check file creation"
 _test_cycle_mount
tests/generic/304.out +1 -1
index 7b5ff0e..fbba6f3 100644
@@ -14,7 +14,7 @@ dedupe: Invalid argument
 Dedupe max size at nonzero offset (should fail)
 dedupe: Invalid argument
 Dedupe with huge off/len (should fail)
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+dedupe: Invalid argument
 Check file creation
 file3
 7ffffffffffffffe:  61  a
Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#2 lore raw
Quoted 29 lines · Darrick J. Wong
Quoted 28 lines · Eryu Guan

Kernel commit 22725ce4e4a0 ("vfs: fix isize/pos/len checks for reflink & dedupe") added more checks on reflink and dedupe, rejected dedupe past EOF early and explicitly, and causes generic/158 and generic/304 to fail.

Try dedupe from past EOF
-dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument
Try dedupe to past EOF, destination offset beyond EOF

Fix it by replacing fs-specific ioctl in error message to "dedupe".

---
 common/reflink        | 7 +++++++
 tests/generic/158     | 7 +++++--
 tests/generic/158.out | 4 ++--
 tests/generic/304     | 9 ++++++---
 tests/generic/304.out | 2 +-
 5 files changed, 21 insertions(+), 8 deletions(-)
common/reflink +0 -0
index 64ee04f..7306efd 100644
@@ -241,6 +241,13 @@ _dedupe_range() {
 	$XFS_IO_PROG $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
 }
 
Quoted 11 lines

common/reflink _dedupe_range() { · line 249

Quoted 6 lines
common/reflink +6 -0
+# Filter fs-specific ioctl in error message to "dedupe"
+# e.g. replace XFS_IOC_FILE_EXTENT_SAME with dedupe
+_filter_dedupe()
+{
+	sed -e 's/XFS_IOC_FILE_EXTENT_SAME/dedupe/g'
+}

I sent a patch to the xfs list last month ("xfs_io: prefix dedupe command error messages consistently") changing all the error message prefixes to "XFS_IOC_FILE_EXTENT_SAME". Was going to send a patch to fix up xfstests too... but evidently didn't.

Ah, didn't notict that patch.. Or I did saw the patch but failed to link it with this test failure :)

Quoted 3 lines

If you change the sed command to 's/dedupe:/XFS_IOC_FILE_EXTENT_SAME:/g' that'll suffice, I think.

Will do. Thanks!

Eryu