Skip to contentSkip to conversation

misc. fstests changes

PATCH In review Darrick J. Wong 3 participants 21 messages May 1, 2018 – May 3, 2018

lore
Share & tools
lore
#0 lore raw

cover misc. fstests changes

Hi all,

Here are some miscellaneous tests that have been queuing up for a while. The first patch is a reposting of the attr replace test from a couple weeks ago, and the second to last patch is a new test that looks for bashisms in xfsprogs scripts. In the middle are a bunch of enhancements to the Unicode support test to reflect new checks that we landed in xfs_scrub 4.16. The rest are fixes to existing tests.

--D

#1 lore raw

PATCH 1/9 generic: test XATTR_REPLACE doesn't take the fs down

From: Darrick J. Wong <[email protected]>

Kanda Motohiro reported that expanding a tiny xattr into a large xattr fails on XFS because we remove the tiny xattr from a shortform fork and then try to re-add it after converting the fork to extents format having not removed the ATTR_REPLACE flag. This fails because the attr is no longer present, causing a fs shutdown.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199119

---
 .gitignore              |    1 +
 src/Makefile            |    3 +-
 src/attr_replace_test.c |   60 +++++++++++++++++++++++++++++++++++++++++
 tests/generic/706       |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/706.out   |    2 +
 tests/generic/group     |    1 +
 6 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 src/attr_replace_test.c
 create mode 100755 tests/generic/706
 create mode 100644 tests/generic/706.out
.gitignore +1 -0
index 192ca35e..af9743f9 100644
@@ -53,6 +53,7 @@
 /src/append_reader
 /src/append_writer
 /src/attr-list-by-handle-cursor-test
+/src/attr_replace_test
 /src/bstat
 /src/bulkstat_unlink_test
 /src/bulkstat_unlink_test_modified
src/Makefile +2 -1
index 6ca56366..c42d3bb1 100644
@@ -25,7 +25,8 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \
 	renameat2 t_getcwd e4compact test-nextquota punch-alternating \
 	attr-list-by-handle-cursor-test listxattr dio-interleaved t_dir_type \
-	dio-invalidate-cache stat_test t_encrypted_d_revalidate
+	dio-invalidate-cache stat_test t_encrypted_d_revalidate \
+	attr_replace_test
 
 SUBDIRS = log-writes perf
 
src/attr_replace_test.c new file +60 -0

60 lines not on this page · raw message

tests/generic/706 new file +68 -0

68 lines not on this page · raw message

tests/generic/706.out new file +2 -0
new file mode 100644
index 00000000..61c8419a
@@ -0,0 +1,2 @@
+QA output created by 706
+Attribute "world" has a NNNN byte value for SCRATCH_MNT/hello
tests/generic/group +1 -0
index 19be9267..54a85ea0 100644
@@ -487,3 +487,4 @@
 482 auto metadata replay
 483 auto quick log metadata
 484 auto quick
+706 auto quick attr
#2 lore raw

Re: [PATCH 1/9] generic: test XATTR_REPLACE doesn't take the fs down

Quoted 11 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Kanda Motohiro reported that expanding a tiny xattr into a large xattr fails on XFS because we remove the tiny xattr from a shortform fork and then try to re-add it after converting the fork to extents format having not removed the ATTR_REPLACE flag. This fails because the attr is no longer present, causing a fs shutdown.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199119

Thanks for the revision! Because I found more issues in v1 than I expected, so I drop the patch from last fstests update. I should have made that clear..

Quoted 18 lines
---
 .gitignore              |    1 +
 src/Makefile            |    3 +-
 src/attr_replace_test.c |   60 +++++++++++++++++++++++++++++++++++++++++
 tests/generic/706       |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/706.out   |    2 +
 tests/generic/group     |    1 +
 6 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 src/attr_replace_test.c
 create mode 100755 tests/generic/706
 create mode 100644 tests/generic/706.out
.gitignore +0 -0
index 192ca35e..af9743f9 100644

.gitignore line 56

Quoted 4 lines
.gitignore +1 -0
@@ -53,6 +53,7 @@
 /src/append_reader
 /src/append_writer
 /src/attr-list-by-handle-cursor-test
+/src/attr_replace_test

Seems this should be put before attr-list-by-handle-cursor-test, according to the result of sort.

Quoted 40 lines
.gitignore +0 -0
 /src/bstat
 /src/bulkstat_unlink_test
 /src/bulkstat_unlink_test_modified
src/Makefile +2 -1
index 6ca56366..c42d3bb1 100644
@@ -25,7 +25,8 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \
 	renameat2 t_getcwd e4compact test-nextquota punch-alternating \
 	attr-list-by-handle-cursor-test listxattr dio-interleaved t_dir_type \
-	dio-invalidate-cache stat_test t_encrypted_d_revalidate
+	dio-invalidate-cache stat_test t_encrypted_d_revalidate \
+	attr_replace_test
 
 SUBDIRS = log-writes perf
 
src/attr_replace_test.c new file +17 -0
new file mode 100644
index 00000000..c870d165
@@ -0,0 +1,60 @@
+// setattr.c by [email protected]
+// xfs extended attribute corruption bug reproducer
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/xattr.h>
+#include <sys/stat.h>
+
+#define die() do { perror(""); \
+fprintf(stderr, "error=%d at line %d\n", errno, __LINE__); \
+exit(1); } while (0)
+
+int main(int argc, char *argv[])

src/attr_replace_test.c line 27

Quoted 10 lines
src/attr_replace_test.c new file +10 -0
+{
+	int ret;
+	int fd;
+	char *path;
+	char *name = "user.world";
+	char *value;
+	struct stat sbuf;
+	size_t size = sizeof(value);
+
+	if (argc != 2) die();

die() doesn't seem like the right thing to do (and some other places), it'll print something like:

Success
error=0 at line NN

I'd define a new "fail()" macro and use it where appropriate.

+#define fail(...) do { \
+fprintf(stderr, __VA_ARGS__); exit (1); \
+} while (0)

I can fix the minor issues on commit, for real this time :)

Thanks,
Eryu

