@@ -59,9 +59,17 @@ echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
sync
+
+# If the filesystem supports delalloc, then the fdatasync will report an IO
+# error. If the write goes directly to disk, then aiocp will return nonzero.
+unset write_failed
_dmerror_load_error_table
-$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -c "fdatasync" $testdir/file2
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 &>> $seqres.full || \
+ write_failed=1
+$XFS_IO_PROG -c "fdatasync" $testdir/file2 2>&1 | grep -q 'Input.output error' && \
+ write_failed=1
+test -n $write_failed && echo "write failed"
+
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
@@ -5,7 +5,7 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-331/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-331/file2
CoW and unmount
-fdatasync: Input/output error
+write failed
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-331/file1
d94b0ab13385aba594411c174b1cc13c SCRATCH_MNT/test-331/file2
@@ -66,8 +66,17 @@ $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
sync
_dmerror_load_error_table
-$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -c "fdatasync" $testdir/file2
+
+# If the filesystem supports delalloc, then the fdatasync will report an IO
+# error. If the write goes directly to disk, then aiocp will return nonzero.
+unset write_failed
+_dmerror_load_error_table
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 &>> $seqres.full || \
+ write_failed=1
+$XFS_IO_PROG -c "fdatasync" $testdir/file2 2>&1 | grep -q 'Input.output error' && \
+ write_failed=1
+test -n $write_failed && echo "write failed"
+
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
@@ -5,7 +5,7 @@ Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-240/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-240/file2
CoW and unmount
-fdatasync: Input/output error
+write failed
Compare files
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-240/file1
d94b0ab13385aba594411c174b1cc13c SCRATCH_MNT/test-240/file2