reflink: make error reporting consistent when simulating EIO

When we're using dm-error to simulate failed devices, we don't really
know if the write or the fdatasync is going to receive the EIO.  For
tests that make a single (failed) write attempt and never retry, it's
sufficient to check that the file md5 doesn't change after recovery.
For tests that /do/ retry the write, we should capture the entire output
and just look for the word error instead of enshrining the exact perror
message (filename/function call and everything) in the golden output.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Darrick J. Wong
2017-01-04 17:05:08 -08:00
committed by Eryu Guan
parent eaa652fbb2
commit c4288aec3c
22 changed files with 33 additions and 29 deletions
+5 -1
View File
@@ -80,7 +80,11 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
-c "fdatasync" $testdir/file2 2>&1)
echo $urk >> $seqres.full
echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-265/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-265/file2
CoW and unmount
fdatasync: Input/output error
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-265/file1
Check for damage
+4 -1
View File
@@ -80,7 +80,10 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
-c "fdatasync" $testdir/file2 2>&1)
echo $urk >> $seqres.full
echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
echo "Clean up the mess"
_dmerror_unmount
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-266/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-266/file2
CoW and unmount
fdatasync: Input/output error
Clean up the mess
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-266/file1
+1 -1
View File
@@ -80,7 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
_dmerror_load_working_table
rm -rf $testdir/file2 >> $seqres.full 2>&1
_dmerror_unmount
+4 -1
View File
@@ -81,7 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
-c "fdatasync" $testdir/file2 2>&1)
echo $urk >> $seqres.full
echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
_dmerror_load_working_table
echo "Rewrite"
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-268/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-268/file2
CoW and unmount
fdatasync: Input/output error
Rewrite
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-268/file1
+3 -2
View File
@@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
2>&1 >> $seqres.full | _filter_xfs_io_error
urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
echo $urk >> $seqres.full
echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-271/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-271/file2
CoW and unmount
pwrite: Input/output error
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-271/file1
Check for damage
+3 -2
View File
@@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
2>&1 >> $seqres.full | _filter_xfs_io_error
urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
echo $urk >> $seqres.full
echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
echo "Clean up the mess"
_dmerror_unmount
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-272/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-272/file2
CoW and unmount
pwrite: Input/output error
Clean up the mess
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-272/file1
+1 -1
View File
@@ -82,7 +82,7 @@ echo "CoW and unmount"
sync
_dmerror_load_error_table
$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
2>&1 >> $seqres.full | _filter_xfs_io_error
>> $seqres.full 2>&1
_dmerror_load_working_table
rm -rf $testdir/file2 >> $seqres.full 2>&1
_dmerror_unmount
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-276/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-276/file2
CoW and unmount
pwrite: Input/output error
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-276/file1
Check for damage
+3 -2
View File
@@ -82,8 +82,9 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
2>&1 >> $seqres.full | _filter_xfs_io_error
urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
echo $urk >> $seqres.full
echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
_dmerror_load_working_table
echo "Rewrite"
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-278/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-278/file2
CoW and unmount
pwrite: Input/output error
Rewrite
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-278/file1
+2 -2
View File
@@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
cat $TEST_DIR/mwrite.out | tee -a $seqres.full
$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-279/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-279/file2
CoW and unmount
msync: Input/output error
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-279/file1
Check for damage
+2 -2
View File
@@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
cat $TEST_DIR/mwrite.out | tee -a $seqres.full
$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
echo "Clean up the mess"
_dmerror_unmount
-1
View File
@@ -5,7 +5,6 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-281/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-281/file2
CoW and unmount
msync: Input/output error
Clean up the mess
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-281/file1
+1 -2
View File
@@ -80,8 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
cat $TEST_DIR/mwrite.out | tee -a $seqres.full
$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
_dmerror_load_working_table
rm -rf $testdir/file2 >> $seqres.full 2>&1
_dmerror_unmount

Some files were not shown because too many files have changed in this diff Show More