Quoted 125 lines
src/attr_replace_test.c new file +33 -0
+	path = argv[1];
+
+	fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+	if (fd < 0) die();
+
+	/*
+	 * The value should be 3/4 the size of a fs block to ensure that we
+	 * get to extents format.
+	 */
+	ret = fstat(fd, &sbuf);
+	if (ret < 0) die();
+	size = sbuf.st_blksize * 3 / 4;
+	if (!size) die();
+	value = malloc(size);
+	if (!value) die();
+
+	// First, create a small xattr.
+	memset(value, '0', 1);
+	ret = fsetxattr(fd, name, value, 1, XATTR_CREATE);
+	if (ret < 0) die();
+	close(fd);
+
+	fd = open(path, O_RDWR);
+	if (fd < 0) die();
+
+	// Then, replace it with bigger one, forcing short form to leaf conversion.
+	memset(value, '1', size);
+	ret = fsetxattr(fd, name, value, size, XATTR_REPLACE);
+	if (ret < 0) die();
+	close(fd);
+
+	return 0;
+}
tests/generic/706 new file +68 -0
new file mode 100755
index 00000000..9f98c3b1
@@ -0,0 +1,68 @@
+#! /bin/bash
+# FS QA Test No. 706
+#
+# Ensure that we can XATTR_REPLACE a tiny attr into a large attr.
+# Kanda Motohiro <[email protected]> reports that XATTR_REPLACE'ing
+# a single-byte attr with a 2048-byte attr causes a fs shutdown because we
+# remove the shortform attr, convert the attr fork to long format, and then
+# try to re-add the attr having not cleared ATTR_REPLACE.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle.  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"
+
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $testfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_test_program "attr_replace_test"
+_require_attrs
+_require_scratch
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount >>$seqres.full 2>&1
+
+filter_attr_output() {
+	_filter_scratch | sed -e 's/has a [0-9]* byte value/has a NNNN byte value/g'
+}
+
+./src/attr_replace_test $SCRATCH_MNT/hello
+$ATTR_PROG -l $SCRATCH_MNT/hello | filter_attr_output
+
+status=0
+exit
tests/generic/706.out new file +2 -0
new file mode 100644
index 00000000..61c8419a
@@ -0,0 +1,2 @@
+QA output created by 706
+Attribute "world" has a NNNN byte value for SCRATCH_MNT/hello
tests/generic/group +1 -0
index 19be9267..54a85ea0 100644
@@ -487,3 +487,4 @@
 482 auto metadata replay
 483 auto quick log metadata
 484 auto quick
+706 auto quick attr
#3 lore raw

Re: [PATCH 1/9] generic: test XATTR_REPLACE doesn't take the fs down

Quoted 9 lines · Eryu Guan
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Kanda Motohiro reported that expanding a tiny xattr into a large xattr fails on XFS because we remove the tiny xattr from a shortform fork and then try to re-add it after converting the fork to extents format having not removed the ATTR_REPLACE flag. This fails because the attr is no longer present, causing a fs shutdown.

Quoted 7 lines
Quoted 3 lines

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199119

Thanks for the revision! Because I found more issues in v1 than I expected, so I drop the patch from last fstests update. I should have made that clear..

No worries, I was at LSF last week and probably should've sent a "there are enough bugs in this thing that I'll resend later" message.

Quoted 13 lines
Quoted 13 lines
---
 .gitignore              |    1 +
 src/Makefile            |    3 +-
 src/attr_replace_test.c |   60 +++++++++++++++++++++++++++++++++++++++++
 tests/generic/706       |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/706.out   |    2 +
 tests/generic/group     |    1 +
 6 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 src/attr_replace_test.c
 create mode 100755 tests/generic/706
 create mode 100644 tests/generic/706.out
Quoted 12 lines

.gitignore line 56

Quoted 9 lines
.gitignore +1 -0
index 192ca35e..af9743f9 100644
@@ -53,6 +53,7 @@
 /src/append_reader
 /src/append_writer
 /src/attr-list-by-handle-cursor-test
+/src/attr_replace_test

Seems this should be put before attr-list-by-handle-cursor-test, according to the result of sort.

Oops, yeah. Do you mind fixing this on the way in?

Quoted 63 lines
Quoted 40 lines
.gitignore +0 -0
 /src/bstat
 /src/bulkstat_unlink_test
 /src/bulkstat_unlink_test_modified
src/Makefile +2 -1
index 6ca56366..c42d3bb1 100644
@@ -25,7 +25,8 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \
 	renameat2 t_getcwd e4compact test-nextquota punch-alternating \
 	attr-list-by-handle-cursor-test listxattr dio-interleaved t_dir_type \
-	dio-invalidate-cache stat_test t_encrypted_d_revalidate
+	dio-invalidate-cache stat_test t_encrypted_d_revalidate \
+	attr_replace_test
 
 SUBDIRS = log-writes perf
 
src/attr_replace_test.c new file +17 -0
new file mode 100644
index 00000000..c870d165
@@ -0,0 +1,60 @@
+// setattr.c by [email protected]
+// xfs extended attribute corruption bug reproducer
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/xattr.h>
+#include <sys/stat.h>
+
+#define die() do { perror(""); \
+fprintf(stderr, "error=%d at line %d\n", errno, __LINE__); \
+exit(1); } while (0)
+
+int main(int argc, char *argv[])

src/attr_replace_test.c line 27

Quoted 10 lines
src/attr_replace_test.c new file +10 -0
+{
+	int ret;
+	int fd;
+	char *path;
+	char *name = "user.world";
+	char *value;
+	struct stat sbuf;
+	size_t size = sizeof(value);
+
+	if (argc != 2) die();

die() doesn't seem like the right thing to do (and some other places), it'll print something like:

Success
error=0 at line NN

I'd define a new "fail()" macro and use it where appropriate.

(quoted diff) +3 -0
+#define fail(...) do { \
+fprintf(stderr, __VA_ARGS__); exit (1); \
+} while (0)
Quoted 1 line

I can fix the minor issues on commit, for real this time :)

Ok.

Quoted 16 lines

Thanks,
Eryu

src/attr_replace_test.c line 40

Quoted 13 lines
src/attr_replace_test.c new file +13 -0
+	path = argv[1];
+
+	fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+	if (fd < 0) die();
+
+	/*
+	 * The value should be 3/4 the size of a fs block to ensure that we
+	 * get to extents format.
+	 */
+	ret = fstat(fd, &sbuf);
+	if (ret < 0) die();
+	size = sbuf.st_blksize * 3 / 4;
+	if (!size) die();

fail() here too, if you're fixing this up.

--D

Quoted 116 lines
Quoted 108 lines
src/attr_replace_test.c new file +20 -0
+	value = malloc(size);
+	if (!value) die();
+
+	// First, create a small xattr.
+	memset(value, '0', 1);
+	ret = fsetxattr(fd, name, value, 1, XATTR_CREATE);
+	if (ret < 0) die();
+	close(fd);
+
+	fd = open(path, O_RDWR);
+	if (fd < 0) die();
+
+	// Then, replace it with bigger one, forcing short form to leaf conversion.
+	memset(value, '1', size);
+	ret = fsetxattr(fd, name, value, size, XATTR_REPLACE);
+	if (ret < 0) die();
+	close(fd);
+
+	return 0;
+}
tests/generic/706 new file +68 -0
new file mode 100755
index 00000000..9f98c3b1
@@ -0,0 +1,68 @@
+#! /bin/bash
+# FS QA Test No. 706
+#
+# Ensure that we can XATTR_REPLACE a tiny attr into a large attr.
+# Kanda Motohiro <[email protected]> reports that XATTR_REPLACE'ing
+# a single-byte attr with a 2048-byte attr causes a fs shutdown because we
+# remove the shortform attr, convert the attr fork to long format, and then
+# try to re-add the attr having not cleared ATTR_REPLACE.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle.  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"
+
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $testfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_test_program "attr_replace_test"
+_require_attrs
+_require_scratch
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount >>$seqres.full 2>&1
+
+filter_attr_output() {
+	_filter_scratch | sed -e 's/has a [0-9]* byte value/has a NNNN byte value/g'
+}
+
+./src/attr_replace_test $SCRATCH_MNT/hello
+$ATTR_PROG -l $SCRATCH_MNT/hello | filter_attr_output
+
+status=0
+exit
tests/generic/706.out new file +2 -0
new file mode 100644
index 00000000..61c8419a
@@ -0,0 +1,2 @@
+QA output created by 706
+Attribute "world" has a NNNN byte value for SCRATCH_MNT/hello
tests/generic/group +0 -0
index 19be9267..54a85ea0 100644

