aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-05-01 08:40:17 -0700
committerEryu Guan <guaneryu@gmail.com>2018-05-02 16:56:19 +0800
commit0828657542eabdee25d6de480aa3c9ed30c902e1 (patch)
treeee418a3f67059420c715f01905f3ad09d6713270
parente2fd1a080ecee8009ca749640ce0881665a89300 (diff)
downloadxfstests-dev-0828657542eabdee25d6de480aa3c9ed30c902e1.tar.gz
xfs: fix blocktrash fuzzers
The blocktrash fuzz tests for xfs will try to mount and write to the filesystem after corrupting it. However, the mount may not necessarily succeed, in which case we must not write junk to the root filesystem. Use the new _try_scratch_mount to guard against that. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rwxr-xr-xtests/xfs/08615
-rwxr-xr-xtests/xfs/08719
-rwxr-xr-xtests/xfs/08815
-rwxr-xr-xtests/xfs/08915
-rwxr-xr-xtests/xfs/09115
-rwxr-xr-xtests/xfs/09319
-rwxr-xr-xtests/xfs/09719
-rwxr-xr-xtests/xfs/09911
-rwxr-xr-xtests/xfs/10011
-rwxr-xr-xtests/xfs/10111
-rwxr-xr-xtests/xfs/10211
-rwxr-xr-xtests/xfs/10511
-rwxr-xr-xtests/xfs/11211
-rwxr-xr-xtests/xfs/11311
-rwxr-xr-xtests/xfs/11725
-rwxr-xr-xtests/xfs/12017
-rwxr-xr-xtests/xfs/1237
-rwxr-xr-xtests/xfs/1249
-rwxr-xr-xtests/xfs/1259
-rwxr-xr-xtests/xfs/1269
-rwxr-xr-xtests/xfs/23511
-rwxr-xr-xtests/xfs/33711
22 files changed, 157 insertions, 135 deletions
diff --git a/tests/xfs/086 b/tests/xfs/086
index 787f88650c..98b45dde00 100755
--- a/tests/xfs/086
+++ b/tests/xfs/086
@@ -93,13 +93,14 @@ done
# Try to append to files; this should fail
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-for x in `seq 1 64`; do
- $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full
-done
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ for x in `seq 1 64`; do
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full
+ done
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/087 b/tests/xfs/087
index 58ba9586ca..65877c7c4e 100755
--- a/tests/xfs/087
+++ b/tests/xfs/087
@@ -91,15 +91,16 @@ for ag in $(seq 1 $((agcount - 1))) 0; do
done
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-broken=0
-for x in `seq 65 70`; do
- touch "${TESTFILE}.${x}" 2> /dev/null || broken=1
-done
-echo "broken: ${broken}"
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ broken=0
+ for x in `seq 65 70`; do
+ touch "${TESTFILE}.${x}" 2> /dev/null || broken=1
+ done
+ echo "broken: ${broken}"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/088 b/tests/xfs/088
index 36745b2ff5..14b1f115b7 100755
--- a/tests/xfs/088
+++ b/tests/xfs/088
@@ -92,13 +92,14 @@ done
# Try to append to files; this should fail
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-for x in `seq 1 64`; do
- $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full
-done
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ for x in `seq 1 64`; do
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full
+ done
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/089 b/tests/xfs/089
index 52bdd54295..e47f7fefc7 100755
--- a/tests/xfs/089
+++ b/tests/xfs/089
@@ -92,13 +92,14 @@ done
# Try to append to files; this should fail
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-for x in `seq 1 64`; do
- $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full
-done
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ for x in `seq 1 64`; do
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full
+ done
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/091 b/tests/xfs/091
index ae6233707b..7adbdc9efb 100755
--- a/tests/xfs/091
+++ b/tests/xfs/091
@@ -92,13 +92,14 @@ done
# Try to append to files; this should fail
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-for x in `seq 1 64`; do
- $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full
-done
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ for x in `seq 1 64`; do
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full
+ done
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/093 b/tests/xfs/093
index 0f9311e9bc..440cdb6602 100755
--- a/tests/xfs/093
+++ b/tests/xfs/093
@@ -91,15 +91,16 @@ for ag in $(seq 1 $((agcount - 1))) 0; do
done
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-broken=0
-for x in `seq 65 70`; do
- touch "${TESTFILE}.${x}" 2> /dev/null || broken=1
-done
-echo "broken: ${broken}"
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ broken=0
+ for x in `seq 65 70`; do
+ touch "${TESTFILE}.${x}" 2> /dev/null || broken=1
+ done
+ echo "broken: ${broken}"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/097 b/tests/xfs/097
index 303ad04ff0..703bd9b490 100755
--- a/tests/xfs/097
+++ b/tests/xfs/097
@@ -94,15 +94,16 @@ for ag in $(seq 1 $((agcount - 1))) 0; do
done
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-broken=0
-for x in `seq 65 70`; do
- touch "${TESTFILE}.${x}" 2> /dev/null || broken=1
-done
-echo "broken: ${broken}"
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ broken=0
+ for x in `seq 65 70`; do
+ touch "${TESTFILE}.${x}" 2> /dev/null || broken=1
+ done
+ echo "broken: ${broken}"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/099 b/tests/xfs/099
index 7835df9f11..2d63536c54 100755
--- a/tests/xfs/099
+++ b/tests/xfs/099
@@ -82,12 +82,13 @@ echo "+ corrupt dir"
_scratch_xfs_db -x -c "inode ${inode}" -c 'dblock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify dir"
-rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
-mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
-umount "${SCRATCH_MNT}"
+ echo "+ modify dir"
+ rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
+ mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/100 b/tests/xfs/100
index ebb656d3b6..83146ee07c 100755
--- a/tests/xfs/100
+++ b/tests/xfs/100
@@ -87,12 +87,13 @@ while true; do
done
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify dir"
-rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
-mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
-umount "${SCRATCH_MNT}"
+ echo "+ modify dir"
+ rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
+ mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/101 b/tests/xfs/101
index 709fc9d327..426c3e9ca3 100755
--- a/tests/xfs/101
+++ b/tests/xfs/101
@@ -82,12 +82,13 @@ echo "+ corrupt dir"
_scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify dir"
-rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
-mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
-umount "${SCRATCH_MNT}"
+ echo "+ modify dir"
+ rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
+ mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/102 b/tests/xfs/102
index 3d51c6a25e..02bc35ca01 100755
--- a/tests/xfs/102
+++ b/tests/xfs/102
@@ -87,12 +87,13 @@ while true; do
done
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify dir"
-rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
-mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
-umount "${SCRATCH_MNT}"
+ echo "+ modify dir"
+ rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
+ mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/105 b/tests/xfs/105
index fc91a4f5dd..c3a853b003 100755
--- a/tests/xfs/105
+++ b/tests/xfs/105
@@ -87,12 +87,13 @@ while true; do
done
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify dir"
-rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
-mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
-umount "${SCRATCH_MNT}"
+ echo "+ modify dir"
+ rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
+ mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/112 b/tests/xfs/112
index ae756845d2..cec3a16824 100755
--- a/tests/xfs/112
+++ b/tests/xfs/112
@@ -87,12 +87,13 @@ while true; do
done
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify dir"
-rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
-mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
-umount "${SCRATCH_MNT}"
+ echo "+ modify dir"
+ rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
+ mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/113 b/tests/xfs/113
index c347db7887..17af3b667b 100755
--- a/tests/xfs/113
+++ b/tests/xfs/113
@@ -87,12 +87,13 @@ while true; do
done
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify dir"
-rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
-mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
-umount "${SCRATCH_MNT}"
+ echo "+ modify dir"
+ rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory"
+ mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/117 b/tests/xfs/117
index f0b95aa14c..31eac29585 100755
--- a/tests/xfs/117
+++ b/tests/xfs/117
@@ -90,18 +90,19 @@ seq "${inode}" "$((inode + 64))" | while read ino; do
done
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-broken=0
-for x in `seq 1 64`; do
- stat "${TESTFILE}.${x}" >> $seqres.full 2>&1
- test $? -ne 0 && broken=1
- touch "${TESTFILE}.${x}" >> $seqres.full 2>&1
- test $? -ne 0 && broken=1
-done
-echo "broken: ${broken}"
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ broken=0
+ for x in `seq 1 64`; do
+ stat "${TESTFILE}.${x}" >> $seqres.full 2>&1
+ test $? -ne 0 && broken=1
+ touch "${TESTFILE}.${x}" >> $seqres.full 2>&1
+ test $? -ne 0 && broken=1
+ done
+ echo "broken: ${broken}"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/120 b/tests/xfs/120
index 5a38000c73..39c41d98f4 100755
--- a/tests/xfs/120
+++ b/tests/xfs/120
@@ -79,14 +79,15 @@ echo "+ corrupt image"
_scratch_xfs_db -x -c "inode ${inode}" -c "addr u.bmbt.ptrs[1]" -c "addr u3.bmbt.ptrs[1]" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
echo "+ mount image"
-_scratch_mount
-
-echo "+ modify files"
-before="$(stat -c '%b' "${SCRATCH_MNT}/bigfile")"
-$XFS_IO_PROG -f -c "pwrite -S 0x62 ${blksz} ${blksz}" -c 'fsync' "${SCRATCH_MNT}/bigfile" >> $seqres.full 2> /dev/null
-after="$(stat -c '%b' "${SCRATCH_MNT}/bigfile")"
-test "${before}" -eq "${after}" || _fail "pwrite should fail on corrupt bmbt"
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+
+ echo "+ modify files"
+ before="$(stat -c '%b' "${SCRATCH_MNT}/bigfile")"
+ $XFS_IO_PROG -f -c "pwrite -S 0x62 ${blksz} ${blksz}" -c 'fsync' "${SCRATCH_MNT}/bigfile" >> $seqres.full 2> /dev/null
+ after="$(stat -c '%b' "${SCRATCH_MNT}/bigfile")"
+ test "${before}" -eq "${after}" || _fail "pwrite should fail on corrupt bmbt"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/123 b/tests/xfs/123
index 7355e86a4f..2640d675a9 100755
--- a/tests/xfs/123
+++ b/tests/xfs/123
@@ -78,9 +78,10 @@ echo "+ corrupt image"
_scratch_xfs_db -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
echo "+ mount image"
-_scratch_mount
-cat "${SCRATCH_MNT}/long_symlink" 2>/dev/null && _fail "symlink should be broken"
-umount "${SCRATCH_MNT}"
+if _try_scratch_mount >> $seqres.full 2>&1; then
+ cat "${SCRATCH_MNT}/long_symlink" 2>/dev/null && _fail "symlink should be broken"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/124 b/tests/xfs/124
index a828dd6bb6..742ef75a07 100755
--- a/tests/xfs/124
+++ b/tests/xfs/124
@@ -87,11 +87,12 @@ echo "+ corrupt xattr"
_scratch_xfs_db -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify xattr"
-setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr"
-umount "${SCRATCH_MNT}"
+ echo "+ modify xattr"
+ setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/125 b/tests/xfs/125
index 3afb4cc1d0..4ab0177d56 100755
--- a/tests/xfs/125
+++ b/tests/xfs/125
@@ -87,11 +87,12 @@ echo "+ corrupt xattr"
_scratch_xfs_db -x -c "inode ${inode}" -c 'ablock 0' -c "stack" -c "blocktrash -x 32 -o +32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify xattr"
-setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr"
-umount "${SCRATCH_MNT}"
+ echo "+ modify xattr"
+ setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/126 b/tests/xfs/126
index d696ff1f50..de6e2fdbcf 100755
--- a/tests/xfs/126
+++ b/tests/xfs/126
@@ -92,11 +92,12 @@ while true; do
done
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ modify xattr"
-setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr"
-umount "${SCRATCH_MNT}"
+ echo "+ modify xattr"
+ setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr"
+ umount "${SCRATCH_MNT}"
+fi
echo "+ repair fs"
_scratch_xfs_repair >> $seqres.full 2>&1
diff --git a/tests/xfs/235 b/tests/xfs/235
index 88101f2de8..84725b0af3 100755
--- a/tests/xfs/235
+++ b/tests/xfs/235
@@ -77,12 +77,13 @@ seq 0 $((agcount - 1)) | while read ag; do
done
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ copy more"
-$XFS_IO_PROG -f -c "pwrite -S 0x63 0 $((blksz * 64))" -c "fsync" ${SCRATCH_MNT}/file4 >> $seqres.full 2>&1
-test -s ${SCRATCH_MNT}/file4 && _fail "should not be able to copy with busted rmap btree"
-umount ${SCRATCH_MNT}
+ echo "+ copy more"
+ $XFS_IO_PROG -f -c "pwrite -S 0x63 0 $((blksz * 64))" -c "fsync" ${SCRATCH_MNT}/file4 >> $seqres.full 2>&1
+ test -s ${SCRATCH_MNT}/file4 && _fail "should not be able to copy with busted rmap btree"
+ umount ${SCRATCH_MNT}
+fi
echo "+ repair fs"
_disable_dmesg_check
diff --git a/tests/xfs/337 b/tests/xfs/337
index b61e7226d6..851b6439b4 100755
--- a/tests/xfs/337
+++ b/tests/xfs/337
@@ -85,12 +85,13 @@ _scratch_xfs_db -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" \
>> $seqres.full 2>&1
echo "+ mount image"
-_scratch_mount
+if _try_scratch_mount >> $seqres.full 2>&1; then
-echo "+ copy more"
-$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1
-test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree"
-_scratch_unmount
+ echo "+ copy more"
+ $XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1
+ test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree"
+ _scratch_unmount
+fi
echo "+ repair fs"
_repair_scratch_fs >> $seqres.full 2>&1