tests/generic/group line 490

Quoted 4 lines
tests/generic/group +1 -0
@@ -487,3 +487,4 @@
 482 auto metadata replay
 483 auto quick log metadata
 484 auto quick
+706 auto quick attr

--
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

#4 lore raw

PATCH 2/9 xfs/439: repair corrupted filesystem afterwards

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

After we mess with logsunit and test that we can't mount the fs, repair the filesystem to make sure that repair can deal with it.

---
 tests/xfs/439 |    1 +
 1 file changed, 1 insertion(+)
tests/xfs/439 +1 -0
index 215c4b90..9d5f6892 100755
@@ -79,6 +79,7 @@ fi
 _check_dmesg _filter_assert_dmesg
 
 echo "Silence is golden"
+_scratch_xfs_repair >> $seqres.full 2>&1
 
 # success, all done
 status=0
#5 lore raw

Re: [PATCH 2/9] xfs/439: repair corrupted filesystem afterwards

Quoted 16 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

After we mess with logsunit and test that we can't mount the fs, repair the filesystem to make sure that repair can deal with it.

---
 tests/xfs/439 |    1 +
 1 file changed, 1 insertion(+)
tests/xfs/439 +0 -0
index 215c4b90..9d5f6892 100755

tests/xfs/439 fi · line 82

Quoted 4 lines
tests/xfs/439 +1 -0
@@ -79,6 +79,7 @@ fi
 _check_dmesg _filter_assert_dmesg
 
 echo "Silence is golden"
+_scratch_xfs_repair >> $seqres.full 2>&1

But how should we check if repair does fix the corruption? I tried adding a "scratch_mount" after the repair and expected a success mount. But that mount also failed, and repair didn't report anything wrong in $seqres.full. Looks like the corruption was not detected nor repaired.

[ 8278.679149] XFS (dm-1): Mounting V5 Filesystem
[ 8278.679743] XFS (dm-1): log stripe unit 4095 bytes must be a multiple of block size
[ 8278.680583] XFS (dm-1): AAIEEE! Log failed size checks. Abort!
[ 8278.681817] XFS (dm-1): log mount failed

Note that I was using latest for-next branch of xfsprogs.

Thanks,
Eryu

Quoted 4 lines
tests/xfs/439 +0 -0
 # success, all done
 status=0
 
#6 lore raw

Re: [PATCH 2/9] xfs/439: repair corrupted filesystem afterwards

Quoted 27 lines · Eryu Guan
Quoted 16 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

After we mess with logsunit and test that we can't mount the fs, repair the filesystem to make sure that repair can deal with it.

---
 tests/xfs/439 |    1 +
 1 file changed, 1 insertion(+)
tests/xfs/439 +0 -0
index 215c4b90..9d5f6892 100755

tests/xfs/439 fi · line 82

Quoted 4 lines
tests/xfs/439 +1 -0
@@ -79,6 +79,7 @@ fi
 _check_dmesg _filter_assert_dmesg
 
 echo "Silence is golden"
+_scratch_xfs_repair >> $seqres.full 2>&1

But how should we check if repair does fix the corruption? I tried adding a "scratch_mount" after the repair and expected a success mount. But that mount also failed, and repair didn't report anything wrong in $seqres.full. Looks like the corruption was not detected nor repaired.

Quoted 6 lines
[ 8278.679149] XFS (dm-1): Mounting V5 Filesystem
[ 8278.679743] XFS (dm-1): log stripe unit 4095 bytes must be a multiple of block size
[ 8278.680583] XFS (dm-1): AAIEEE! Log failed size checks. Abort!
[ 8278.681817] XFS (dm-1): log mount failed

Note that I was using latest for-next branch of xfsprogs.

Aha! This depends on "xfs_repair: validate some of the log space information" which is still out for review for xfs_repair 4.17. We can drop this for now. I'll add a _scratch_mount at the end before I resubmit this patch.

--D

Quoted 11 lines

Thanks,
Eryu

tests/xfs/439 fi

Quoted 4 lines
tests/xfs/439 +0 -0
 # success, all done
 status=0
 

--
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

#7 lore raw

Re: [PATCH 2/9] xfs/439: repair corrupted filesystem afterwards

Quoted 33 lines · Darrick J. Wong
Quoted 32 lines · Eryu Guan
Quoted 16 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

After we mess with logsunit and test that we can't mount the fs, repair the filesystem to make sure that repair can deal with it.

---
 tests/xfs/439 |    1 +
 1 file changed, 1 insertion(+)
tests/xfs/439 +0 -0
index 215c4b90..9d5f6892 100755

tests/xfs/439 fi · line 82

Quoted 4 lines
tests/xfs/439 +1 -0
@@ -79,6 +79,7 @@ fi
 _check_dmesg _filter_assert_dmesg
 
 echo "Silence is golden"
+_scratch_xfs_repair >> $seqres.full 2>&1

But how should we check if repair does fix the corruption? I tried adding a "scratch_mount" after the repair and expected a success mount. But that mount also failed, and repair didn't report anything wrong in $seqres.full. Looks like the corruption was not detected nor repaired.

[ 8278.679149] XFS (dm-1): Mounting V5 Filesystem
[ 8278.679743] XFS (dm-1): log stripe unit 4095 bytes must be a multiple of block size
[ 8278.680583] XFS (dm-1): AAIEEE! Log failed size checks. Abort!
[ 8278.681817] XFS (dm-1): log mount failed
Quoted 6 lines
Quoted 1 line

Note that I was using latest for-next branch of xfsprogs.

Aha! This depends on "xfs_repair: validate some of the log space information" which is still out for review for xfs_repair 4.17. We can drop this for now. I'll add a _scratch_mount at the end before I resubmit this patch.

Then the test would start to fail because of the newly added _scratch_mount test on systems that have old xfs_repair. I think it's better to add a new regression test for that xfs_repair fix.

Thanks,
Eryu

#8 lore raw

PATCH 3/9 generic/45[34]: add unicode directional override checks

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Try injecting a Unicode directional override character in the middle of a name to see if the fs can handle it / xfs_scrub will complain.

---
 tests/generic/453 |    7 +++++++
 tests/generic/454 |    7 +++++++
 2 files changed, 14 insertions(+)
tests/generic/453 +7 -0
index 424412e9..f2cd81fb 100755
@@ -112,6 +112,10 @@ setf "emoji_\xf0\x9f\xa6\x91\xf0\x9f\xa6\x8b\xf0\x9f\xa6\x89\xf0\x9f\xa6\x92.txt
 # Line draw characters, because why not?
 setf "\x6c\x69\x6e\x65\x64\x72\x61\x77\x5f\x0a\xe2\x95\x94\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x97\x0a\xe2\x95\x91\x20\x6d\x65\x74\x61\x74\x61\x62\x6c\x65\x20\xe2\x95\x91\x0a\xe2\x95\x9f\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x95\xa2\x0a\xe2\x95\x91\x20\x5f\x5f\x69\x6e\x64\x65\x78\x20\x20\x20\xe2\x95\x91\x0a\xe2\x95\x9a\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x9d\x0a.txt" "ugly box because we can"
 
+# unicode rtl widgets too...
+setf "moo\xe2\x80\xaegnp.txt" "Well say hello,"
+setf "mootxt.png" "Harvey"
+
 ls -la $testdir >> $seqres.full
 
 echo "Test files"
@@ -135,6 +139,9 @@ testf "emoji_\xf0\x9f\xa6\x91\xf0\x9f\xa6\x8b\xf0\x9f\xa6\x89\xf0\x9f\xa6\x92.tx
 
 testf "\x6c\x69\x6e\x65\x64\x72\x61\x77\x5f\x0a\xe2\x95\x94\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x97\x0a\xe2\x95\x91\x20\x6d\x65\x74\x61\x74\x61\x62\x6c\x65\x20\xe2\x95\x91\x0a\xe2\x95\x9f\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x95\xa2\x0a\xe2\x95\x91\x20\x5f\x5f\x69\x6e\x64\x65\x78\x20\x20\x20\xe2\x95\x91\x0a\xe2\x95\x9a\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x9d\x0a.txt" "ugly box because we can"
 
+testf "moo\xe2\x80\xaegnp.txt" "Well say hello,"
+testf "mootxt.png" "Harvey"
+
 echo "Uniqueness of inodes?"
 stat -c '%i' "${testdir}/"* | sort | uniq -c | while read nr inum; do
 	if [ "${nr}" -gt 1 ]; then
tests/generic/454 +7 -0
index 24727ab3..c6530290 100755
@@ -110,6 +110,10 @@ setf "emoji_\xf0\x9f\xa6\x91\xf0\x9f\xa6\x8b\xf0\x9f\xa6\x89\xf0\x9f\xa6\x92.txt
 # Line draw characters, because why not?
 setf "\x6c\x69\x6e\x65\x64\x72\x61\x77\x5f\x0a\xe2\x95\x94\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x97\x0a\xe2\x95\x91\x20\x6d\x65\x74\x61\x74\x61\x62\x6c\x65\x20\xe2\x95\x91\x0a\xe2\x95\x9f\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x95\xa2\x0a\xe2\x95\x91\x20\x5f\x5f\x69\x6e\x64\x65\x78\x20\x20\x20\xe2\x95\x91\x0a\xe2\x95\x9a\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x9d\x0a.txt" "ugly box because we can"
 
+# unicode rtl widgets too...
+setf "moo\xe2\x80\xaegnp.txt" "Well say hello,"
+setf "mootxt.png" "Harvey"
+
 $GETFATTR_PROG --absolute-names -d "${testfile}" >> $seqres.full
 
 echo "Test files"
@@ -133,6 +137,9 @@ testf "emoji_\xf0\x9f\xa6\x91\xf0\x9f\xa6\x8b\xf0\x9f\xa6\x89\xf0\x9f\xa6\x92.tx
 
 testf "\x6c\x69\x6e\x65\x64\x72\x61\x77\x5f\x0a\xe2\x95\x94\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x97\x0a\xe2\x95\x91\x20\x6d\x65\x74\x61\x74\x61\x62\x6c\x65\x20\xe2\x95\x91\x0a\xe2\x95\x9f\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x95\xa2\x0a\xe2\x95\x91\x20\x5f\x5f\x69\x6e\x64\x65\x78\x20\x20\x20\xe2\x95\x91\x0a\xe2\x95\x9a\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x9d\x0a.txt" "ugly box because we can"
 
+testf "moo\xe2\x80\xaegnp.txt" "Well say hello,"
+testf "mootxt.png" "Harvey"
+
 echo "Uniqueness of keys?"
 crazy_keys="$($GETFATTR_PROG --absolute-names -d "${testfile}" | egrep -c '(french_|chinese_|greek_|arabic_|urk)')"
 expected_keys=11
#9 lore raw

PATCH 4/9 generic/45[34]: check unicode names only if xfs_scrub linked against libicu

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Since we've rewriting the xfs_scrub Unicode name scanner to use libicu to detect potential spoof names, change our check for unicode-enabled name scanning xfs_scrub to look for libicu instead of libunistring, adjust the golden output to reflect the new library's detection capabilities and make sure we get all the scrub output by invoking with -v.

Note that this requires xfsprogs 4.16 or newer; since xfs_scrub is (for now) an experimental program, we don't care about breaking backwards compatibility.

---
 tests/generic/453 |    5 ++---
 tests/generic/454 |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
tests/generic/453 +2 -3
index f2cd81fb..6cb2a296 100755
@@ -158,7 +158,7 @@ check_xfs_scrub() {
 
 	# We only care if xfs_scrub has unicode string support...
 	if ! type ldd > /dev/null 2>&1 || \
-	   ! ldd "${XFS_SCRUB_PROG}" | grep -q libunistring; then
+	   ! ldd "${XFS_SCRUB_PROG}" | grep -q libicui18n; then
 		return 1
 	fi
 
@@ -166,9 +166,8 @@ check_xfs_scrub() {
 }
 
 if check_xfs_scrub; then
-	output="$(LC_ALL="C.UTF-8" ${XFS_SCRUB_PROG} -n "${SCRATCH_MNT}" 2>&1 | filter_scrub)"
+	output="$(LC_ALL="C.UTF-8" ${XFS_SCRUB_PROG} -v -n "${SCRATCH_MNT}" 2>&1 | filter_scrub)"
 	echo "${output}" | grep -q "french_" || echo "No complaints about french e accent?"
-	echo "${output}" | grep -q "chinese_" || echo "No complaints about chinese width-different?"
 	echo "${output}" | grep -q "greek_" || echo "No complaints about greek letter mess?"
 	echo "${output}" | grep -q "arabic_" || echo "No complaints about arabic expanded string?"
 	echo "Actual xfs_scrub output:" >> $seqres.full
tests/generic/454 +2 -3
index c6530290..ec4fb997 100755
@@ -154,7 +154,7 @@ check_xfs_scrub() {
 
 	# We only care if xfs_scrub has unicode string support...
 	if ! type ldd > /dev/null 2>&1 || \
-	   ! ldd "${XFS_SCRUB_PROG}" | grep -q libunistring; then
+	   ! ldd "${XFS_SCRUB_PROG}" | grep -q libicui18n; then
 		return 1
 	fi
 
@@ -162,9 +162,8 @@ check_xfs_scrub() {
 }
 
 if check_xfs_scrub; then
-	output="$(LC_ALL="C.UTF-8" ${XFS_SCRUB_PROG} -n "${SCRATCH_MNT}" 2>&1 | filter_scrub)"
+	output="$(LC_ALL="C.UTF-8" ${XFS_SCRUB_PROG} -v -n "${SCRATCH_MNT}" 2>&1 | filter_scrub)"
 	echo "${output}" | grep -q "french_" || echo "No complaints about french e accent?"
-	echo "${output}" | grep -q "chinese_" || echo "No complaints about chinese width-different?"
 	echo "${output}" | grep -q "greek_" || echo "No complaints about greek letter mess?"
 	echo "${output}" | grep -q "arabic_" || echo "No complaints about arabic expanded string?"
 	echo "Actual xfs_scrub output:" >> $seqres.full
#10 lore raw

PATCH 5/9 generic/45[34]: test unicode confusables

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Test if a filesystem will allow us to create names with easily confusable unicode sequences (character spoofing) and, if on XFS, whether or not xfs_scrub will notice.

---
 tests/generic/453 |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/454 |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+)
tests/generic/453 +54 -0
index 6cb2a296..91d163ca 100755
@@ -116,6 +116,33 @@ setf "\x6c\x69\x6e\x65\x64\x72\x61\x77\x5f\x0a\xe2\x95\x94\xe2\x95\x90\xe2\x95\x
 setf "moo\xe2\x80\xaegnp.txt" "Well say hello,"
 setf "mootxt.png" "Harvey"
 
+# mixed-script confusables
+setf "mixed_t\xce\xbfp.txt" "greek omicron instead of o"
+setf "mixed_top.txt" "greek omicron instead of o"
+
+# single-script spoofing
+setf "hyphens_a\xe2\x80\x90b.txt" "hyphens"
+setf "hyphens_a-b.txt" "hyphens"
+
+setf "dz_digraph_dze.txt" "d-z digraph"
+setf "dz_digraph_\xca\xa3e.txt" "d-z digraph"
+
+# inadequate rendering
+setf "inadequate_al.txt" "is it l or is it 1"
+setf "inadequate_a1.txt" "is it l or is it 1"
+
+# symbols
+setf "prohibition_Rs.txt" "rupee symbol"
+setf "prohibition_\xe2\x82\xa8.txt" "rupee symbol"
+
+# zero width joiners
+setf "zerojoin_moocow.txt" "zero width joiners"
+setf "zerojoin_moo\xe2\x80\x8dcow.txt" "zero width joiners"
+
+# combining marks
+setf "combmark_\xe1\x80\x9c\xe1\x80\xad\xe1\x80\xaf.txt" "combining marks"
+setf "combmark_\xe1\x80\x9c\xe1\x80\xaf\xe1\x80\xad.txt" "combining marks"
+
 ls -la $testdir >> $seqres.full
 
 echo "Test files"
@@ -142,6 +169,27 @@ testf "\x6c\x69\x6e\x65\x64\x72\x61\x77\x5f\x0a\xe2\x95\x94\xe2\x95\x90\xe2\x95\
 testf "moo\xe2\x80\xaegnp.txt" "Well say hello,"
 testf "mootxt.png" "Harvey"
 
+testf "mixed_t\xce\xbfp.txt" "greek omicron instead of o"
+testf "mixed_top.txt" "greek omicron instead of o"
+
+testf "hyphens_a\xe2\x80\x90b.txt" "hyphens"
+testf "hyphens_a-b.txt" "hyphens"
+
+testf "dz_digraph_dze.txt" "d-z digraph"
+testf "dz_digraph_\xca\xa3e.txt" "d-z digraph"
+
+testf "inadequate_al.txt" "is it l or is it 1"
+testf "inadequate_a1.txt" "is it l or is it 1"
+
+testf "prohibition_Rs.txt" "rupee symbol"
+testf "prohibition_\xe2\x82\xa8.txt" "rupee symbol"
+
+testf "zerojoin_moocow.txt" "zero width joiners"
+testf "zerojoin_moo\xe2\x80\x8dcow.txt" "zero width joiners"
+
+testf "combmark_\xe1\x80\x9c\xe1\x80\xad\xe1\x80\xaf.txt" "combining marks"
+testf "combmark_\xe1\x80\x9c\xe1\x80\xaf\xe1\x80\xad.txt" "combining marks"
+
 echo "Uniqueness of inodes?"
 stat -c '%i' "${testdir}/"* | sort | uniq -c | while read nr inum; do
 	if [ "${nr}" -gt 1 ]; then
@@ -170,6 +218,12 @@ if check_xfs_scrub; then
 	echo "${output}" | grep -q "french_" || echo "No complaints about french e accent?"
 	echo "${output}" | grep -q "greek_" || echo "No complaints about greek letter mess?"
 	echo "${output}" | grep -q "arabic_" || echo "No complaints about arabic expanded string?"
+	echo "${output}" | grep -q "mixed_" || echo "No complaints about mixed script confusables?"
+	echo "${output}" | grep -q "hyphens_" || echo "No complaints about hyphenation confusables?"
+	echo "${output}" | grep -q "dz_digraph_" || echo "No complaints about single script confusables?"
+	echo "${output}" | grep -q "inadequate_" || echo "No complaints about inadequate rendering confusables?"
+	echo "${output}" | grep -q "prohibition_" || echo "No complaints about prohibited sequence confusables?"
+	echo "${output}" | grep -q "zerojoin_" || echo "No complaints about zero-width join confusables?"
 	echo "Actual xfs_scrub output:" >> $seqres.full
 	echo "${output}" >> $seqres.full
 fi
tests/generic/454 +54 -0

72 lines not on this page · raw message

#11 lore raw

PATCH 6/9 generic/453: test creation of malicious directory entries

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Create malicious . and .. entries (you didn't see the zero-width joiners at the end, did you?) in a directory to see if scrub will pick them up.

---
 tests/generic/453 |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
tests/generic/453 +34 -0
index 91d163ca..8841f581 100755
@@ -62,6 +62,15 @@ setf() {
 	echo "Storing ${key} ($(hexbytes "${key}")) -> ${value}" >> $seqres.full
 }
 
+setd() {
+	key="$(echo -e "$1")"
+	value="$2"
+
+	mkdir -p "${testdir}/${key}"
+	echo "${value}" > "${testdir}/${key}/value"
+	echo "Storing ${key} ($(hexbytes "${key}")) -> ${value}" >> $seqres.full
+}
+
 testf() {
 	key="$(echo -e "$1")"
 	value="$2"
@@ -80,6 +89,24 @@ testf() {
 	fi
 }
 
+testd() {
+	key="$(echo -e "$1")"
+	value="$2"
+	fname="${testdir}/${key}/value"
+
+	echo "Testing ${key} ($(hexbytes "${key}")) -> ${value}" >> $seqres.full
+
+	if [ ! -e "${fname}" ]; then
+		echo "Key ${key} does not exist for ${value} test??"
+		return
+	fi
+
+	actual_value="$(cat "${fname}")"
+	if [ "${actual_value}" != "${value}" ]; then
+		echo "Key ${key} has value ${value}, expected ${actual_value}."
+	fi
+}
+
 filter_scrub() {
 	grep 'Unicode' | sed -e 's/^.*Duplicate/Duplicate/g'
 }
@@ -143,6 +170,10 @@ setf "zerojoin_moo\xe2\x80\x8dcow.txt" "zero width joiners"
 setf "combmark_\xe1\x80\x9c\xe1\x80\xad\xe1\x80\xaf.txt" "combining marks"
 setf "combmark_\xe1\x80\x9c\xe1\x80\xaf\xe1\x80\xad.txt" "combining marks"
 
+# fake dotdot entry
+setd ".\xe2\x80\x8d" "zero width joiners in dot entry"
+setd "..\xe2\x80\x8d" "zero width joiners in dotdot entry"
+
 ls -la $testdir >> $seqres.full
 
 echo "Test files"
@@ -190,6 +221,9 @@ testf "zerojoin_moo\xe2\x80\x8dcow.txt" "zero width joiners"
 testf "combmark_\xe1\x80\x9c\xe1\x80\xad\xe1\x80\xaf.txt" "combining marks"
 testf "combmark_\xe1\x80\x9c\xe1\x80\xaf\xe1\x80\xad.txt" "combining marks"
 
+testd ".\xe2\x80\x8d" "zero width joiners in dot entry"
+testd "..\xe2\x80\x8d" "zero width joiners in dotdot entry"
+
 echo "Uniqueness of inodes?"
 stat -c '%i' "${testdir}/"* | sort | uniq -c | while read nr inum; do
 	if [ "${nr}" -gt 1 ]; then
#12 lore raw

PATCH 7/9 xfs/422: add fsstress to the freeze-and-rmap-repair race test

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Add fsstress to the pile of things that we race with rmap repair to ensure that the rmap repair isolates the filesystem correctly while it is doing its repairs.

---
 tests/xfs/422 |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
tests/xfs/422 +18 -1
index a8fa5d5a..b2db713c 100755
@@ -51,6 +51,8 @@ _supported_fs xfs
 _require_xfs_scratch_rmapbt
 _require_xfs_io_command "scrub"
 _require_xfs_io_error_injection "force_repair"
+_require_command "$KILLALL_PROG" killall
+_require_command "$FSSTRESS_PROG" fsstress
 
 echo "Format and populate"
 _scratch_mkfs > "$seqres.full" 2>&1
@@ -89,18 +91,33 @@ repair_loop() {
 		$XFS_IO_PROG -x -c 'repair rmapbt 0' -c 'repair rmapbt 1' $SCRATCH_MNT 2>&1 | filter_output
 	done
 }
+stress_loop() {
+	end="$1"
+
+	FSSTRESS_ARGS=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000 $FSSTRESS_AVOID)
+	while [ "$(date +%s)" -lt $end ]; do
+		$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full
+	done
+}
 $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT
 
 start=$(date +%s)
 end=$((start + (30 * TIME_FACTOR) ))
 
 echo "Loop started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full
+stress_loop $end &
 freeze_loop $end &
 repair_loop $end &
 
-while [ "$(date +%s)" -lt $end ]; do
+# Wait until 2 seconds after the loops should have finished...
+while [ "$(date +%s)" -lt $((end + 2)) ]; do
 	sleep 1
 done
+
+# ...and clean up after the loops in case they didn't do it themselves.
+$KILLALL_PROG -TERM xfs_io fsstress >> $seqres.full 2>&1
+$XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
+
 echo "Loop finished at $(date)" >> $seqres.full
 echo "Test done"
 
#13 lore raw

Re: [PATCH 7/9] xfs/422: add fsstress to the freeze-and-rmap-repair race test

Quoted 17 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Add fsstress to the pile of things that we race with rmap repair to ensure that the rmap repair isolates the filesystem correctly while it is doing its repairs.

---
 tests/xfs/422 |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
tests/xfs/422 +0 -0
index a8fa5d5a..b2db713c 100755

tests/xfs/422 _supported_fs xfs · line 55

Quoted 5 lines
tests/xfs/422 +2 -0
@@ -51,6 +51,8 @@ _supported_fs xfs
 _require_xfs_scratch_rmapbt
 _require_xfs_io_command "scrub"
 _require_xfs_io_error_injection "force_repair"
+_require_command "$KILLALL_PROG" killall
+_require_command "$FSSTRESS_PROG" fsstress

This is not needed, as we already have

export FSSTRESS_PROG="./ltp/fsstress"
[ ! -x $FSSTRESS_PROG ] && _fatal "fsstress not found or executable"

in common/config. I can remove it on commit.

Thanks,
Eryu

Quoted 39 lines
tests/xfs/422 +16 -1
 echo "Format and populate"
 _scratch_mkfs > "$seqres.full" 2>&1
@@ -89,18 +91,33 @@ repair_loop() {
 		$XFS_IO_PROG -x -c 'repair rmapbt 0' -c 'repair rmapbt 1' $SCRATCH_MNT 2>&1 | filter_output
 	done
 }
+stress_loop() {
+	end="$1"
+
+	FSSTRESS_ARGS=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000 $FSSTRESS_AVOID)
+	while [ "$(date +%s)" -lt $end ]; do
+		$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full
+	done
+}
 $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT
 
 start=$(date +%s)
 end=$((start + (30 * TIME_FACTOR) ))
 
 echo "Loop started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full
+stress_loop $end &
 freeze_loop $end &
 repair_loop $end &
 
-while [ "$(date +%s)" -lt $end ]; do
+# Wait until 2 seconds after the loops should have finished...
+while [ "$(date +%s)" -lt $((end + 2)) ]; do
 	sleep 1
 done
+
+# ...and clean up after the loops in case they didn't do it themselves.
+$KILLALL_PROG -TERM xfs_io fsstress >> $seqres.full 2>&1
+$XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
+
 echo "Loop finished at $(date)" >> $seqres.full
 echo "Test done"
 
#14 lore raw

Re: [PATCH 7/9] xfs/422: add fsstress to the freeze-and-rmap-repair race test

Quoted 26 lines · Eryu Guan
Quoted 17 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Add fsstress to the pile of things that we race with rmap repair to ensure that the rmap repair isolates the filesystem correctly while it is doing its repairs.

---
 tests/xfs/422 |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
tests/xfs/422 +0 -0
index a8fa5d5a..b2db713c 100755

tests/xfs/422 _supported_fs xfs · line 55

Quoted 5 lines
tests/xfs/422 +2 -0
@@ -51,6 +51,8 @@ _supported_fs xfs
 _require_xfs_scratch_rmapbt
 _require_xfs_io_command "scrub"
 _require_xfs_io_error_injection "force_repair"
+_require_command "$KILLALL_PROG" killall
+_require_command "$FSSTRESS_PROG" fsstress

This is not needed, as we already have

Quoted 4 lines

export FSSTRESS_PROG="./ltp/fsstress"
[ ! -x $FSSTRESS_PROG ] && _fatal "fsstress not found or executable"

in common/config. I can remove it on commit.

Ok, sounds good. Thank you!

--D

Quoted 47 lines

Thanks,
Eryu

Quoted 29 lines
tests/xfs/422 +11 -1
 echo "Format and populate"
 _scratch_mkfs > "$seqres.full" 2>&1
@@ -89,18 +91,33 @@ repair_loop() {
 		$XFS_IO_PROG -x -c 'repair rmapbt 0' -c 'repair rmapbt 1' $SCRATCH_MNT 2>&1 | filter_output
 	done
 }
+stress_loop() {
+	end="$1"
+
+	FSSTRESS_ARGS=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000 $FSSTRESS_AVOID)
+	while [ "$(date +%s)" -lt $end ]; do
+		$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full
+	done
+}
 $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT
 
 start=$(date +%s)
 end=$((start + (30 * TIME_FACTOR) ))
 
 echo "Loop started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full
+stress_loop $end &
 freeze_loop $end &
 repair_loop $end &
 
-while [ "$(date +%s)" -lt $end ]; do
+# Wait until 2 seconds after the loops should have finished...
+while [ "$(date +%s)" -lt $((end + 2)) ]; do

tests/xfs/422 repair_loop() { · line 123

Quoted 10 lines
tests/xfs/422 +5 -0
 	sleep 1
 done
+
+# ...and clean up after the loops in case they didn't do it themselves.
+$KILLALL_PROG -TERM xfs_io fsstress >> $seqres.full 2>&1
+$XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
+
 echo "Loop finished at $(date)" >> $seqres.full
 echo "Test done"
 

--
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

#15 lore raw

PATCH 8/9 xfs: checkbashisms in all script files

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Find all the /bin/sh scripts in xfsprogs and check for bashisms.

---
 tests/xfs/711     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/711.out |    1 +
 tests/xfs/group   |    1 +
 3 files changed, 53 insertions(+)
 create mode 100755 tests/xfs/711
 create mode 100644 tests/xfs/711.out
tests/xfs/711 new file +51 -0
new file mode 100755
index 00000000..d3dc3cd4
@@ -0,0 +1,51 @@
+#! /bin/bash
+# FS QA Test No. 711
+#
+# checkbashisms on all /bin/sh scripts.  This is a maintainer script.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle, Inc.
+#
+# 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 "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment
+. ./common/rc
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"
+_require_command "$CHECKBASHISMS_PROG" checkbashisms
+
+test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
+
+rm -f $seqres.full
+
+find $WORKAREA -name 'xfs*.sh' -print0 | xargs -0 grep '^#!/bin/sh' | sed -e 's/:.*$//g' | while read f; do
+	$CHECKBASHISMS_PROG $f
+done
+
+status=0
tests/xfs/711.out new file +1 -0
new file mode 100644
index 00000000..52ff4745
@@ -0,0 +1 @@
+QA output created by 711
tests/xfs/group +1 -0
index 39e259e8..b7da3fba 100644
@@ -443,3 +443,4 @@
 443 auto quick ioctl fsr
 444 auto quick
 445 auto quick filestreams
+711 auto quick
#16 lore raw

Re: [PATCH 8/9] xfs: checkbashisms in all script files

Quoted 6 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Find all the /bin/sh scripts in xfsprogs and check for bashisms.

Looks fine to me, but I'd like a review from Eric too, as it's a "maintainer script" :)

Quoted 52 lines
---
 tests/xfs/711     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/711.out |    1 +
 tests/xfs/group   |    1 +
 3 files changed, 53 insertions(+)
 create mode 100755 tests/xfs/711
 create mode 100644 tests/xfs/711.out
tests/xfs/711 new file +37 -0
new file mode 100755
index 00000000..d3dc3cd4
@@ -0,0 +1,51 @@
+#! /bin/bash
+# FS QA Test No. 711
+#
+# checkbashisms on all /bin/sh scripts.  This is a maintainer script.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle, Inc.
+#
+# 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 "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment
+. ./common/rc
+
+# real QA test starts here

tests/xfs/711 line 47

Quoted 10 lines
tests/xfs/711 new file +10 -0
+_supported_fs xfs
+_supported_os Linux
+export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"
+_require_command "$CHECKBASHISMS_PROG" checkbashisms
+
+test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
+
+rm -f $seqres.full
+
+find $WORKAREA -name 'xfs*.sh' -print0 | xargs -0 grep '^#!/bin/sh' | sed -e 's/:.*$//g' | while read f; do

Do we care about spaces between "#!" and "/bin/sh"? i.e. "#! /bin/sh", sometimes there can be space(s).

Thanks,
Eryu

Quoted 21 lines
tests/xfs/711 new file +4 -0
+	$CHECKBASHISMS_PROG $f
+done
+
+status=0
tests/xfs/711.out new file +1 -0
new file mode 100644
index 00000000..52ff4745
@@ -0,0 +1 @@
+QA output created by 711
tests/xfs/group +1 -0
index 39e259e8..b7da3fba 100644
@@ -443,3 +443,4 @@
 443 auto quick ioctl fsr
 444 auto quick
 445 auto quick filestreams
+711 auto quick
#17 lore raw

Re: [PATCH 8/9] xfs: checkbashisms in all script files

Quoted 11 lines · Eryu Guan
Quoted 6 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Find all the /bin/sh scripts in xfsprogs and check for bashisms.

Looks fine to me, but I'd like a review from Eric too, as it's a "maintainer script" :)

A good idea, looks generally ok to me (and now we really wait for Eric).

[snip]

Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+find $WORKAREA -name 'xfs*.sh' -print0 | xargs -0 grep '^#!/bin/sh' | sed -e 's/:.*$//g' | while read f; do

Do we care about spaces between "#!" and "/bin/sh"? i.e. "#! /bin/sh", sometimes there can be space(s).

As far as I know, spaces are completely OK and allowed and accepted everywhere, so I would add them here too.

Jan

#18 lore raw

Re: [PATCH 8/9] xfs: checkbashisms in all script files

In reply to Eryu Guan
Quoted 68 lines · Eryu Guan
Quoted 6 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Find all the /bin/sh scripts in xfsprogs and check for bashisms.

Looks fine to me, but I'd like a review from Eric too, as it's a "maintainer script" :)

Quoted 57 lines
---
 tests/xfs/711     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/711.out |    1 +
 tests/xfs/group   |    1 +
 3 files changed, 53 insertions(+)
 create mode 100755 tests/xfs/711
 create mode 100644 tests/xfs/711.out
tests/xfs/711 new file +42 -0
new file mode 100755
index 00000000..d3dc3cd4
@@ -0,0 +1,51 @@
+#! /bin/bash
+# FS QA Test No. 711
+#
+# checkbashisms on all /bin/sh scripts.  This is a maintainer script.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle, Inc.
+#
+# 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 "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment
+. ./common/rc
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"
+_require_command "$CHECKBASHISMS_PROG" checkbashisms
+
Quoted 8 lines

tests/xfs/711 line 47

Quoted 5 lines
tests/xfs/711 new file +5 -0
+test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
+
+rm -f $seqres.full
+
+find $WORKAREA -name 'xfs*.sh' -print0 | xargs -0 grep '^#!/bin/sh' | sed -e 's/:.*$//g' | while read f; do

Do we care about spaces between "#!" and "/bin/sh"? i.e. "#! /bin/sh", sometimes there can be space(s).

Yes, I suppose we do care and should look for '^#!.*/bin/bash'. I'll also fix it to look only for files since that's all we care about.

--D

Quoted 28 lines

Thanks,
Eryu

Quoted 17 lines
tests/xfs/711 new file +4 -0
+	$CHECKBASHISMS_PROG $f
+done
+
+status=0
tests/xfs/711.out new file +1 -0
new file mode 100644
index 00000000..52ff4745
@@ -0,0 +1 @@
+QA output created by 711
tests/xfs/group +0 -0
index 39e259e8..b7da3fba 100644

tests/xfs/group line 446

Quoted 4 lines
tests/xfs/group +1 -0
@@ -443,3 +443,4 @@
 443 auto quick ioctl fsr
 444 auto quick
 445 auto quick filestreams
+711 auto quick

--
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

#19 lore raw

PATCH v2 8/9 xfs: checkbashisms in all script files

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Find all the /bin/sh scripts in xfsprogs and check for bashisms.

---
v2: fix find and regex we look for

---
 tests/xfs/711     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/711.out |    1 +
 tests/xfs/group   |    1 +
 3 files changed, 53 insertions(+)
 create mode 100755 tests/xfs/711
 create mode 100644 tests/xfs/711.out
tests/xfs/711 new file +51 -0
new file mode 100755
index 00000000..d15f3b9d
@@ -0,0 +1,51 @@
+#! /bin/bash
+# FS QA Test No. 711
+#
+# checkbashisms on all /bin/sh scripts.  This is a maintainer script.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle, Inc.
+#
+# 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 "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment
+. ./common/rc
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"
+_require_command "$CHECKBASHISMS_PROG" checkbashisms
+
+test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
+
+rm -f $seqres.full
+
+find $WORKAREA -type f -name 'xfs*.sh' -print0 | xargs -0 grep '^#!.*/bin/sh' | sed -e 's/:.*$//g' | while read f; do
+	$CHECKBASHISMS_PROG $f
+done
+
+status=0
tests/xfs/711.out new file +1 -0
new file mode 100644
index 00000000..52ff4745
@@ -0,0 +1 @@
+QA output created by 711
tests/xfs/group +1 -0
index 39e259e8..b7da3fba 100644
@@ -443,3 +443,4 @@
 443 auto quick ioctl fsr
 444 auto quick
 445 auto quick filestreams
+711 auto quick
#20 lore raw

PATCH 9/9 xfs: fix blocktrash fuzzers

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

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 _test_scratch_mount to guard against that.

---
 tests/xfs/086 |   15 ++++++++-------
 tests/xfs/087 |   19 ++++++++++---------
 tests/xfs/088 |   15 ++++++++-------
 tests/xfs/089 |   15 ++++++++-------
 tests/xfs/091 |   15 ++++++++-------
 tests/xfs/093 |   19 ++++++++++---------
 tests/xfs/097 |   19 ++++++++++---------
 tests/xfs/099 |   11 ++++++-----
 tests/xfs/100 |   11 ++++++-----
 tests/xfs/101 |   11 ++++++-----
 tests/xfs/102 |   11 ++++++-----
 tests/xfs/105 |   11 ++++++-----
 tests/xfs/112 |   11 ++++++-----
 tests/xfs/113 |   11 ++++++-----
 tests/xfs/117 |   25 +++++++++++++------------
 tests/xfs/120 |   17 +++++++++--------
 tests/xfs/123 |    7 ++++---
 tests/xfs/124 |    9 +++++----
 tests/xfs/125 |    9 +++++----
 tests/xfs/126 |    9 +++++----
 tests/xfs/235 |   11 ++++++-----
 tests/xfs/337 |   11 ++++++-----
 22 files changed, 157 insertions(+), 135 deletions(-)
tests/xfs/086 +8 -7
index 787f8865..98b45dde 100755
@@ -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
tests/xfs/087 +10 -9
index 58ba9586..65877c7c 100755
@@ -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
tests/xfs/088 +8 -7
index 36745b2f..14b1f115 100755
@@ -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
tests/xfs/089 +8 -7
index 52bdd542..e47f7fef 100755
@@ -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
tests/xfs/091 +8 -7
index ae623370..7adbdc9e 100755
@@ -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
tests/xfs/093 +10 -9
index 0f9311e9..440cdb66 100755
@@ -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
tests/xfs/097 +10 -9
index 303ad04f..703bd9b4 100755
@@ -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
tests/xfs/099 +6 -5
index 7835df9f..2d63536c 100755
@@ -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
tests/xfs/100 +6 -5
index ebb656d3..83146ee0 100755
@@ -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
tests/xfs/101 +6 -5
index 709fc9d3..426c3e9c 100755
@@ -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
tests/xfs/102 +6 -5
index 3d51c6a2..02bc35ca 100755
@@ -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
tests/xfs/105 +6 -5
index fc91a4f5..c3a853b0 100755
@@ -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
tests/xfs/112 +6 -5
index ae756845..cec3a168 100755
@@ -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
tests/xfs/113 +6 -5
index c347db78..17af3b66 100755
@@ -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
tests/xfs/117 +13 -12
index f0b95aa1..31eac295 100755
@@ -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
tests/xfs/120 +9 -8
index 5a38000c..39c41d98 100755
@@ -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
tests/xfs/123 +4 -3
index 7355e86a..2640d675 100755
@@ -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
tests/xfs/124 +5 -4
index a828dd6b..742ef75a 100755
@@ -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
tests/xfs/125 +5 -4
index 3afb4cc1..4ab0177d 100755
@@ -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
tests/xfs/126 +5 -4
index d696ff1f..de6e2fdb 100755
@@ -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
tests/xfs/235 +6 -5
index 88101f2d..84725b0a 100755
@@ -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
tests/xfs/337 +6 -5
index b61e7226..851b6439 100755
@@ -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