All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] miscellaneous tests
@ 2017-06-21 21:57 Darrick J. Wong
  2017-06-21 21:57 ` [PATCH 1/8] ext4: fsmap tests Darrick J. Wong
                   ` (12 more replies)
  0 siblings, 13 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:57 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

I decided to roll everything up into a patch series, though these
patches mostly address different things.

So... I've reposted the ext4 fsmap test, fixed up some tests to
reflect changes being finalized in xfsprogs 4.12, added a few more
reflink stress tests, and added a couple of new scrub stress tests.

--D

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 1/8] ext4: fsmap tests
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
@ 2017-06-21 21:57 ` Darrick J. Wong
  2017-06-23  7:41   ` Eryu Guan
  2017-06-21 21:57 ` [PATCH 2/8] xfs/274: flip shared bits to reflect xfsprogs usage Darrick J. Wong
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:57 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Test the GETFSMAP ioctl against ext4.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/ext4/700     |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/700.out |    7 +++++
 tests/ext4/701     |   65 ++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/701.out |    3 ++
 tests/ext4/702     |   66 +++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/702.out |    4 +++
 tests/ext4/group   |    3 ++
 7 files changed, 224 insertions(+)
 create mode 100755 tests/ext4/700
 create mode 100644 tests/ext4/700.out
 create mode 100755 tests/ext4/701
 create mode 100644 tests/ext4/701.out
 create mode 100755 tests/ext4/702
 create mode 100644 tests/ext4/702.out


diff --git a/tests/ext4/700 b/tests/ext4/700
new file mode 100755
index 0000000..a4a1b83
--- /dev/null
+++ b/tests/ext4/700
@@ -0,0 +1,76 @@
+#! /bin/bash
+# FS QA Test No. 700
+#
+# Check that getfsmap reports the BG metadata we're expecting.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017, Oracle and/or its affiliates.  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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ext4
+_require_scratch
+_require_xfs_io_command "fsmap"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT > $TEST_DIR/fsmap
+cat $TEST_DIR/fsmap >> $seqres.full
+
+echo "Check fs metadata" | tee -a $seqres.full
+x=$(grep -c 'static fs metadata' $TEST_DIR/fsmap)
+test $x -gt 0 || echo "No fs metadata?"
+
+echo "Check block bitmap" | tee -a $seqres.full
+x=$(grep -c 'special 102:1' $TEST_DIR/fsmap)
+test $x -gt 0 || echo "No block bitmaps?"
+
+echo "Check inode bitmap" | tee -a $seqres.full
+x=$(grep -c 'special 102:2' $TEST_DIR/fsmap)
+test $x -gt 0 || echo "No inode bitmaps?"
+
+echo "Check inodes" | tee -a $seqres.full
+x=$(grep -c 'inodes' $TEST_DIR/fsmap)
+test $x -gt 0 || echo "No inodes?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/700.out b/tests/ext4/700.out
new file mode 100644
index 0000000..3984319
--- /dev/null
+++ b/tests/ext4/700.out
@@ -0,0 +1,7 @@
+QA output created by 700
+Format and mount
+Get fsmap
+Check fs metadata
+Check block bitmap
+Check inode bitmap
+Check inodes
diff --git a/tests/ext4/701 b/tests/ext4/701
new file mode 100755
index 0000000..6ae93d7
--- /dev/null
+++ b/tests/ext4/701
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. 701
+#
+# Populate filesystem, check that fsmap -n10000 matches fsmap -n1.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017, Oracle and/or its affiliates.  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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f "$tmp".* $TEST_DIR/a $TEST_DIR/b
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/populate
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ext4
+_require_scratch
+_require_populate_commands
+_require_xfs_io_command "fsmap"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_populate_cached nofill > $seqres.full 2>&1
+
+echo "Compare fsmap" | tee -a $seqres.full
+_scratch_mount
+$XFS_IO_PROG -c 'fsmap -n 65536' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/a
+$XFS_IO_PROG -c 'fsmap -n 1' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/b
+cat $TEST_DIR/a $TEST_DIR/b >> $seqres.full
+
+diff -uw $TEST_DIR/a $TEST_DIR/b
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/701.out b/tests/ext4/701.out
new file mode 100644
index 0000000..41ef1c6
--- /dev/null
+++ b/tests/ext4/701.out
@@ -0,0 +1,3 @@
+QA output created by 701
+Format and mount
+Compare fsmap
diff --git a/tests/ext4/702 b/tests/ext4/702
new file mode 100755
index 0000000..ce3ae11
--- /dev/null
+++ b/tests/ext4/702
@@ -0,0 +1,66 @@
+#! /bin/bash
+# FS QA Test No. 702
+#
+# Check that getfsmap reports external log devices
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017, Oracle and/or its affiliates.  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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ext4
+_require_logdev
+_require_scratch
+_require_xfs_io_command "fsmap"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+echo "Get fsmap" | tee -a $seqres.full
+$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT >> $seqres.full
+$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
+
+echo "Check device field of FS metadata and journalling log"
+data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
+test "${data_dev}" != "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?"
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/702.out b/tests/ext4/702.out
new file mode 100644
index 0000000..1d3b7ef
--- /dev/null
+++ b/tests/ext4/702.out
@@ -0,0 +1,4 @@
+QA output created by 702
+Format and mount
+Get fsmap
+Check device field of FS metadata and journalling log
diff --git a/tests/ext4/group b/tests/ext4/group
index 664c059..9007adf 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -37,3 +37,6 @@
 306 auto rw resize quick
 307 auto ioctl rw defrag
 308 auto ioctl rw prealloc quick defrag
+700 auto quick fsmap
+701 auto quick fsmap
+702 auto quick fsmap


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 2/8] xfs/274: flip shared bits to reflect xfsprogs usage
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
  2017-06-21 21:57 ` [PATCH 1/8] ext4: fsmap tests Darrick J. Wong
@ 2017-06-21 21:57 ` Darrick J. Wong
  2017-06-21 21:57 ` [PATCH 3/8] xfs: don't allow realtime swap files Darrick J. Wong
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:57 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

xfs_io's fsmap command flipped the attrfork and shared bits, so we
have to change them here too.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/274 |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


diff --git a/tests/xfs/274 b/tests/xfs/274
index 209c067..ee433e0 100755
--- a/tests/xfs/274
+++ b/tests/xfs/274
@@ -70,7 +70,7 @@ $XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f1 | grep '^[[:space:]]*[0-9]*:' | grep -
 
 echo "Check f1 bmap and fsmap" | tee -a $seqres.full
 cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
-	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 1000000$"
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 0100000$"
 	echo "${qstr}" >> $seqres.full
 	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
 	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)
@@ -83,7 +83,7 @@ $XFS_IO_PROG -c 'bmap -v' $SCRATCH_MNT/f2 | grep '^[[:space:]]*[0-9]*:' | grep -
 
 echo "Check f2 bmap and fsmap" | tee -a $seqres.full
 cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total crap; do
-	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 1000000$"
+	qstr="^[[:space:]]*[0-9]*:[[:space:]]*[0-9]*:[0-9]*[[:space:]]*${blockrange} :[[:space:]]*${ino}[[:space:]]*${offrange}[[:space:]]*${ag}[[:space:]]*${agrange}[[:space:]]*${total} 0100000$"
 	echo "${qstr}" >> $seqres.full
 	grep "${qstr}" $TEST_DIR/fsmap >> $seqres.full
 	found=$(grep -c "${qstr}" $TEST_DIR/fsmap)


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 3/8] xfs: don't allow realtime swap files
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
  2017-06-21 21:57 ` [PATCH 1/8] ext4: fsmap tests Darrick J. Wong
  2017-06-21 21:57 ` [PATCH 2/8] xfs/274: flip shared bits to reflect xfsprogs usage Darrick J. Wong
@ 2017-06-21 21:57 ` Darrick J. Wong
  2017-06-21 21:57 ` [PATCH 4/8] xfs/040: use compare-libxfs in xfsprogs Darrick J. Wong
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:57 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, Christoph Hellwig, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Linux swapfiles use bmap which has no ability to tell the swap code
that the blocks its reporting aren't actually on the data device.
Therefore, swapon on a realtime file could corrupt random blocks on
the data device, so we must ensure that swapon cannot happen.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 tests/xfs/701     |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/701.out |    5 ++++
 tests/xfs/group   |    1 +
 3 files changed, 79 insertions(+)
 create mode 100755 tests/xfs/701
 create mode 100644 tests/xfs/701.out


diff --git a/tests/xfs/701 b/tests/xfs/701
new file mode 100755
index 0000000..e7b42ea
--- /dev/null
+++ b/tests/xfs/701
@@ -0,0 +1,73 @@
+#! /bin/bash
+# FS QA Test No. 701
+#
+# Check that we can't swapon a realtime file.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Oracle, Inc.  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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_require_realtime
+_require_scratch_swapfile
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blocks=160
+blksz=65536
+
+echo "Initialize file"
+echo >> $seqres.full
+$XFS_IO_PROG -c "open -f -R $testdir/dummy" $testdir >> $seqres.full
+echo moo >> $testdir/dummy
+$XFS_IO_PROG -c "open -f -R $testdir/file1" $testdir >> $seqres.full
+_pwrite_byte 0x61 0 $((blocks * blksz)) $testdir/file1 >> $seqres.full
+mkswap -U 27376b42-ff65-42ca-919f-6c9b62292a5c $testdir/file1 >> $seqres.full
+
+echo "Try to swapon"
+swapon $testdir/file1 2>&1 | _filter_scratch
+
+swapoff $testdir/file1 >> $seqres.full 2>&1
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/701.out b/tests/xfs/701.out
new file mode 100644
index 0000000..98fd3a1
--- /dev/null
+++ b/tests/xfs/701.out
@@ -0,0 +1,5 @@
+QA output created by 701
+Format and mount
+Initialize file
+Try to swapon
+swapon: SCRATCH_MNT/test-701/file1: swapon failed: Invalid argument
diff --git a/tests/xfs/group b/tests/xfs/group
index 792161a..5f37c5a 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -416,3 +416,4 @@
 416 dangerous_fuzzers dangerous_scrub dangerous_repair
 417 dangerous_fuzzers dangerous_scrub dangerous_online_repair
 418 dangerous_fuzzers dangerous_scrub dangerous_repair
+701 auto quick


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 4/8] xfs/040: use compare-libxfs in xfsprogs
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (2 preceding siblings ...)
  2017-06-21 21:57 ` [PATCH 3/8] xfs: don't allow realtime swap files Darrick J. Wong
@ 2017-06-21 21:57 ` Darrick J. Wong
  2017-06-21 21:57 ` [PATCH 5/8] reflink: test unlinking a huge extent with a lot of refcount adjustments Darrick J. Wong
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:57 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

xfsprogs now ships with a tool to compare its libxfs against a kernel
libxfs.  Since the old srcdiff tool assumes dmapi.h (IRIX only) and the
pre-libxfs directory tree layout, fix the test and remove the old tool.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/040      |   30 ++---
 tests/xfs/040.good |   16 ---
 tests/xfs/040.out  |  171 ++++++++++++++++++++++++++++
 tools/srcdiff      |  316 ----------------------------------------------------
 4 files changed, 184 insertions(+), 349 deletions(-)
 delete mode 100644 tests/xfs/040.good
 delete mode 100755 tools/srcdiff


diff --git a/tests/xfs/040 b/tests/xfs/040
index 7c2a008..fadb888 100755
--- a/tests/xfs/040
+++ b/tests/xfs/040
@@ -1,7 +1,7 @@
 #! /bin/bash
 # FS QA Test No. 040
 #
-# srcdiff test
+# compare-libxfs test
 #
 #-----------------------------------------------------------------------
 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
@@ -36,25 +36,23 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 . ./common/filter
 
 [ -z "$KWORKAREA" ] && \
-	_notrun "Can't run srcdiff without KWORKAREA set"
+	_notrun "Can't run libxfs-diff without KWORKAREA set"
 [ -d "$KWORKAREA/fs/xfs" ] || \
 	_notrun "Can't find XFS source under \"$KWORKAREA\""
 
 [ -z "$WORKAREA" ] && \
-	_notrun "Can't run srcdiff without WORKAREA set"
-[ -f "$WORKAREA/xfstests/tools/srcdiff" ] || \
-	_notrun "Can't find srcdiff tool under \"$WORKAREA\""
-[ -d "$WORKAREA/xfsprogs/include" ] || \
-	_notrun "Can't find XFS command headers under \"$WORKAREA\""
-
-# real QA test starts here
-cd "$WORKAREA/xfstests"
-echo Silence is golden.
-perl tools/srcdiff -q >$seqres.full
-if ! diff $seqres.full $seq.good >/dev/null; then
-    echo "FAILED: srcdiff output $seqres.full differs to $seq.good"
-    exit 1
-fi
+	_notrun "Can't run libxfs-diff without WORKAREA set"
+[ -f "$WORKAREA/tools/libxfs-diff" ] || \
+	_notrun "Can't find libxfs-diff tool under \"$WORKAREA\""
+
+filter_libxfs_diff() {
+	sed -e 's/^--- libxfs/--- xfsprogs\/libxfs/g' \
+	    -e 's/^+++ .*libxfs/+++ kernel\/libxfs/g' \
+	    -e 's/^@@.*$/@@ -XXXX,X +YYYY,Y @@/g'
+}
+
+# Compare the two libxfses
+(cd "$WORKAREA" ; ./tools/libxfs-diff "$KWORKAREA/fs/xfs/libxfs") | filter_libxfs_diff | tee -a $seqres.full
 
 # success, all done
 status=0
diff --git a/tests/xfs/040.good b/tests/xfs/040.good
deleted file mode 100644
index 6df7788..0000000
--- a/tests/xfs/040.good
+++ /dev/null
@@ -1,16 +0,0 @@
-
-=== Checking attr package ===
-
-=== Checking acl package ===
-
-=== Checking dmapi package ===
-
-=== Checking xfsdump package ===
-
-=== Checking xfsprogs package ===
-
-=== Checking headers ===
-
-=== Checking libxfs code ===
-
-=== Checking libxlog code ===
diff --git a/tests/xfs/040.out b/tests/xfs/040.out
index 45b1dea..1e4fb1e 100644
--- a/tests/xfs/040.out
+++ b/tests/xfs/040.out
@@ -1,2 +1,171 @@
 QA output created by 040
-Silence is golden.
+--- xfsprogs/libxfs/xfs_alloc.c
++++ kernel/libxfs/xfs_alloc.c
+@@ -XXXX,X +YYYY,Y @@
+ 		pag->pagf_refcount_level = be32_to_cpu(agf->agf_refcount_level);
+ 		spin_lock_init(&pag->pagb_lock);
+ 		pag->pagb_count = 0;
+-		/* XXX: pagb_tree doesn't exist in userspace */
+-		//pag->pagb_tree = RB_ROOT;
++		pag->pagb_tree = RB_ROOT;
+ 		pag->pagf_init = 1;
+ 	}
+ #ifdef DEBUG
+--- xfsprogs/libxfs/xfs_btree.c
++++ kernel/libxfs/xfs_btree.c
+@@ -XXXX,X +YYYY,Y @@
+ 	return error;
+ }
+ 
+-#ifdef __KERNEL__
+ struct xfs_btree_split_args {
+ 	struct xfs_btree_cur	*cur;
+ 	int			level;
+@@ -XXXX,X +YYYY,Y @@
+ 	destroy_work_on_stack(&args.work);
+ 	return args.result;
+ }
+-#else /* !KERNEL */
+-#define xfs_btree_split	__xfs_btree_split
+-#endif
+ 
+ 
+ /*
+--- xfsprogs/libxfs/xfs_dir2_sf.c
++++ kernel/libxfs/xfs_dir2_sf.c
+@@ -XXXX,X +YYYY,Y @@
+ 		 * Calculate the new size, see if we should give up yet.
+ 		 */
+ 		size = xfs_dir2_sf_hdr_size(i8count) +	/* header */
+-		       count * 3 * sizeof(__u8) +	/* namelen + offset */
++		       count * 3 * sizeof(u8) +		/* namelen + offset */
+ 		       namelen +			/* name */
+ 		       (i8count ?			/* inumber */
+ 				count * XFS_INO64_SIZE :
+--- xfsprogs/libxfs/xfs_fs.h
++++ kernel/libxfs/xfs_fs.h
+@@ -XXXX,X +YYYY,Y @@
+ #endif
+ 
+ /*
+- * Flags for the bs_xflags/fsx_xflags field in XFS_IOC_FS[GS]ETXATTR[A]
+- * These are for backwards compatibility only. New code should
+- * use the kernel [4.5 onwards] defined FS_XFLAG_* definitions directly.
+- */
+-#define	XFS_XFLAG_REALTIME	FS_XFLAG_REALTIME
+-#define	XFS_XFLAG_PREALLOC	FS_XFLAG_PREALLOC
+-#define	XFS_XFLAG_IMMUTABLE	FS_XFLAG_IMMUTABLE
+-#define	XFS_XFLAG_APPEND	FS_XFLAG_APPEND
+-#define	XFS_XFLAG_SYNC		FS_XFLAG_SYNC
+-#define	XFS_XFLAG_NOATIME	FS_XFLAG_NOATIME
+-#define	XFS_XFLAG_NODUMP	FS_XFLAG_NODUMP
+-#define	XFS_XFLAG_RTINHERIT	FS_XFLAG_RTINHERIT
+-#define	XFS_XFLAG_PROJINHERIT	FS_XFLAG_PROJINHERIT
+-#define	XFS_XFLAG_NOSYMLINKS	FS_XFLAG_NOSYMLINKS
+-#define	XFS_XFLAG_EXTSIZE	FS_XFLAG_EXTSIZE
+-#define	XFS_XFLAG_EXTSZINHERIT	FS_XFLAG_EXTSZINHERIT
+-#define	XFS_XFLAG_NODEFRAG	FS_XFLAG_NODEFRAG
+-#define	XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM
+-#define	XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR
+-
+-/*
+  * Structure for XFS_IOC_GETBMAP.
+  * On input, fill in bmv_offset and bmv_length of the first structure
+  * to indicate the area of interest in the file, and bmv_entries with
+@@ -XXXX,X +YYYY,Y @@
+ #define XFS_IOC_GET_AG_RESBLKS	     _IOR ('X', 126, struct xfs_fsop_ag_resblks)
+ /*	XFS_IOC_GETFSUUID ---------- deprecated 140	 */
+ 
+-/* reflink ioctls; these MUST match the btrfs ioctl definitions */
+-/* from struct btrfs_ioctl_clone_range_args */
+-struct xfs_clone_args {
+-	__s64 src_fd;
+-	__u64 src_offset;
+-	__u64 src_length;
+-	__u64 dest_offset;
+-};
+-
+-/* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */
+-#define XFS_EXTENT_DATA_SAME	0
+-#define XFS_EXTENT_DATA_DIFFERS	1
+-
+-/* from struct btrfs_ioctl_file_extent_same_info */
+-struct xfs_extent_data_info {
+-	__s64 fd;		/* in - destination file */
+-	__u64 logical_offset;	/* in - start of extent in destination */
+-	__u64 bytes_deduped;	/* out - total # of bytes we were able
+-				 * to dedupe from this file */
+-	/* status of this dedupe operation:
+-	 * < 0 for error
+-	 * == XFS_EXTENT_DATA_SAME if dedupe succeeds
+-	 * == XFS_EXTENT_DATA_DIFFERS if data differs
+-	 */
+-	__s32 status;		/* out - see above description */
+-	__u32 reserved;
+-};
+-
+-/* from struct btrfs_ioctl_file_extent_same_args */
+-struct xfs_extent_data {
+-	__u64 logical_offset;	/* in - start of extent in source */
+-	__u64 length;		/* in - length of extent */
+-	__u16 dest_count;	/* in - total elements in info array */
+-	__u16 reserved1;
+-	__u32 reserved2;
+-	struct xfs_extent_data_info info[0];
+-};
+-
+-#define XFS_IOC_CLONE		 _IOW (0x94, 9, int)
+-#define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
+-#define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
+ 
+ #ifndef HAVE_BBMACROS
+ /*
+--- xfsprogs/libxfs/xfs_inode_fork.c
++++ kernel/libxfs/xfs_inode_fork.c
+@@ -XXXX,X +YYYY,Y @@
+ 	xfs_ifork_t	*ifp,		/* inode fork pointer */
+ 	int		new_size)	/* new indirection array size */
+ {
+-#ifdef DEBUG
+ 	int		nlists;		/* number of irec's (ex lists) */
+ 	int		size;		/* current indirection array size */
+ 
+@@ -XXXX,X +YYYY,Y @@
+ 	size = nlists * sizeof(xfs_ext_irec_t);
+ 	ASSERT(ifp->if_real_bytes);
+ 	ASSERT((new_size >= 0) && (new_size != size));
+-#endif
+ 	if (new_size == 0) {
+ 		xfs_iext_destroy(ifp);
+ 	} else {
+--- xfsprogs/libxfs/xfs_sb.c
++++ kernel/libxfs/xfs_sb.c
+@@ -XXXX,X +YYYY,Y @@
+ 	}
+ 
+ 	/*
++	 * Until this is fixed only page-sized or smaller data blocks work.
++	 */
++	if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
++		xfs_warn(mp,
++		"File system with blocksize %d bytes. "
++		"Only pagesize (%ld) or less will currently work.",
++				sbp->sb_blocksize, PAGE_SIZE);
++		return -ENOSYS;
++	}
++
++	/*
+ 	 * Currently only very few inode sizes are supported.
+ 	 */
+ 	switch (sbp->sb_inodesize) {
+@@ -XXXX,X +YYYY,Y @@
+ 		return -EFBIG;
+ 	}
+ 
++	if (check_inprogress && sbp->sb_inprogress) {
++		xfs_warn(mp, "Offline file system operation in progress!");
++		return -EFSCORRUPTED;
++	}
+ 	return 0;
+ }
+ 
diff --git a/tools/srcdiff b/tools/srcdiff
deleted file mode 100755
index e490dfd..0000000
--- a/tools/srcdiff
+++ /dev/null
@@ -1,316 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) 2001-2008 Silicon Graphics, Inc.  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
-#
-#
-# srcdiff is used to compare current user level code with the current
-# kernel code and advise of any differences between files which are
-# sharing some or all of their content.
-#
-# There are two classes of sharing which we will check - header files
-# in the include directory, which must be exactly the same (use diff)
-# and source files which contain routines which must be exactly the
-# same (but the userland file is always a subset of the kernel file,
-# and hence a more flexible mechanism to "diff" is required).
-#
-# NB: to cross check that srcdiff is finding all the functions in the
-#     user source file, providing you have "mkproto" installed, you
-#     can "cd xfsprogs/libxfs" and cut&paste this in a bourne shell:
-#     $ for file in xfs_*.c; do
-#     > mkproto -nps < $file | perl -ne '
-#     > END { print "    $count\t- " }
-#     > s/^.* (xfs\w+|\*xfs\w+|xlog\w+|\*xlog\w+) \(.*/\1/ && { $count++ }'
-#     > echo $file
-#     > done
-# (compare this to "srcdiff | fgrep Total:")
-#
-
-use strict;
-
-die "WORKAREA not set" unless defined $ENV{'WORKAREA'};
-die "KWORKAREA not set" unless defined $ENV{'KWORKAREA'};
-die "DMWORKAREA not set" unless defined $ENV{'DMWORKAREA'};
-chdir $ENV{'WORKAREA'};
-my $dmworkarea = $ENV{'DMWORKAREA'};
-my $kworkarea = $ENV{'KWORKAREA'};
-my $xdiff = $ENV{'XDIFF'};
-my $quiet = 0;
-my $usage = 0;
-
-if ( ! -f "$kworkarea/xfs_fs.h" ) {
-	$kworkarea .= '/fs/xfs';
-	die "Cannot find XFS in KWORKAREA" unless -f "$kworkarea/xfs_fs.h";
-}
-die "Cannot find DMAPI in DMWORKAREA" unless -f "$dmworkarea/dmapi.h";
-
-foreach (@ARGV) {
-	if (/^-q$/) {
-		$quiet++;
-	} else {
-		print STDERR "Illegal option $_\n";
-		$usage++;
-	}
-}
-
-if ($usage) {
-    print STDERR "Usage: $0 [-q]\n";
-    exit 1;
-}
-
-my @pkglist = qw( xfstests attr acl dmapi xfsdump xfsprogs );
-my @difflist = qw(
-	xfs_ag.h  xfs_alloc.h  xfs_alloc_btree.h xfs_arch.h
-	xfs_attr_leaf.h  xfs_attr_sf.h  xfs_bit.h  xfs_bmap.h
-	xfs_bmap_btree.h  xfs_btree.h  xfs_buf_item.h
-	xfs_da_btree.h  xfs_dfrag.h  xfs_dinode.h
-	xfs_dir2.h  xfs_dir2_block.h  xfs_dir2_data.h
-	xfs_dir2_leaf.h  xfs_dir2_node.h  xfs_dir2_sf.h
-	xfs_extfree_item.h  xfs_ialloc.h
-	xfs_imap.h  xfs_ialloc_btree.h  xfs_inode.h  xfs_inode_item.h
-	xfs_inum.h  xfs_log.h  xfs_log_priv.h  xfs_log_recover.h
-	xfs_mount.h  xfs_quota.h  xfs_rtalloc.h
-	xfs_sb.h  xfs_trans.h  xfs_trans_space.h  xfs_types.h  xfs_fs.h
-);
-
-sub straightdiff {
-	my ( $file, $prefix1, $prefix2 ) = @_;
-
-	`diff $prefix1/$file $prefix2/$file >/dev/null 2>&1`;
-	if (!$quiet) {
-		print sprintf("\t%-35s ... ", $file);
-		if ($? != 0)	{ printf("FAILED\n(%s/%s differs to %s/%s)\n",
-					 $prefix1, $file, $prefix2, $file); }
-		else		{ print "ok\n"; }
-	} elsif ($? != 0) {
-	        printf("\t%-35s ... FAILED\n(%s/%s differs to %s/%s)\n",
-			$file, $prefix1, $file, $prefix2, $file);
-		if (defined($xdiff)) {
-			`$xdiff $prefix1/$file $prefix2/$file`;
-		}
-	}
-}
-
-#
-# xfstests directory m4 directory is a repository of all of the
-# custom m4 macros used in the packages we look after.
-#
-sub m4macrodiff {
-	my ( $package ) = @_;
-
-	foreach (`ls $package/m4/*.m4`) {
-		my $m4 = `basename $_`;
-		chomp($m4);
-		straightdiff $m4, "$package/m4", "xfstests/m4";
-	}
-}
-
-my $first = shift @pkglist;
-foreach (@pkglist) {
-	print "\n=== Checking $_ package ===\n";
-	m4macrodiff $_;
-	straightdiff 'buildrules', "$first/include", "$_/include";
-	straightdiff 'buildmacros', "$first/include", "$_/include";
-	straightdiff 'Makefile', "$first/build", "$_/build";
-	straightdiff 'Makefile', "$first/build/rpm", "$_/build/rpm";
-	straightdiff 'Makefile', "$first/build/tar", "$_/build/tar";
-}
-print "\n=== Checking headers ===\n";
-foreach (@difflist) {
-	straightdiff $_, 'xfsprogs/include', "$kworkarea";
-}
-straightdiff 'dmapi_kern.h', 'dmapi/include', "$dmworkarea";
-straightdiff 'dmapi.h', 'dmapi/include', "$dmworkarea";
-
-#
-# setstate
-# Implements a tri-state FSA, see comments for state transitions
-#  (knows about the way the XFS kernel code is written, & makes
-#   some assumptions so as to not need to parse generic C code).
-# Accepts one line at a time from a source file, picking out the
-#   function bodies so they can be subsequently compared.
-#
-
-my $line;	# line number in current source file
-my $state;	# current FSA state
-my $funcbody;	# current function body (contents)
-
-sub setstate {
-	my ( $newline ) = @_;
-	$line++;
-
-	# - state 0:
-	#	if line looks like start of a function, transition to 1
-	#		& squirrel line away as line 1 of current function
-	if ($state == 0) {
-		if ($newline =~ m/^[xfs|xlog]/) {
-			$state = 1;
-			$funcbody = $newline;
-		}
-	}
-
-	# - state 1:
-	#	if line looks like start of a function, stay here
-	#		& squirrel line away as line 1 of current function
-	#	otherwise if line isn't start of function body,
-	#		squirrel line away as next line of current function
-	#		(args/..., but not sure this is a real function yet)
-	#	otherwise (start of function)
-	#		squirrel line away as next line of current function
-	#		transition to state 2
-	elsif ($state == 1) {
-		if ($newline =~ m/^[xfs|xlog]/) {
-			$funcbody = $newline;
-		}
-		elsif ($newline =~ m/^\{/) {
-			$state = 2;
-			$funcbody .= $newline;
-		}
-	}
-
-	# - state 2:
-	#	if line looks like end of function body,
-	#		squirrel line away as last line of current function
-	#		tell someone we have a complete function ready
-	#		transition to state 0
-	#	otherwise
-	#		squirrel line away as next line of current function
-	elsif ($state == 2) {
-		$funcbody .= $newline;
-		if ($newline =~ m/^\}/) {
-			$state = 0;
-			return $funcbody;
-		}
-	}
-
-	else {
-		die "unknown state transition";
-	}
-	return undef;	# i.e. not at end of a function
-}
-
-sub listfuncs {
-	my ( $file ) = @_;
-	my @funcs;
-
-	$funcbody = '';
-	$state = $line = 0;
-
-	open(USER, "$file") || die "cannot open $file";
-	while (<USER>) {
-		my $func = setstate($_);
-		push @funcs, $func if (defined($func));	# store function away
-	}
-	close USER;
-	return @funcs;
-}
-
-sub hashfuncs {
-	my ( $file ) = @_;
-	my %funcs;
-
-	$funcbody = '';
-	$state = $line = 0;
-
-	open(KERN, "$file") || die "cannot open $file";
-	while (<KERN>) {
-		my $func = setstate($_);
-		if (defined($func)) {
-			$func =~ m/^([xfs|xlog]\w+)\s*\(/;
-			next unless defined($1);
-			my $name = $1;
-			if (defined($func)) {
-				$funcs{$name} = $func;	# store function away
-			}
-		}
-	}
-	close KERN;
-	return %funcs;
-}
-
-sub diffme {
-	my ( $sa, $sb ) = @_;
-
-	return unless defined($xdiff);
-
-	open(FILEA, "> /tmp/diff.user.$$") || die "cannot write to /tmp/diff.user.$$";
-	open(FILEB, "> /tmp/diff.kern.$$") || die "cannot write to /tmp/diff.kern.$$";
-	print FILEA $sa;
-	print FILEB $sb;
-	close FILEA;
-	close FILEB;
-	`$xdiff /tmp/diff.user.$$ /tmp/diff.kern.$$`;
-        unlink ("/tmp/diff.user.$$","/tmp/diff.kern.$$");
-}
-
-sub functiondiff {
-	my ( $file, $prefix1, $prefix2 ) = @_;
-	my $plural = '';
-	my $count = 0;
-	my $name;
-        my $found = 0;
-
-	print "\n=== Checking $file routines ===\n" unless ($quiet);
-
-	# iterate over user funcs, match up to kernel funcs
-	#
-	my @user = listfuncs "$prefix1/$file";
-	my %kern = hashfuncs "$prefix2/$file";
-
-	foreach my $userfunc (@user) {
-
-		$userfunc =~ m/^([xfs|xlog]\w+)\s*\(/;
-		next unless (defined($1));
-		$name = $1;
-		$count++;
-
-		if (exists($kern{$name})) {
-			if ($userfunc ne $kern{$name}) {
-	                        print "\n=== $file routines ===\n"
-                                    if (!$found++ && $quiet);
-
-			        printf("\t%-35s ... ", $name);
-				print "FAILED\n";
-				diffme $userfunc, $kern{$name};
-			}
-			elsif (!$quiet) {
-			        printf("\t%-35s ... ", $name);
-				print "ok\n";
-			}
-		}
-		else {
-			print "Cannot find kernel function $userfunc";
-			print " in file $prefix2/$file\n";
-		}
-	}
-	($count != 1) && ( $plural = 's' );
-	print "( Total: $count routine$plural checked in $file )\n" unless ($quiet);
-}
-
-# xfsprogs/{libxfs,libxlog}/* fs/xfs/*
-my @funclist = qw(
-	xfs_alloc.c  xfs_alloc_btree.c  xfs_attr.c  xfs_attr_leaf.c
-	xfs_bmap.c  xfs_bmap_btree.c  xfs_btree.c  xfs_da_btree.c
-	xfs_dir2.c  xfs_dir2_block.c  xfs_dir2_data.c xfs_dir2_leaf.c
-	xfs_dir2_node.c  xfs_dir2_sf.c xfs_ialloc.c  xfs_ialloc_btree.c
-	xfs_inode.c  xfs_mount.c  xfs_rtalloc.c xfs_trans.c
-);
-
-print "\n=== Checking libxfs code ===\n";
-foreach (@funclist) {
-	functiondiff $_, 'xfsprogs/libxfs', "$kworkarea";
-}
-print "\n=== Checking libxlog code ===\n";
-functiondiff 'xfs_log_recover.c', 'xfsprogs/libxlog', "$kworkarea";


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 5/8] reflink: test unlinking a huge extent with a lot of refcount adjustments
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (3 preceding siblings ...)
  2017-06-21 21:57 ` [PATCH 4/8] xfs/040: use compare-libxfs in xfsprogs Darrick J. Wong
@ 2017-06-21 21:57 ` Darrick J. Wong
  2017-06-29  9:36   ` Eryu Guan
  2017-06-21 21:57 ` [PATCH 6/8] xfs: test that we can SEEK_HOLE/DATA data and holes that are in the CoW fork only Darrick J. Wong
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:57 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Test a regression in XFS where we blow out a transaction reservation if
we create a big file, share every other block, and delete the first
file.  There's nothing particularly fs-specific about this stress test,
so put it in generic.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/931     |   94 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/931.out |    6 +++
 tests/generic/group   |    1 +
 3 files changed, 101 insertions(+)
 create mode 100755 tests/generic/931
 create mode 100644 tests/generic/931.out


diff --git a/tests/generic/931 b/tests/generic/931
new file mode 100755
index 0000000..afadf81
--- /dev/null
+++ b/tests/generic/931
@@ -0,0 +1,94 @@
+#! /bin/bash
+# FS QA Test No. 931
+#
+# See how well we handle deleting a file with a million refcount extents.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017, Oracle and/or its affiliates.  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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -rf "$tmp".* $testdir/file1
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_require_scratch_reflink
+_require_cp_reflink
+_require_test_program "punch-alternating"
+
+rm -f "$seqres.full"
+
+echo "Format and mount"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount >> "$seqres.full" 2>&1
+
+testdir="$SCRATCH_MNT/test-$seq"
+mkdir "$testdir"
+
+# Setup for one million blocks, but we'll accept stress testing down to
+# 2^17 blocks... that should be plenty for anyone.
+fnr=20
+free_blocks=$(stat -f -c '%a' "$testdir")
+blksz=$(_get_block_size "$testdir")
+space_avail=$((free_blocks * blksz))
+calc_space() {
+	blocks_needed=$(( 2 ** (fnr + 1) ))
+	space_needed=$((blocks_needed * blksz * 5 / 4))
+}
+calc_space
+while test $space_needed -gt $space_avail; do
+	fnr=$((fnr - 1))
+	calc_space
+done
+test $fnr -lt 17 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents ($space_needed/$space_avail blocks)."
+
+echo "Create a many-block file"
+echo "creating $blocks_needed blocks..." >> "$seqres.full"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b 4194304 0 $((2 ** (fnr + 1) * blksz))" "$testdir/file1" >> "$seqres.full"
+
+echo "Reflinking file"
+_cp_reflink $testdir/file1 $testdir/file2
+
+echo "Punch file2"
+echo "Punching file2..." >> "$seqres.full"
+"$here/src/punch-alternating" "$testdir/file2" >> "$seqres.full"
+echo "...done" >> "$seqres.full"
+_scratch_cycle_mount
+
+echo "Delete file1"
+rm -rf $testdir/file1
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/931.out b/tests/generic/931.out
new file mode 100644
index 0000000..c7b724e
--- /dev/null
+++ b/tests/generic/931.out
@@ -0,0 +1,6 @@
+QA output created by 931
+Format and mount
+Create a many-block file
+Reflinking file
+Punch file2
+Delete file1
diff --git a/tests/generic/group b/tests/generic/group
index ab1e9d3..b0d1844 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -443,3 +443,4 @@
 438 auto
 439 auto quick punch
 440 auto quick encrypt
+931 auto quick clone


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 6/8] xfs: test that we can SEEK_HOLE/DATA data and holes that are in the CoW fork only
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (4 preceding siblings ...)
  2017-06-21 21:57 ` [PATCH 5/8] reflink: test unlinking a huge extent with a lot of refcount adjustments Darrick J. Wong
@ 2017-06-21 21:57 ` Darrick J. Wong
  2017-06-21 21:58 ` [PATCH 7/8] xfs: test freeze/rmap repair race Darrick J. Wong
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:57 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Create a file with a hole in the data fork and CoW reservations in the
same region in the CoW fork.  Ensure that SEEK_HOLE/DATA find the data.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/901     |  160 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/901.out |   52 +++++++++++++++++
 tests/xfs/902     |  160 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/902.out |   52 +++++++++++++++++
 tests/xfs/group   |    2 +
 5 files changed, 426 insertions(+)
 create mode 100755 tests/xfs/901
 create mode 100644 tests/xfs/901.out
 create mode 100755 tests/xfs/902
 create mode 100644 tests/xfs/902.out


diff --git a/tests/xfs/901 b/tests/xfs/901
new file mode 100755
index 0000000..7ac618e
--- /dev/null
+++ b/tests/xfs/901
@@ -0,0 +1,160 @@
+#! /bin/bash
+# FS QA Test No. 901
+#
+# Test SEEK_HOLE/SEEK_DATA into a region that is marked CoW'd for
+# speculative preallocation in the CoW fork and isn't backed by
+# data fork extents.
+#
+# - Set a huge cowextsize hint.
+# - Create a file "DD      " (two data blocks, six hole blocks)
+# - Reflink copy this file to a second file.
+# - Write to the first block of the second file to create a single
+#   large CoW reservation covering the whole file.
+# - Write to block 3, which should be a hole in the data fork.
+# - Display the SEEK_HOLE/SEEK_DATA info for the second file to confirm
+#   that we see the data in blocks 0-1, the hole at block 2, the data
+#   at block 3, and the hole for the rest of the file.
+#
+# Basically we want to create a file with the following data/CoW forks:
+#
+# data: DD------
+#  cow: dddddddd
+#       ^--^---------- these blocks are dirty
+#
+# And then check that SEEK_HOLE and SEEK_DATA actually find that second
+# dirty block even though we've never had a data fork extent mapping the
+# second dirty block.  We need the huge cowextsize so that the hole
+# area receives preallocation in the CoW fork.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017, Oracle and/or its affiliates.  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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "cowextsize"
+_require_xfs_io_command "fpunch"
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=8
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize" $testdir >> $seqres.full
+$XFS_IO_PROG -c "cowextsize $filesize" $testdir >> $seqres.full
+$XFS_IO_PROG -c "cowextsize" $testdir >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((blksz * 2))" -c "truncate $filesize" -c "fpunch $((blksz * 2)) $((blksz * (nr - 2) ))" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0 0 $filesize" -c "pwrite -S 0x61 0 $((blksz * 2))" $testdir/file3 >> $seqres.full
+_scratch_cycle_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "CoW the shared part then write into the empty part" | tee -a $seqres.full
+$XFS_IO_PROG -c "cowextsize" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -c "pwrite -S 0x63 0 $blksz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -c "pwrite -S 0x63 $((blksz * 3)) $blksz" $testdir/file2 >> $seqres.full
+
+$XFS_IO_PROG -c "pwrite -S 0x63 0 $blksz" $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -c "pwrite -S 0x63 $((blksz * 3)) $blksz" $testdir/file3 >> $seqres.full
+
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file1 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file2 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file3 >> $seqres.full 2>&1
+
+echo "Seek holes and data in file1"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file1
+echo "Seek holes and data in file2"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file2
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "sync filesystem" | tee -a $seqres.full
+sync
+
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file1 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file2 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file3 >> $seqres.full 2>&1
+
+echo "Seek holes and data in file1"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file1
+echo "Seek holes and data in file2"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file2
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "Remount" | tee -a $seqres.full
+_scratch_cycle_mount
+
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file1 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file2 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file3 >> $seqres.full 2>&1
+
+echo "Seek holes and data in file1"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file1
+echo "Seek holes and data in file2"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file2
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/901.out b/tests/xfs/901.out
new file mode 100644
index 0000000..4a829e3
--- /dev/null
+++ b/tests/xfs/901.out
@@ -0,0 +1,52 @@
+QA output created by 901
+Format and mount
+Create the original files
+Compare files
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-901/file1
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-901/file2
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-901/file3
+CoW the shared part then write into the empty part
+Seek holes and data in file1
+Whence	Result
+DATA	0
+HOLE	131072
+Seek holes and data in file2
+Whence	Result
+DATA	0
+HOLE	131072
+DATA	196608
+HOLE	262144
+Compare files
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-901/file1
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-901/file2
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-901/file3
+sync filesystem
+Seek holes and data in file1
+Whence	Result
+DATA	0
+HOLE	131072
+Seek holes and data in file2
+Whence	Result
+DATA	0
+HOLE	131072
+DATA	196608
+HOLE	262144
+Compare files
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-901/file1
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-901/file2
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-901/file3
+Remount
+Seek holes and data in file1
+Whence	Result
+DATA	0
+HOLE	131072
+Seek holes and data in file2
+Whence	Result
+DATA	0
+HOLE	131072
+DATA	196608
+HOLE	262144
+Compare files
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-901/file1
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-901/file2
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-901/file3
diff --git a/tests/xfs/902 b/tests/xfs/902
new file mode 100755
index 0000000..c2933ab
--- /dev/null
+++ b/tests/xfs/902
@@ -0,0 +1,160 @@
+#! /bin/bash
+# FS QA Test No. 902
+#
+# Test SEEK_HOLE/SEEK_DATA into a region that is marked CoW'd for
+# speculative preallocation in the CoW fork and isn't backed by
+# data fork extents.
+#
+# - Set a huge cowextsize hint.
+# - Create a file "DD      " (two data blocks, six hole blocks)
+# - Reflink copy this file to a second file.
+# - dio write to the first block of the second file to create a single
+#   large CoW reservation covering the whole file.
+# - dio write to block 3, which should be a hole in the data fork.
+# - Display the SEEK_HOLE/SEEK_DATA info for the second file to confirm
+#   that we see the data in blocks 0-1, the hole at block 2, the data
+#   at block 3, and the hole for the rest of the file.
+#
+# Basically we want to create a file with the following data/CoW forks:
+#
+# data: DD------
+#  cow: dddddddd
+#       ^--^---------- these blocks are dirty
+#
+# And then check that SEEK_HOLE and SEEK_DATA actually find that second
+# dirty block even though we've never had a data fork extent mapping the
+# second dirty block.  We need the huge cowextsize so that the hole
+# area receives preallocation in the CoW fork.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017, Oracle and/or its affiliates.  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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/reflink
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_reflink
+_require_cp_reflink
+_require_xfs_io_command "cowextsize"
+_require_xfs_io_command "fpunch"
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+blksz=65536
+nr=8
+filesize=$((blksz * nr))
+
+echo "Create the original files"
+$XFS_IO_PROG -c "cowextsize" $testdir >> $seqres.full
+$XFS_IO_PROG -c "cowextsize $filesize" $testdir >> $seqres.full
+$XFS_IO_PROG -c "cowextsize" $testdir >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 $((blksz * 2))" -c "truncate $filesize" -c "fpunch $((blksz * 2)) $((blksz * (nr - 2) ))" $testdir/file1 >> $seqres.full
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0 0 $filesize" -c "pwrite -S 0x61 0 $((blksz * 2))" $testdir/file3 >> $seqres.full
+_scratch_cycle_mount
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "CoW the shared part then write into the empty part" | tee -a $seqres.full
+$XFS_IO_PROG -c "cowextsize" $testdir/file1 >> $seqres.full
+$XFS_IO_PROG -c "cowextsize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -c "pwrite -S 0x63 0 $blksz" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -d -c "pwrite -S 0x63 $((blksz * 3)) $blksz" $testdir/file2 >> $seqres.full
+
+$XFS_IO_PROG -d -c "pwrite -S 0x63 0 $blksz" $testdir/file3 >> $seqres.full
+$XFS_IO_PROG -d -c "pwrite -S 0x63 $((blksz * 3)) $blksz" $testdir/file3 >> $seqres.full
+
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file1 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file2 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file3 >> $seqres.full 2>&1
+
+echo "Seek holes and data in file1"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file1
+echo "Seek holes and data in file2"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file2
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "sync filesystem" | tee -a $seqres.full
+sync
+
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file1 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file2 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file3 >> $seqres.full 2>&1
+
+echo "Seek holes and data in file1"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file1
+echo "Seek holes and data in file2"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file2
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+echo "Remount" | tee -a $seqres.full
+_scratch_cycle_mount
+
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file1 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file2 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file3 >> $seqres.full 2>&1
+
+echo "Seek holes and data in file1"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file1
+echo "Seek holes and data in file2"
+$XFS_IO_PROG -c "seek -a -r 0" $testdir/file2
+
+echo "Compare files"
+md5sum $testdir/file1 | _filter_scratch
+md5sum $testdir/file2 | _filter_scratch
+md5sum $testdir/file3 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/902.out b/tests/xfs/902.out
new file mode 100644
index 0000000..d5b8eae
--- /dev/null
+++ b/tests/xfs/902.out
@@ -0,0 +1,52 @@
+QA output created by 902
+Format and mount
+Create the original files
+Compare files
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-902/file1
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-902/file2
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-902/file3
+CoW the shared part then write into the empty part
+Seek holes and data in file1
+Whence	Result
+DATA	0
+HOLE	131072
+Seek holes and data in file2
+Whence	Result
+DATA	0
+HOLE	131072
+DATA	196608
+HOLE	262144
+Compare files
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-902/file1
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-902/file2
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-902/file3
+sync filesystem
+Seek holes and data in file1
+Whence	Result
+DATA	0
+HOLE	131072
+Seek holes and data in file2
+Whence	Result
+DATA	0
+HOLE	131072
+DATA	196608
+HOLE	262144
+Compare files
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-902/file1
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-902/file2
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-902/file3
+Remount
+Seek holes and data in file1
+Whence	Result
+DATA	0
+HOLE	131072
+Seek holes and data in file2
+Whence	Result
+DATA	0
+HOLE	131072
+DATA	196608
+HOLE	262144
+Compare files
+c2803804acc9936eef8aab42c119bfac  SCRATCH_MNT/test-902/file1
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-902/file2
+017c08a9320aad844ce86aa9631afb98  SCRATCH_MNT/test-902/file3
diff --git a/tests/xfs/group b/tests/xfs/group
index 5f37c5a..faf0095 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -417,3 +417,5 @@
 417 dangerous_fuzzers dangerous_scrub dangerous_online_repair
 418 dangerous_fuzzers dangerous_scrub dangerous_repair
 701 auto quick
+901 auto quick clone dedupe
+902 auto quick clone dedupe


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 7/8] xfs: test freeze/rmap repair race
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (5 preceding siblings ...)
  2017-06-21 21:57 ` [PATCH 6/8] xfs: test that we can SEEK_HOLE/DATA data and holes that are in the CoW fork only Darrick J. Wong
@ 2017-06-21 21:58 ` Darrick J. Wong
  2017-06-29  9:47   ` Eryu Guan
  2017-06-21 21:58 ` [PATCH 8/8] xfs: scrub while appending to a file Darrick J. Wong
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:58 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

The rmapbt repair code plays some dirty tricks with the fs freezer to
avoid running afoul of regular xfs locking requirements.  Add a test to
check that filesystem write activities do not deadlock with the repair
program.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/1378     |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/1378.out |    4 ++
 tests/xfs/group    |    1 
 3 files changed, 114 insertions(+)
 create mode 100755 tests/xfs/1378
 create mode 100644 tests/xfs/1378.out


diff --git a/tests/xfs/1378 b/tests/xfs/1378
new file mode 100755
index 0000000..79ba6bc
--- /dev/null
+++ b/tests/xfs/1378
@@ -0,0 +1,109 @@
+#! /bin/bash
+# FS QA Test No. 1378
+#
+# Race freeze and rmapbt repair for a while to see if we crash or livelock.
+# rmapbt repair requires us to freeze the filesystem to stop all filesystem
+# activity, so we can't have userspace wandering in and thawing it.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Oracle, Inc.  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-1335  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 "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_xfs_scratch_rmapbt
+_require_xfs_io_command "scrub"
+_require_xfs_io_error_injection "force_repair"
+
+echo "Format and populate"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+STRESS_DIR="$SCRATCH_MNT/testdir"
+mkdir -p $STRESS_DIR
+
+for i in $(seq 0 9); do
+	mkdir -p $STRESS_DIR/$i
+	for j in $(seq 0 9); do
+		mkdir -p $STRESS_DIR/$i/$j
+		for k in $(seq 0 9); do
+			echo x > $STRESS_DIR/$i/$j/$k
+		done
+	done
+done
+
+cpus=$(( $(src/feature -o) * 4 * LOAD_FACTOR))
+
+echo "Concurrent repair"
+filter_output() {
+	egrep -v '(Device or resource busy|Invalid argument)'
+}
+freeze_loop() {
+	end="$1"
+
+	while [ "$(date +%s)" -lt $end ]; do
+		$XFS_IO_PROG -x -c 'freeze' -c 'thaw' $SCRATCH_MNT 2>&1 | filter_output
+	done
+}
+repair_loop() {
+	end="$1"
+
+	while [ "$(date +%s)" -lt $end ]; do
+		$XFS_IO_PROG -x -c 'repair rmapbt 0' -c 'repair rmapbt 1' $SCRATCH_MNT 2>&1 | filter_output
+	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
+freeze_loop $end &
+repair_loop $end &
+
+while [ "$(date +%s)" -lt $end ]; do
+	sleep 1
+done
+echo "Loop finished at $(date)" >> $seqres.full
+echo "Test done"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/1378.out b/tests/xfs/1378.out
new file mode 100644
index 0000000..030e250
--- /dev/null
+++ b/tests/xfs/1378.out
@@ -0,0 +1,4 @@
+QA output created by 1378
+Format and populate
+Concurrent repair
+Test done
diff --git a/tests/xfs/group b/tests/xfs/group
index faf0095..d0a6831 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -419,3 +419,4 @@
 701 auto quick
 901 auto quick clone dedupe
 902 auto quick clone dedupe
+1378 dangerous_scrub dangerous_online_repair


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 8/8] xfs: scrub while appending to a file
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (6 preceding siblings ...)
  2017-06-21 21:58 ` [PATCH 7/8] xfs: test freeze/rmap repair race Darrick J. Wong
@ 2017-06-21 21:58 ` Darrick J. Wong
  2017-06-22  6:26 ` [PATCH 9/8] common/populate: remember multi-device configurations Darrick J. Wong
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-21 21:58 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

It turns out that there was a bug in xfs_bmap_count_blocks wherein the
block count returned would count or not count delalloc blocks depending
on the fork format.  This is a bug that is easily exposed via scrub, so
check the output of that function here -- the buggy version of the
function produces online fsck errors.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/1379     |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/1379.out |    6 ++++
 tests/xfs/group    |    1 +
 3 files changed, 89 insertions(+)
 create mode 100755 tests/xfs/1379
 create mode 100644 tests/xfs/1379.out


diff --git a/tests/xfs/1379 b/tests/xfs/1379
new file mode 100755
index 0000000..acb797e
--- /dev/null
+++ b/tests/xfs/1379
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test No. 1379
+#
+# Race scrubbing the inode record while appending to a file.
+# This exposes a bug in xfs_bmap_count_blocks where we count delalloc
+# extents for di_nblocks if the fork is in extents format, but we don't
+# count them if the fork is in btree format.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Oracle, Inc.  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-1335  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 "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_test_program "punch-alternating"
+_require_xfs_io_command "scrub"
+_require_scratch
+
+echo "Format and populate"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+$XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/a >> $seqres.full
+$XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/b >> $seqres.full
+./src/punch-alternating $SCRATCH_MNT/b
+sync
+
+echo "Set up delalloc extents"
+$XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/a >> $seqres.full
+$XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/b >> $seqres.full
+$XFS_IO_PROG -c 'bmap -ev' $SCRATCH_MNT/a $SCRATCH_MNT/b > $SCRATCH_MNT/before
+cat $SCRATCH_MNT/before >> $seqres.full
+
+echo "Scrub a and b"
+$XFS_IO_PROG -x -c 'scrub inode' $SCRATCH_MNT/a >> $seqres.full
+$XFS_IO_PROG -x -c 'scrub inode' $SCRATCH_MNT/b >> $seqres.full
+$XFS_IO_PROG -c 'bmap -ev' $SCRATCH_MNT/a $SCRATCH_MNT/b > $SCRATCH_MNT/after
+cat $SCRATCH_MNT/after >> $seqres.full
+
+echo "Compare extent maps"
+diff -u $SCRATCH_MNT/before $SCRATCH_MNT/after
+
+echo "Test done"
+status=0
+exit
diff --git a/tests/xfs/1379.out b/tests/xfs/1379.out
new file mode 100644
index 0000000..67ad05f
--- /dev/null
+++ b/tests/xfs/1379.out
@@ -0,0 +1,6 @@
+QA output created by 1379
+Format and populate
+Set up delalloc extents
+Scrub a and b
+Compare extent maps
+Test done
diff --git a/tests/xfs/group b/tests/xfs/group
index d0a6831..dd10df3 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -420,3 +420,4 @@
 901 auto quick clone dedupe
 902 auto quick clone dedupe
 1378 dangerous_scrub dangerous_online_repair
+1379 dangerous_scrub


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 9/8] common/populate: remember multi-device configurations
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (7 preceding siblings ...)
  2017-06-21 21:58 ` [PATCH 8/8] xfs: scrub while appending to a file Darrick J. Wong
@ 2017-06-22  6:26 ` Darrick J. Wong
  2017-06-23  7:49   ` Eryu Guan
  2017-06-30  4:12   ` [PATCH v2 " Darrick J. Wong
  2017-06-23  7:59 ` [PATCH 0/8] miscellaneous tests Eryu Guan
                   ` (3 subsequent siblings)
  12 siblings, 2 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-22  6:26 UTC (permalink / raw)
  To: eguan; +Cc: linux-xfs, fstests

Record the external log and realtime device configurations when we
create a sample filesystem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/populate |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/populate b/common/populate
index e99ce68..b59ed02 100644
--- a/common/populate
+++ b/common/populate
@@ -713,7 +713,15 @@ _scratch_populate_cached() {
 	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
 
 	# Throw away cached image if it doesn't match our spec.
-	meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ARGS $@"
+	case "${FSTYP}" in
+	"ext4")
+		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL}";;
+	"xfs")
+		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}";;
+	*)
+		extra_descr="";;
+	esac
+	meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ${extra_descr} ARGS $@"
 	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || rm -rf "${POPULATE_METADUMP}"
 
 	# Do we have a cached image?

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH 1/8] ext4: fsmap tests
  2017-06-21 21:57 ` [PATCH 1/8] ext4: fsmap tests Darrick J. Wong
@ 2017-06-23  7:41   ` Eryu Guan
  2017-06-23 15:35     ` Darrick J. Wong
  0 siblings, 1 reply; 34+ messages in thread
From: Eryu Guan @ 2017-06-23  7:41 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Wed, Jun 21, 2017 at 02:57:11PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Test the GETFSMAP ioctl against ext4.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/ext4/700     |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/ext4/700.out |    7 +++++
>  tests/ext4/701     |   65 ++++++++++++++++++++++++++++++++++++++++++++
>  tests/ext4/701.out |    3 ++
>  tests/ext4/702     |   66 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/ext4/702.out |    4 +++
>  tests/ext4/group   |    3 ++
>  7 files changed, 224 insertions(+)
>  create mode 100755 tests/ext4/700
>  create mode 100644 tests/ext4/700.out
>  create mode 100755 tests/ext4/701
>  create mode 100644 tests/ext4/701.out
>  create mode 100755 tests/ext4/702
>  create mode 100644 tests/ext4/702.out
> 
> 
> diff --git a/tests/ext4/700 b/tests/ext4/700
> new file mode 100755
> index 0000000..a4a1b83
> --- /dev/null
> +++ b/tests/ext4/700
> @@ -0,0 +1,76 @@
> +#! /bin/bash
> +# FS QA Test No. 700
> +#
> +# Check that getfsmap reports the BG metadata we're expecting.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -f "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs ext4
> +_require_scratch
> +_require_xfs_io_command "fsmap"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +echo "Get fsmap" | tee -a $seqres.full
> +$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT > $TEST_DIR/fsmap
> +cat $TEST_DIR/fsmap >> $seqres.full
> +
> +echo "Check fs metadata" | tee -a $seqres.full
> +x=$(grep -c 'static fs metadata' $TEST_DIR/fsmap)
> +test $x -gt 0 || echo "No fs metadata?"

This test passed for me if I enlarge the size of external log device. It
was 256M and mkfs picked 1k as block size previously. Though it silll
failed in 1k block size test, but that's a kernel issue not test :)

> +
> +echo "Check block bitmap" | tee -a $seqres.full
> +x=$(grep -c 'special 102:1' $TEST_DIR/fsmap)
> +test $x -gt 0 || echo "No block bitmaps?"
> +
> +echo "Check inode bitmap" | tee -a $seqres.full
> +x=$(grep -c 'special 102:2' $TEST_DIR/fsmap)
> +test $x -gt 0 || echo "No inode bitmaps?"
> +
> +echo "Check inodes" | tee -a $seqres.full
> +x=$(grep -c 'inodes' $TEST_DIR/fsmap)
> +test $x -gt 0 || echo "No inodes?"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/ext4/700.out b/tests/ext4/700.out
> new file mode 100644
> index 0000000..3984319
> --- /dev/null
> +++ b/tests/ext4/700.out
> @@ -0,0 +1,7 @@
> +QA output created by 700
> +Format and mount
> +Get fsmap
> +Check fs metadata
> +Check block bitmap
> +Check inode bitmap
> +Check inodes
> diff --git a/tests/ext4/701 b/tests/ext4/701
> new file mode 100755
> index 0000000..6ae93d7
> --- /dev/null
> +++ b/tests/ext4/701
> @@ -0,0 +1,65 @@
> +#! /bin/bash
> +# FS QA Test No. 701
> +#
> +# Populate filesystem, check that fsmap -n10000 matches fsmap -n1.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -f "$tmp".* $TEST_DIR/a $TEST_DIR/b
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/populate
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs ext4
> +_require_scratch
> +_require_populate_commands
> +_require_xfs_io_command "fsmap"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_populate_cached nofill > $seqres.full 2>&1
> +
> +echo "Compare fsmap" | tee -a $seqres.full
> +_scratch_mount
> +$XFS_IO_PROG -c 'fsmap -n 65536' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/a
> +$XFS_IO_PROG -c 'fsmap -n 1' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/b
> +cat $TEST_DIR/a $TEST_DIR/b >> $seqres.full
> +
> +diff -uw $TEST_DIR/a $TEST_DIR/b

But this test is still failing for me with external log set.

--- tests/ext4/027.out  2017-06-22 16:53:30.814487339 +0800
+++ /root/xfstests/results//ext4/027.out.bad    2017-06-23 15:36:27.502464414 +0800
@@ -1,3 +1,10 @@
 QA output created by 027
 Format and mount
 Compare fsmap
+--- /mnt/testarea/test/a       2017-06-23 15:36:27.433463217 +0800
++++ /mnt/testarea/test/b       2017-06-23 15:36:27.491464224 +0800
+@@ -760,4 +760,3 @@
+       759: 8:34 [29360256..29393023]: inodes 32768
+       760: 8:34 [29393024..31457279]: free space 2064256
+       761: 8:41 [0..7]: unknown 8
+-      762: 8:41 [8..524295]: journalling log 524288

Does this expose another kernel bug or the test itself needs fix?

Thanks,
Eryu

> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/ext4/701.out b/tests/ext4/701.out
> new file mode 100644
> index 0000000..41ef1c6
> --- /dev/null
> +++ b/tests/ext4/701.out
> @@ -0,0 +1,3 @@
> +QA output created by 701
> +Format and mount
> +Compare fsmap
> diff --git a/tests/ext4/702 b/tests/ext4/702
> new file mode 100755
> index 0000000..ce3ae11
> --- /dev/null
> +++ b/tests/ext4/702
> @@ -0,0 +1,66 @@
> +#! /bin/bash
> +# FS QA Test No. 702
> +#
> +# Check that getfsmap reports external log devices
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -f "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs ext4
> +_require_logdev
> +_require_scratch
> +_require_xfs_io_command "fsmap"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +echo "Get fsmap" | tee -a $seqres.full
> +$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT >> $seqres.full
> +$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
> +
> +echo "Check device field of FS metadata and journalling log"
> +data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
> +journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
> +test "${data_dev}" != "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/ext4/702.out b/tests/ext4/702.out
> new file mode 100644
> index 0000000..1d3b7ef
> --- /dev/null
> +++ b/tests/ext4/702.out
> @@ -0,0 +1,4 @@
> +QA output created by 702
> +Format and mount
> +Get fsmap
> +Check device field of FS metadata and journalling log
> diff --git a/tests/ext4/group b/tests/ext4/group
> index 664c059..9007adf 100644
> --- a/tests/ext4/group
> +++ b/tests/ext4/group
> @@ -37,3 +37,6 @@
>  306 auto rw resize quick
>  307 auto ioctl rw defrag
>  308 auto ioctl rw prealloc quick defrag
> +700 auto quick fsmap
> +701 auto quick fsmap
> +702 auto quick fsmap
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 9/8] common/populate: remember multi-device configurations
  2017-06-22  6:26 ` [PATCH 9/8] common/populate: remember multi-device configurations Darrick J. Wong
@ 2017-06-23  7:49   ` Eryu Guan
  2017-06-23 15:34     ` Darrick J. Wong
  2017-06-30  4:12   ` [PATCH v2 " Darrick J. Wong
  1 sibling, 1 reply; 34+ messages in thread
From: Eryu Guan @ 2017-06-23  7:49 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Wed, Jun 21, 2017 at 11:26:53PM -0700, Darrick J. Wong wrote:
> Record the external log and realtime device configurations when we
> create a sample filesystem.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/populate |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/common/populate b/common/populate
> index e99ce68..b59ed02 100644
> --- a/common/populate
> +++ b/common/populate
> @@ -713,7 +713,15 @@ _scratch_populate_cached() {
>  	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
>  
>  	# Throw away cached image if it doesn't match our spec.
> -	meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ARGS $@"
> +	case "${FSTYP}" in
> +	"ext4")
> +		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL}";;
> +	"xfs")
> +		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}";;
> +	*)
> +		extra_descr="";;
> +	esac
> +	meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ${extra_descr} ARGS $@"

This works fine if "test without external log" then "test with external
log" or vise-versa. But I just found that a second run with external log
still cause scratch dev fail to mount. Seems it's because e2image
doesn't take the external log dev into account when save/restore fs
image, then mounting scratch dev failed with

[184952.642892] EXT4-fs (sdc2): journal UUID does not match

Thanks,
Eryu

>  	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || rm -rf "${POPULATE_METADUMP}"
>  
>  	# Do we have a cached image?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 0/8] miscellaneous tests
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (8 preceding siblings ...)
  2017-06-22  6:26 ` [PATCH 9/8] common/populate: remember multi-device configurations Darrick J. Wong
@ 2017-06-23  7:59 ` Eryu Guan
  2017-06-30  4:12 ` [PATCH 10/8] common/rc: test that the xfs_io scrub/repair commands actually work Darrick J. Wong
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Eryu Guan @ 2017-06-23  7:59 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Wed, Jun 21, 2017 at 02:57:02PM -0700, Darrick J. Wong wrote:
> I decided to roll everything up into a patch series, though these
> patches mostly address different things.
> 
> So... I've reposted the ext4 fsmap test, fixed up some tests to
> reflect changes being finalized in xfsprogs 4.12, added a few more
> reflink stress tests, and added a couple of new scrub stress tests.

I've queued patch 3, 4 and 6 (which have been reviewed before) for this
week's update. And I still have some questions regarding the ext4 fsmap
tests (sorry I didn't bring them up in my first round review), so I'll
leave it to next week along with other new tests/patches.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 9/8] common/populate: remember multi-device configurations
  2017-06-23  7:49   ` Eryu Guan
@ 2017-06-23 15:34     ` Darrick J. Wong
  0 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-23 15:34 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Fri, Jun 23, 2017 at 03:49:02PM +0800, Eryu Guan wrote:
> On Wed, Jun 21, 2017 at 11:26:53PM -0700, Darrick J. Wong wrote:
> > Record the external log and realtime device configurations when we
> > create a sample filesystem.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/populate |   10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/common/populate b/common/populate
> > index e99ce68..b59ed02 100644
> > --- a/common/populate
> > +++ b/common/populate
> > @@ -713,7 +713,15 @@ _scratch_populate_cached() {
> >  	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
> >  
> >  	# Throw away cached image if it doesn't match our spec.
> > -	meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ARGS $@"
> > +	case "${FSTYP}" in
> > +	"ext4")
> > +		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL}";;
> > +	"xfs")
> > +		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}";;
> > +	*)
> > +		extra_descr="";;
> > +	esac
> > +	meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ${extra_descr} ARGS $@"
> 
> This works fine if "test without external log" then "test with external
> log" or vise-versa. But I just found that a second run with external log
> still cause scratch dev fail to mount. Seems it's because e2image
> doesn't take the external log dev into account when save/restore fs
> image, then mounting scratch dev failed with
> 
> [184952.642892] EXT4-fs (sdc2): journal UUID does not match

Ohhh... I just remembered that e2image (and xfs_metadump) don't capture
the external log in the dump.  ext4 chokes when the log device lacks the
header it needs and fails, though XFS is perfectly happy to complain
about the zero log and move on.

So either we can't use _scratch_populate cache in ext4 when
SCRATCH_LOGDEV is set, or I need to fix it to extract the expected
logdev uuid from the restored fs and reformat that onto the log device.

I'll work on that and resubmit.

--D

> 
> Thanks,
> Eryu
> 
> >  	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || rm -rf "${POPULATE_METADUMP}"
> >  
> >  	# Do we have a cached image?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 1/8] ext4: fsmap tests
  2017-06-23  7:41   ` Eryu Guan
@ 2017-06-23 15:35     ` Darrick J. Wong
  0 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-23 15:35 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Fri, Jun 23, 2017 at 03:41:28PM +0800, Eryu Guan wrote:
> On Wed, Jun 21, 2017 at 02:57:11PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Test the GETFSMAP ioctl against ext4.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/ext4/700     |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ext4/700.out |    7 +++++
> >  tests/ext4/701     |   65 ++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ext4/701.out |    3 ++
> >  tests/ext4/702     |   66 +++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ext4/702.out |    4 +++
> >  tests/ext4/group   |    3 ++
> >  7 files changed, 224 insertions(+)
> >  create mode 100755 tests/ext4/700
> >  create mode 100644 tests/ext4/700.out
> >  create mode 100755 tests/ext4/701
> >  create mode 100644 tests/ext4/701.out
> >  create mode 100755 tests/ext4/702
> >  create mode 100644 tests/ext4/702.out
> > 
> > 
> > diff --git a/tests/ext4/700 b/tests/ext4/700
> > new file mode 100755
> > index 0000000..a4a1b83
> > --- /dev/null
> > +++ b/tests/ext4/700
> > @@ -0,0 +1,76 @@
> > +#! /bin/bash
> > +# FS QA Test No. 700
> > +#
> > +# Check that getfsmap reports the BG metadata we're expecting.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -f "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs ext4
> > +_require_scratch
> > +_require_xfs_io_command "fsmap"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +echo "Get fsmap" | tee -a $seqres.full
> > +$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT > $TEST_DIR/fsmap
> > +cat $TEST_DIR/fsmap >> $seqres.full
> > +
> > +echo "Check fs metadata" | tee -a $seqres.full
> > +x=$(grep -c 'static fs metadata' $TEST_DIR/fsmap)
> > +test $x -gt 0 || echo "No fs metadata?"
> 
> This test passed for me if I enlarge the size of external log device. It
> was 256M and mkfs picked 1k as block size previously. Though it silll
> failed in 1k block size test, but that's a kernel issue not test :)
> 
> > +
> > +echo "Check block bitmap" | tee -a $seqres.full
> > +x=$(grep -c 'special 102:1' $TEST_DIR/fsmap)
> > +test $x -gt 0 || echo "No block bitmaps?"
> > +
> > +echo "Check inode bitmap" | tee -a $seqres.full
> > +x=$(grep -c 'special 102:2' $TEST_DIR/fsmap)
> > +test $x -gt 0 || echo "No inode bitmaps?"
> > +
> > +echo "Check inodes" | tee -a $seqres.full
> > +x=$(grep -c 'inodes' $TEST_DIR/fsmap)
> > +test $x -gt 0 || echo "No inodes?"
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/ext4/700.out b/tests/ext4/700.out
> > new file mode 100644
> > index 0000000..3984319
> > --- /dev/null
> > +++ b/tests/ext4/700.out
> > @@ -0,0 +1,7 @@
> > +QA output created by 700
> > +Format and mount
> > +Get fsmap
> > +Check fs metadata
> > +Check block bitmap
> > +Check inode bitmap
> > +Check inodes
> > diff --git a/tests/ext4/701 b/tests/ext4/701
> > new file mode 100755
> > index 0000000..6ae93d7
> > --- /dev/null
> > +++ b/tests/ext4/701
> > @@ -0,0 +1,65 @@
> > +#! /bin/bash
> > +# FS QA Test No. 701
> > +#
> > +# Populate filesystem, check that fsmap -n10000 matches fsmap -n1.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -f "$tmp".* $TEST_DIR/a $TEST_DIR/b
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/populate
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs ext4
> > +_require_scratch
> > +_require_populate_commands
> > +_require_xfs_io_command "fsmap"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_populate_cached nofill > $seqres.full 2>&1
> > +
> > +echo "Compare fsmap" | tee -a $seqres.full
> > +_scratch_mount
> > +$XFS_IO_PROG -c 'fsmap -n 65536' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/a
> > +$XFS_IO_PROG -c 'fsmap -n 1' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/b
> > +cat $TEST_DIR/a $TEST_DIR/b >> $seqres.full
> > +
> > +diff -uw $TEST_DIR/a $TEST_DIR/b
> 
> But this test is still failing for me with external log set.
> 
> --- tests/ext4/027.out  2017-06-22 16:53:30.814487339 +0800
> +++ /root/xfstests/results//ext4/027.out.bad    2017-06-23 15:36:27.502464414 +0800
> @@ -1,3 +1,10 @@
>  QA output created by 027
>  Format and mount
>  Compare fsmap
> +--- /mnt/testarea/test/a       2017-06-23 15:36:27.433463217 +0800
> ++++ /mnt/testarea/test/b       2017-06-23 15:36:27.491464224 +0800
> +@@ -760,4 +760,3 @@
> +       759: 8:34 [29360256..29393023]: inodes 32768
> +       760: 8:34 [29393024..31457279]: free space 2064256
> +       761: 8:41 [0..7]: unknown 8
> +-      762: 8:41 [8..524295]: journalling log 524288
> 
> Does this expose another kernel bug or the test itself needs fix?

Sort of both -- the only time ext4 reports any journal blocks is when
the journal is external.  Probably need to filter out that line.

--D

> 
> Thanks,
> Eryu
> 
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/ext4/701.out b/tests/ext4/701.out
> > new file mode 100644
> > index 0000000..41ef1c6
> > --- /dev/null
> > +++ b/tests/ext4/701.out
> > @@ -0,0 +1,3 @@
> > +QA output created by 701
> > +Format and mount
> > +Compare fsmap
> > diff --git a/tests/ext4/702 b/tests/ext4/702
> > new file mode 100755
> > index 0000000..ce3ae11
> > --- /dev/null
> > +++ b/tests/ext4/702
> > @@ -0,0 +1,66 @@
> > +#! /bin/bash
> > +# FS QA Test No. 702
> > +#
> > +# Check that getfsmap reports external log devices
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -f "$tmp".* $TEST_DIR/fsmap $TEST_DIR/testout
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs ext4
> > +_require_logdev
> > +_require_scratch
> > +_require_xfs_io_command "fsmap"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +echo "Get fsmap" | tee -a $seqres.full
> > +$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT >> $seqres.full
> > +$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT | tr '[]()' '    ' > $TEST_DIR/fsmap
> > +
> > +echo "Check device field of FS metadata and journalling log"
> > +data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
> > +journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}')
> > +test "${data_dev}" != "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?"
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/ext4/702.out b/tests/ext4/702.out
> > new file mode 100644
> > index 0000000..1d3b7ef
> > --- /dev/null
> > +++ b/tests/ext4/702.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 702
> > +Format and mount
> > +Get fsmap
> > +Check device field of FS metadata and journalling log
> > diff --git a/tests/ext4/group b/tests/ext4/group
> > index 664c059..9007adf 100644
> > --- a/tests/ext4/group
> > +++ b/tests/ext4/group
> > @@ -37,3 +37,6 @@
> >  306 auto rw resize quick
> >  307 auto ioctl rw defrag
> >  308 auto ioctl rw prealloc quick defrag
> > +700 auto quick fsmap
> > +701 auto quick fsmap
> > +702 auto quick fsmap
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 5/8] reflink: test unlinking a huge extent with a lot of refcount adjustments
  2017-06-21 21:57 ` [PATCH 5/8] reflink: test unlinking a huge extent with a lot of refcount adjustments Darrick J. Wong
@ 2017-06-29  9:36   ` Eryu Guan
  2017-06-29 16:07     ` Darrick J. Wong
  0 siblings, 1 reply; 34+ messages in thread
From: Eryu Guan @ 2017-06-29  9:36 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Wed, Jun 21, 2017 at 02:57:48PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Test a regression in XFS where we blow out a transaction reservation if
> we create a big file, share every other block, and delete the first
> file.  There's nothing particularly fs-specific about this stress test,
> so put it in generic.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

This test took me 3019s to finish with v4.12-rc7 kernel, and another
host "hung" at "Delete file1" (it had been more than 1 hour, and I lost
my patience and hard-reboot the host). Are they expected results?

If the bug is still existed in latest upstream kernel, I tend to merge
it after the fix landing in linus tree. If v4.12-rc7 doesn't suffer from
this bug, the test time should be reduced.

And another minor nit below.

> ---
>  tests/generic/931     |   94 +++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/931.out |    6 +++
>  tests/generic/group   |    1 +
>  3 files changed, 101 insertions(+)
>  create mode 100755 tests/generic/931
>  create mode 100644 tests/generic/931.out
> 
> 
> diff --git a/tests/generic/931 b/tests/generic/931
> new file mode 100755
> index 0000000..afadf81
> --- /dev/null
> +++ b/tests/generic/931
> @@ -0,0 +1,94 @@
> +#! /bin/bash
> +# FS QA Test No. 931
> +#
> +# See how well we handle deleting a file with a million refcount extents.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +    cd /
> +    rm -rf "$tmp".* $testdir/file1

'rm -rf' looks a bit scary, and we're only deleting regular files not
directories, 'rm -f' should be sufficient.

Thanks,
Eryu

> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/attr
> +. ./common/reflink
> +
> +# real QA test starts here
> +_supported_os Linux
> +_require_scratch_reflink
> +_require_cp_reflink
> +_require_test_program "punch-alternating"
> +
> +rm -f "$seqres.full"
> +
> +echo "Format and mount"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount >> "$seqres.full" 2>&1
> +
> +testdir="$SCRATCH_MNT/test-$seq"
> +mkdir "$testdir"
> +
> +# Setup for one million blocks, but we'll accept stress testing down to
> +# 2^17 blocks... that should be plenty for anyone.
> +fnr=20
> +free_blocks=$(stat -f -c '%a' "$testdir")
> +blksz=$(_get_block_size "$testdir")
> +space_avail=$((free_blocks * blksz))
> +calc_space() {
> +	blocks_needed=$(( 2 ** (fnr + 1) ))
> +	space_needed=$((blocks_needed * blksz * 5 / 4))
> +}
> +calc_space
> +while test $space_needed -gt $space_avail; do
> +	fnr=$((fnr - 1))
> +	calc_space
> +done
> +test $fnr -lt 17 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents ($space_needed/$space_avail blocks)."
> +
> +echo "Create a many-block file"
> +echo "creating $blocks_needed blocks..." >> "$seqres.full"
> +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b 4194304 0 $((2 ** (fnr + 1) * blksz))" "$testdir/file1" >> "$seqres.full"
> +
> +echo "Reflinking file"
> +_cp_reflink $testdir/file1 $testdir/file2
> +
> +echo "Punch file2"
> +echo "Punching file2..." >> "$seqres.full"
> +"$here/src/punch-alternating" "$testdir/file2" >> "$seqres.full"
> +echo "...done" >> "$seqres.full"
> +_scratch_cycle_mount
> +
> +echo "Delete file1"
> +rm -rf $testdir/file1
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/931.out b/tests/generic/931.out
> new file mode 100644
> index 0000000..c7b724e
> --- /dev/null
> +++ b/tests/generic/931.out
> @@ -0,0 +1,6 @@
> +QA output created by 931
> +Format and mount
> +Create a many-block file
> +Reflinking file
> +Punch file2
> +Delete file1
> diff --git a/tests/generic/group b/tests/generic/group
> index ab1e9d3..b0d1844 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -443,3 +443,4 @@
>  438 auto
>  439 auto quick punch
>  440 auto quick encrypt
> +931 auto quick clone
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 7/8] xfs: test freeze/rmap repair race
  2017-06-21 21:58 ` [PATCH 7/8] xfs: test freeze/rmap repair race Darrick J. Wong
@ 2017-06-29  9:47   ` Eryu Guan
  2017-06-29 17:17     ` Darrick J. Wong
  0 siblings, 1 reply; 34+ messages in thread
From: Eryu Guan @ 2017-06-29  9:47 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Wed, Jun 21, 2017 at 02:58:11PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The rmapbt repair code plays some dirty tricks with the fs freezer to
> avoid running afoul of regular xfs locking requirements.  Add a test to
> check that filesystem write activities do not deadlock with the repair
> program.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/1378     |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/1378.out |    4 ++
>  tests/xfs/group    |    1 
>  3 files changed, 114 insertions(+)
>  create mode 100755 tests/xfs/1378
>  create mode 100644 tests/xfs/1378.out
> 
> 
> diff --git a/tests/xfs/1378 b/tests/xfs/1378
> new file mode 100755
> index 0000000..79ba6bc
> --- /dev/null
> +++ b/tests/xfs/1378
> @@ -0,0 +1,109 @@
> +#! /bin/bash
> +# FS QA Test No. 1378
> +#
> +# Race freeze and rmapbt repair for a while to see if we crash or livelock.
> +# rmapbt repair requires us to freeze the filesystem to stop all filesystem
> +# activity, so we can't have userspace wandering in and thawing it.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 Oracle, Inc.  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-1335  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 "_cleanup; exit \$status" 0 1 2 3 7 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/fuzzy
> +. ./common/inject
> +. ./common/xfs
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs xfs
> +_require_xfs_scratch_rmapbt
> +_require_xfs_io_command "scrub"

I just noticed that _require_xfs_io_command doesn't actually run 'scrub'
command, it only checks userspace support status not the kernel space.
So I see "+scrub: Inappropriate ioctl for device" when testing with
xfs_io from djwong-devel branch and 4.12-rc7 kernel.

> +_require_xfs_io_error_injection "force_repair"

This error injection check has similar problem.

But I think this can be fixed later, 1378 and 1379 are not in auto group
so won't affect normal '-g auto' run :)

Thanks,
Eryu
> +
> +echo "Format and populate"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +STRESS_DIR="$SCRATCH_MNT/testdir"
> +mkdir -p $STRESS_DIR
> +
> +for i in $(seq 0 9); do
> +	mkdir -p $STRESS_DIR/$i
> +	for j in $(seq 0 9); do
> +		mkdir -p $STRESS_DIR/$i/$j
> +		for k in $(seq 0 9); do
> +			echo x > $STRESS_DIR/$i/$j/$k
> +		done
> +	done
> +done
> +
> +cpus=$(( $(src/feature -o) * 4 * LOAD_FACTOR))
> +
> +echo "Concurrent repair"
> +filter_output() {
> +	egrep -v '(Device or resource busy|Invalid argument)'
> +}
> +freeze_loop() {
> +	end="$1"
> +
> +	while [ "$(date +%s)" -lt $end ]; do
> +		$XFS_IO_PROG -x -c 'freeze' -c 'thaw' $SCRATCH_MNT 2>&1 | filter_output
> +	done
> +}
> +repair_loop() {
> +	end="$1"
> +
> +	while [ "$(date +%s)" -lt $end ]; do
> +		$XFS_IO_PROG -x -c 'repair rmapbt 0' -c 'repair rmapbt 1' $SCRATCH_MNT 2>&1 | filter_output
> +	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
> +freeze_loop $end &
> +repair_loop $end &
> +
> +while [ "$(date +%s)" -lt $end ]; do
> +	sleep 1
> +done
> +echo "Loop finished at $(date)" >> $seqres.full
> +echo "Test done"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/1378.out b/tests/xfs/1378.out
> new file mode 100644
> index 0000000..030e250
> --- /dev/null
> +++ b/tests/xfs/1378.out
> @@ -0,0 +1,4 @@
> +QA output created by 1378
> +Format and populate
> +Concurrent repair
> +Test done
> diff --git a/tests/xfs/group b/tests/xfs/group
> index faf0095..d0a6831 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -419,3 +419,4 @@
>  701 auto quick
>  901 auto quick clone dedupe
>  902 auto quick clone dedupe
> +1378 dangerous_scrub dangerous_online_repair
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 5/8] reflink: test unlinking a huge extent with a lot of refcount adjustments
  2017-06-29  9:36   ` Eryu Guan
@ 2017-06-29 16:07     ` Darrick J. Wong
  2017-06-29 17:19       ` Eryu Guan
  0 siblings, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-29 16:07 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Thu, Jun 29, 2017 at 05:36:14PM +0800, Eryu Guan wrote:
> On Wed, Jun 21, 2017 at 02:57:48PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Test a regression in XFS where we blow out a transaction reservation if
> > we create a big file, share every other block, and delete the first
> > file.  There's nothing particularly fs-specific about this stress test,
> > so put it in generic.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> This test took me 3019s to finish with v4.12-rc7 kernel, and another
> host "hung" at "Delete file1" (it had been more than 1 hour, and I lost
> my patience and hard-reboot the host). Are they expected results?

No.  The take-forever-or-crash behavior should be fixed by "xfs: try to
avoid blowing out the transaction reservation when bunmaping a shared
extent" in 4.13.  Feel free to hang on to this one until -rc1. :)

> If the bug is still existed in latest upstream kernel, I tend to merge
> it after the fix landing in linus tree. If v4.12-rc7 doesn't suffer from
> this bug, the test time should be reduced.

<shrug> This is what I saw just now:

FSTYP         -- xfs (debug)
PLATFORM      -- Linux/x86_64 birch-mtr0 4.12.0-rc6-dgc
MKFS_OPTIONS  -- -f -m reflink=1,rmapbt=1, -i sparse=1, /dev/pmem1
MOUNT_OPTIONS -- /dev/pmem1 /opt

generic/931      21s
Ran: generic/931
Passed all 1 tests

Though if it takes forever for everyone else, please kick this one out
of auto/quick.  At least in theory, before the patch the test will
either blow out a transaction reservation and hang the system, or if it
does succeed it'll have done so by scraping long and hard for log space.
That is probably why it takes 3000+ seconds on your test box, unless
you were also testing xfs for-next.

> And another minor nit below.
> 
> > ---
> >  tests/generic/931     |   94 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/931.out |    6 +++
> >  tests/generic/group   |    1 +
> >  3 files changed, 101 insertions(+)
> >  create mode 100755 tests/generic/931
> >  create mode 100644 tests/generic/931.out
> > 
> > 
> > diff --git a/tests/generic/931 b/tests/generic/931
> > new file mode 100755
> > index 0000000..afadf81
> > --- /dev/null
> > +++ b/tests/generic/931
> > @@ -0,0 +1,94 @@
> > +#! /bin/bash
> > +# FS QA Test No. 931
> > +#
> > +# See how well we handle deleting a file with a million refcount extents.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1    # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +    cd /
> > +    rm -rf "$tmp".* $testdir/file1
> 
> 'rm -rf' looks a bit scary, and we're only deleting regular files not
> directories, 'rm -f' should be sufficient.

Yes.  Will you fix it on the way in or should I resend?

--D

> Thanks,
> Eryu
> 
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/attr
> > +. ./common/reflink
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_require_scratch_reflink
> > +_require_cp_reflink
> > +_require_test_program "punch-alternating"
> > +
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount >> "$seqres.full" 2>&1
> > +
> > +testdir="$SCRATCH_MNT/test-$seq"
> > +mkdir "$testdir"
> > +
> > +# Setup for one million blocks, but we'll accept stress testing down to
> > +# 2^17 blocks... that should be plenty for anyone.
> > +fnr=20
> > +free_blocks=$(stat -f -c '%a' "$testdir")
> > +blksz=$(_get_block_size "$testdir")
> > +space_avail=$((free_blocks * blksz))
> > +calc_space() {
> > +	blocks_needed=$(( 2 ** (fnr + 1) ))
> > +	space_needed=$((blocks_needed * blksz * 5 / 4))
> > +}
> > +calc_space
> > +while test $space_needed -gt $space_avail; do
> > +	fnr=$((fnr - 1))
> > +	calc_space
> > +done
> > +test $fnr -lt 17 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents ($space_needed/$space_avail blocks)."
> > +
> > +echo "Create a many-block file"
> > +echo "creating $blocks_needed blocks..." >> "$seqres.full"
> > +$XFS_IO_PROG -f -c "pwrite -S 0x61 -b 4194304 0 $((2 ** (fnr + 1) * blksz))" "$testdir/file1" >> "$seqres.full"
> > +
> > +echo "Reflinking file"
> > +_cp_reflink $testdir/file1 $testdir/file2
> > +
> > +echo "Punch file2"
> > +echo "Punching file2..." >> "$seqres.full"
> > +"$here/src/punch-alternating" "$testdir/file2" >> "$seqres.full"
> > +echo "...done" >> "$seqres.full"
> > +_scratch_cycle_mount
> > +
> > +echo "Delete file1"
> > +rm -rf $testdir/file1
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/generic/931.out b/tests/generic/931.out
> > new file mode 100644
> > index 0000000..c7b724e
> > --- /dev/null
> > +++ b/tests/generic/931.out
> > @@ -0,0 +1,6 @@
> > +QA output created by 931
> > +Format and mount
> > +Create a many-block file
> > +Reflinking file
> > +Punch file2
> > +Delete file1
> > diff --git a/tests/generic/group b/tests/generic/group
> > index ab1e9d3..b0d1844 100644
> > --- a/tests/generic/group
> > +++ b/tests/generic/group
> > @@ -443,3 +443,4 @@
> >  438 auto
> >  439 auto quick punch
> >  440 auto quick encrypt
> > +931 auto quick clone
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 7/8] xfs: test freeze/rmap repair race
  2017-06-29  9:47   ` Eryu Guan
@ 2017-06-29 17:17     ` Darrick J. Wong
  0 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-29 17:17 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Thu, Jun 29, 2017 at 05:47:16PM +0800, Eryu Guan wrote:
> On Wed, Jun 21, 2017 at 02:58:11PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > The rmapbt repair code plays some dirty tricks with the fs freezer to
> > avoid running afoul of regular xfs locking requirements.  Add a test to
> > check that filesystem write activities do not deadlock with the repair
> > program.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/xfs/1378     |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/1378.out |    4 ++
> >  tests/xfs/group    |    1 
> >  3 files changed, 114 insertions(+)
> >  create mode 100755 tests/xfs/1378
> >  create mode 100644 tests/xfs/1378.out
> > 
> > 
> > diff --git a/tests/xfs/1378 b/tests/xfs/1378
> > new file mode 100755
> > index 0000000..79ba6bc
> > --- /dev/null
> > +++ b/tests/xfs/1378
> > @@ -0,0 +1,109 @@
> > +#! /bin/bash
> > +# FS QA Test No. 1378
> > +#
> > +# Race freeze and rmapbt repair for a while to see if we crash or livelock.
> > +# rmapbt repair requires us to freeze the filesystem to stop all filesystem
> > +# activity, so we can't have userspace wandering in and thawing it.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2017 Oracle, Inc.  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-1335  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 "_cleanup; exit \$status" 0 1 2 3 7 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/fuzzy
> > +. ./common/inject
> > +. ./common/xfs
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs xfs
> > +_require_xfs_scratch_rmapbt
> > +_require_xfs_io_command "scrub"
> 
> I just noticed that _require_xfs_io_command doesn't actually run 'scrub'
> command, it only checks userspace support status not the kernel space.
> So I see "+scrub: Inappropriate ioctl for device" when testing with
> xfs_io from djwong-devel branch and 4.12-rc7 kernel.

Uhoh.  I'll fix that.

> > +_require_xfs_io_error_injection "force_repair"
> 
> This error injection check has similar problem.

Yes, I'm about to send a patch to fix this up w.r.t. the new xfs errortag
configuration mechanism.

--D

> 
> But I think this can be fixed later, 1378 and 1379 are not in auto group
> so won't affect normal '-g auto' run :)
> 
> Thanks,
> Eryu
> > +
> > +echo "Format and populate"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +STRESS_DIR="$SCRATCH_MNT/testdir"
> > +mkdir -p $STRESS_DIR
> > +
> > +for i in $(seq 0 9); do
> > +	mkdir -p $STRESS_DIR/$i
> > +	for j in $(seq 0 9); do
> > +		mkdir -p $STRESS_DIR/$i/$j
> > +		for k in $(seq 0 9); do
> > +			echo x > $STRESS_DIR/$i/$j/$k
> > +		done
> > +	done
> > +done
> > +
> > +cpus=$(( $(src/feature -o) * 4 * LOAD_FACTOR))
> > +
> > +echo "Concurrent repair"
> > +filter_output() {
> > +	egrep -v '(Device or resource busy|Invalid argument)'
> > +}
> > +freeze_loop() {
> > +	end="$1"
> > +
> > +	while [ "$(date +%s)" -lt $end ]; do
> > +		$XFS_IO_PROG -x -c 'freeze' -c 'thaw' $SCRATCH_MNT 2>&1 | filter_output
> > +	done
> > +}
> > +repair_loop() {
> > +	end="$1"
> > +
> > +	while [ "$(date +%s)" -lt $end ]; do
> > +		$XFS_IO_PROG -x -c 'repair rmapbt 0' -c 'repair rmapbt 1' $SCRATCH_MNT 2>&1 | filter_output
> > +	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
> > +freeze_loop $end &
> > +repair_loop $end &
> > +
> > +while [ "$(date +%s)" -lt $end ]; do
> > +	sleep 1
> > +done
> > +echo "Loop finished at $(date)" >> $seqres.full
> > +echo "Test done"
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/1378.out b/tests/xfs/1378.out
> > new file mode 100644
> > index 0000000..030e250
> > --- /dev/null
> > +++ b/tests/xfs/1378.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 1378
> > +Format and populate
> > +Concurrent repair
> > +Test done
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index faf0095..d0a6831 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -419,3 +419,4 @@
> >  701 auto quick
> >  901 auto quick clone dedupe
> >  902 auto quick clone dedupe
> > +1378 dangerous_scrub dangerous_online_repair
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 5/8] reflink: test unlinking a huge extent with a lot of refcount adjustments
  2017-06-29 16:07     ` Darrick J. Wong
@ 2017-06-29 17:19       ` Eryu Guan
  0 siblings, 0 replies; 34+ messages in thread
From: Eryu Guan @ 2017-06-29 17:19 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Thu, Jun 29, 2017 at 09:07:46AM -0700, Darrick J. Wong wrote:
> On Thu, Jun 29, 2017 at 05:36:14PM +0800, Eryu Guan wrote:
> > On Wed, Jun 21, 2017 at 02:57:48PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <darrick.wong@oracle.com>
> > > 
> > > Test a regression in XFS where we blow out a transaction reservation if
> > > we create a big file, share every other block, and delete the first
> > > file.  There's nothing particularly fs-specific about this stress test,
> > > so put it in generic.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > This test took me 3019s to finish with v4.12-rc7 kernel, and another
> > host "hung" at "Delete file1" (it had been more than 1 hour, and I lost
> > my patience and hard-reboot the host). Are they expected results?
> 
> No.  The take-forever-or-crash behavior should be fixed by "xfs: try to
> avoid blowing out the transaction reservation when bunmaping a shared
> extent" in 4.13.  Feel free to hang on to this one until -rc1. :)

Thanks! I'll take it in after 4.13-rc1 then :)

> 
> > If the bug is still existed in latest upstream kernel, I tend to merge
> > it after the fix landing in linus tree. If v4.12-rc7 doesn't suffer from
> > this bug, the test time should be reduced.
> 
> <shrug> This is what I saw just now:
> 
> FSTYP         -- xfs (debug)
> PLATFORM      -- Linux/x86_64 birch-mtr0 4.12.0-rc6-dgc
> MKFS_OPTIONS  -- -f -m reflink=1,rmapbt=1, -i sparse=1, /dev/pmem1
> MOUNT_OPTIONS -- /dev/pmem1 /opt
> 
> generic/931      21s
> Ran: generic/931
> Passed all 1 tests
> 
> Though if it takes forever for everyone else, please kick this one out
> of auto/quick.  At least in theory, before the patch the test will
> either blow out a transaction reservation and hang the system, or if it
> does succeed it'll have done so by scraping long and hard for log space.
> That is probably why it takes 3000+ seconds on your test box, unless
> you were also testing xfs for-next.

I'm actually testing for-next branch now, will confirm the test time on
for-next kernel.

> 
> > And another minor nit below.
> > 
> > > ---
> > >  tests/generic/931     |   94 +++++++++++++++++++++++++++++++++++++++++++++++++
> > >  tests/generic/931.out |    6 +++
> > >  tests/generic/group   |    1 +
> > >  3 files changed, 101 insertions(+)
> > >  create mode 100755 tests/generic/931
> > >  create mode 100644 tests/generic/931.out
> > > 
> > > 
> > > diff --git a/tests/generic/931 b/tests/generic/931
> > > new file mode 100755
> > > index 0000000..afadf81
> > > --- /dev/null
> > > +++ b/tests/generic/931
> > > @@ -0,0 +1,94 @@
> > > +#! /bin/bash
> > > +# FS QA Test No. 931
> > > +#
> > > +# See how well we handle deleting a file with a million refcount extents.
> > > +#
> > > +#-----------------------------------------------------------------------
> > > +# Copyright (c) 2017, Oracle and/or its affiliates.  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"
> > > +
> > > +here=`pwd`
> > > +tmp=/tmp/$$
> > > +status=1    # failure is the default!
> > > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > > +
> > > +_cleanup()
> > > +{
> > > +    cd /
> > > +    rm -rf "$tmp".* $testdir/file1
> > 
> > 'rm -rf' looks a bit scary, and we're only deleting regular files not
> > directories, 'rm -f' should be sufficient.
> 
> Yes.  Will you fix it on the way in or should I resend?

I can fix it.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 9/8] common/populate: remember multi-device configurations
  2017-06-22  6:26 ` [PATCH 9/8] common/populate: remember multi-device configurations Darrick J. Wong
  2017-06-23  7:49   ` Eryu Guan
@ 2017-06-30  4:12   ` Darrick J. Wong
  1 sibling, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-30  4:12 UTC (permalink / raw)
  To: eguan; +Cc: linux-xfs, fstests

Record the external log and realtime device configurations when we
create a sample filesystem.  ext4 tightly binds to external logs,
so we have to preserve that too.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/populate |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/common/populate b/common/populate
index e99ce68..498151f 100644
--- a/common/populate
+++ b/common/populate
@@ -713,7 +713,18 @@ _scratch_populate_cached() {
 	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
 
 	# Throw away cached image if it doesn't match our spec.
-	meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ARGS $@"
+	case "${FSTYP}" in
+	"ext4")
+		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL}"
+		# ext4 cannot e2image external logs, so we cannot restore
+		test -n "${SCRATCH_LOGDEV}" && rm -f "${POPULATE_METADUMP}"
+		;;
+	"xfs")
+		extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}";;
+	*)
+		extra_descr="";;
+	esac
+	meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ${extra_descr} ARGS $@"
 	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || rm -rf "${POPULATE_METADUMP}"
 
 	# Do we have a cached image?

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 10/8] common/rc: test that the xfs_io scrub/repair commands actually work
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (9 preceding siblings ...)
  2017-06-23  7:59 ` [PATCH 0/8] miscellaneous tests Eryu Guan
@ 2017-06-30  4:12 ` Darrick J. Wong
  2017-06-30  4:13 ` [PATCH 11/8] common/inject: refactor helpers to use new errortag interface Darrick J. Wong
  2017-06-30  4:13 ` [PATCH 12/8] ext4: don't online scrub ever Darrick J. Wong
  12 siblings, 0 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-30  4:12 UTC (permalink / raw)
  To: eguan; +Cc: linux-xfs, fstests

When we call _require_xfs_io_command for the scrub ioctl, we have to
actually try calling the ioctl to make sure that the ioctl is present on
the running kernel.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/rc b/common/rc
index 0062f6f..a3addad 100644
--- a/common/rc
+++ b/common/rc
@@ -2186,6 +2186,11 @@ _require_xfs_io_command()
 		echo $testio | egrep -q "invalid option" && \
 			_notrun "xfs_io $command support is missing"
 		;;
+	"scrub"|"repair")
+		testio=`$XFS_IO_PROG -x -c "$command dummy 0" $TEST_DIR 2>&1`
+		echo $testio | egrep -q "Inappropriate ioctl" && \
+			_notrun "xfs_io $command support is missing"
+		;;
 	"utimes" )
 		testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
 		;;

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 11/8] common/inject: refactor helpers to use new errortag interface
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (10 preceding siblings ...)
  2017-06-30  4:12 ` [PATCH 10/8] common/rc: test that the xfs_io scrub/repair commands actually work Darrick J. Wong
@ 2017-06-30  4:13 ` Darrick J. Wong
  2017-07-05 12:16   ` Brian Foster
  2017-06-30  4:13 ` [PATCH 12/8] ext4: don't online scrub ever Darrick J. Wong
  12 siblings, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-30  4:13 UTC (permalink / raw)
  To: eguan; +Cc: linux-xfs, fstests, Brian Foster

Refactor the XFS error injection helpers to use the new errortag
interface to configure error injection.  If that isn't present, fall
back either to the xfs_io/ioctl based injection or the older sysfs
knobs.  Refactor existing testcases to use the new helpers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/inject |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 tests/xfs/051 |    7 ++++--
 tests/xfs/141 |    5 +++--
 tests/xfs/196 |   17 ++++++----------
 4 files changed, 73 insertions(+), 18 deletions(-)

diff --git a/common/inject b/common/inject
index 8ecc290..1f12a2b 100644
--- a/common/inject
+++ b/common/inject
@@ -35,10 +35,50 @@ _require_error_injection()
 	esac
 }
 
+# Find a given xfs mount's errortag injection knob in sysfs
+_find_xfs_errortag_knob()
+{
+	dev="$1"
+	knob="$2"
+	shortdev="$(_short_dev "${dev}")"
+	tagfile="/sys/fs/xfs/${shortdev}/errortag/${knob}"
+
+	# Some of the new sysfs errortag knobs were previously available via
+	# another sysfs path.
+	case "${knob}" in
+	"log_bad_crc")
+		if [ ! -w "${tagfile}" ]; then
+			tagfile="/sys/fs/xfs/${shortdev}/log/log_badcrc_factor"
+		fi
+		;;
+	"drop_writes")
+		if [ ! -w "${tagfile}" ]; then
+			tagfile="/sys/fs/xfs/${shortdev}/drop_writes"
+		fi
+		if [ ! -w "${tagfile}" ]; then
+			tagfile="/sys/fs/xfs/${shortdev}/fail_writes"
+		fi
+		;;
+	"log_recovery_delay"|"bug_on_assert")
+		# These apply to all xfs filesystems
+		tagfile="/sys/fs/xfs/debug/${knob}"
+		;;
+	*)
+		;;
+	esac
+
+	echo "${tagfile}"
+}
+
 # Requires that xfs_io inject command knows about this error type
 _require_xfs_io_error_injection()
 {
 	type="$1"
+
+	# Can we find the error injection knobs via the new errortag
+	# configuration mechanism?
+	test -w "$(_find_xfs_errortag_knob "${TEST_DEV}" "${type}")" && return
+
 	_require_error_injection
 
 	# NOTE: We can't actually test error injection here because xfs
@@ -54,16 +94,34 @@ _require_xfs_io_error_injection()
 _test_inject_error()
 {
 	type="$1"
+	value="$2"
 
-	$XFS_IO_PROG -x -c "inject $type" $TEST_DIR
+	knob="$(_find_xfs_errortag_knob "${TEST_DEV}" "${type}")"
+	if [ -w "${knob}" ]; then
+		test -z "${value}" && value="default"
+		echo -n "${value}" > "${knob}"
+	elif [ -z "${value}" ] || [ "${value}" = "default" ]; then
+		$XFS_IO_PROG -x -c "inject $type" $TEST_DIR
+	else
+		_notrun "Cannot inject error ${type} value ${value}."
+	fi
 }
 
 # Inject an error into the scratch fs
 _scratch_inject_error()
 {
 	type="$1"
+	value="$2"
 
-	$XFS_IO_PROG -x -c "inject $type" $SCRATCH_MNT
+	knob="$(_find_xfs_errortag_knob "${SCRATCH_DEV}" "${type}")"
+	if [ -w "${knob}" ]; then
+		test -z "${value}" && value="default"
+		echo -n "${value}" > "${knob}"
+	elif [ -z "${value}" ] || [ "${value}" = "default" ]; then
+		$XFS_IO_PROG -x -c "inject $type" $SCRATCH_MNT
+	else
+		_notrun "Cannot inject error ${type} value ${value}."
+	fi
 }
 
 # Unmount and remount the scratch device, dumping the log
diff --git a/tests/xfs/051 b/tests/xfs/051
index f38743c..4d02b3c 100755
--- a/tests/xfs/051
+++ b/tests/xfs/051
@@ -43,6 +43,7 @@ _cleanup()
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/dmflakey
+. ./common/inject
 
 # Modify as appropriate.
 _supported_fs xfs
@@ -50,7 +51,7 @@ _supported_os Linux
 
 _require_scratch
 _require_dm_target flakey
-_require_xfs_sysfs debug/log_recovery_delay
+_require_xfs_io_error_injection "log_recovery_delay"
 _require_command "$KILLALL_PROG" killall
 
 echo "Silence is golden."
@@ -77,13 +78,13 @@ _load_flakey_table $FLAKEY_ALLOW_WRITES
 # initial writes to proceed (e.g., stale log block reset) and then let the
 # flakey uptime timer expire such that I/Os will fail by the time log recovery
 # starts.
-echo 10 > /sys/fs/xfs/debug/log_recovery_delay
+_test_inject_error "log_recovery_delay" 10
 
 # The mount should fail due to dm-flakey. Note that this is dangerous on kernels
 # without the xfs_buf log recovery race fixes.
 _mount_flakey > /dev/null 2>&1
 
-echo 0 > /sys/fs/xfs/debug/log_recovery_delay
+_test_inject_error "log_recovery_delay" 0
 
 _cleanup_flakey
 
diff --git a/tests/xfs/141 b/tests/xfs/141
index 56ff14e..f61e524 100755
--- a/tests/xfs/141
+++ b/tests/xfs/141
@@ -47,13 +47,14 @@ rm -f $seqres.full
 
 # get standard environment, filters and checks
 . ./common/rc
+. ./common/inject
 
 # real QA test starts here
 
 # Modify as appropriate.
 _supported_fs xfs
 _supported_os Linux
-_require_xfs_sysfs $(_short_dev $TEST_DEV)/log/log_badcrc_factor
+_require_xfs_io_error_injection "log_bad_crc"
 _require_scratch
 _require_command "$KILLALL_PROG" killall
 
@@ -69,7 +70,7 @@ for i in $(seq 1 5); do
 	# (increase this value to run fsstress longer).
 	factor=$((RANDOM % 100 + 1))
 	echo iteration $i log_badcrc_factor: $factor >> $seqres.full 2>&1
-	echo $factor > /sys/fs/xfs/$sdev/log/log_badcrc_factor
+	_scratch_inject_error "log_bad_crc" "$factor"
 
 	# Run fsstress until the filesystem shuts down. It will shut down
 	# automatically when error injection triggers.
diff --git a/tests/xfs/196 b/tests/xfs/196
index e9b0649..5afc343 100755
--- a/tests/xfs/196
+++ b/tests/xfs/196
@@ -45,6 +45,7 @@ _cleanup()
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/punch
+. ./common/inject
 
 # real QA test starts here
 rm -f $seqres.full
@@ -53,13 +54,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch
-
-DROP_WRITES="drop_writes"
-# replace "drop_writes" with "fail_writes" for old kernel
-if [ -f /sys/fs/xfs/$(_short_dev $TEST_DEV)/fail_writes ];then
-	DROP_WRITES="fail_writes"
-fi
-_require_xfs_sysfs $(_short_dev $TEST_DEV)/${DROP_WRITES}
+_require_xfs_io_error_injection "drop_writes"
 
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
@@ -72,7 +67,7 @@ bytes=$((64 * 1024))
 $XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1
 
 # Enable write drops. All buffered writes are dropped from this point on.
-echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
+_scratch_inject_error "drop_writes"
 
 # Write every other 4k range to split the larger delalloc extent into many more
 # smaller extents. Use pwrite because with write failures enabled, all
@@ -89,7 +84,7 @@ for i in $(seq 4096 8192 $endoff); do
 	$XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1
 done
 
-echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
+_scratch_inject_error "drop_writes" 0
 
 _scratch_cycle_mount
 $XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap
@@ -104,9 +99,9 @@ for offset in $(seq 0 100 500); do
 	$XFS_IO_PROG -fc "pwrite ${offset}m 100m" $file >> $seqres.full 2>&1
 
 	punchoffset=$((offset + 75))
-	echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
+	_scratch_inject_error "drop_writes"
 	$XFS_IO_PROG -c "pwrite ${punchoffset}m 4k" $file >> $seqres.full 2>&1
-	echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
+	_scratch_inject_error "drop_writes" 0
 done
 
 echo "Silence is golden."

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 12/8] ext4: don't online scrub ever
  2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
                   ` (11 preceding siblings ...)
  2017-06-30  4:13 ` [PATCH 11/8] common/inject: refactor helpers to use new errortag interface Darrick J. Wong
@ 2017-06-30  4:13 ` Darrick J. Wong
  2017-06-30  4:22   ` Eryu Guan
  2017-06-30  4:58   ` [PATCH v2 " Darrick J. Wong
  12 siblings, 2 replies; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-30  4:13 UTC (permalink / raw)
  To: eguan; +Cc: linux-xfs, fstests

The ext4 online scrub program is no longer under active development,
so remove all the test code that tried to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/fuzzy   |    2 +-
 tests/ext4/023 |    1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/fuzzy b/common/fuzzy
index 304268e..686cf77 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -70,7 +70,7 @@ _require_scrub() {
 # Scrub the scratch filesystem metadata (online)
 _scratch_scrub() {
 	case "${FSTYP}" in
-	"xfs"|"ext4"|"ext3"|"ext2")
+	"xfs")
 		$XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
 		;;
 	*)
diff --git a/tests/ext4/023 b/tests/ext4/023
index 4f5cf3e..4491936 100755
--- a/tests/ext4/023
+++ b/tests/ext4/023
@@ -53,7 +53,6 @@ _scratch_populate_cached > $seqres.full 2>&1
 
 echo "Scrub"
 _scratch_mount >> $seqres.full 2>&1
-_scratch_scrub >> $seqres.full
 
 # success, all done
 status=0

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH 12/8] ext4: don't online scrub ever
  2017-06-30  4:13 ` [PATCH 12/8] ext4: don't online scrub ever Darrick J. Wong
@ 2017-06-30  4:22   ` Eryu Guan
  2017-06-30  4:26     ` Darrick J. Wong
  2017-06-30  4:58   ` [PATCH v2 " Darrick J. Wong
  1 sibling, 1 reply; 34+ messages in thread
From: Eryu Guan @ 2017-06-30  4:22 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Thu, Jun 29, 2017 at 09:13:31PM -0700, Darrick J. Wong wrote:
> The ext4 online scrub program is no longer under active development,
> so remove all the test code that tried to use it.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/fuzzy   |    2 +-
>  tests/ext4/023 |    1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/common/fuzzy b/common/fuzzy
> index 304268e..686cf77 100644
> --- a/common/fuzzy
> +++ b/common/fuzzy
> @@ -70,7 +70,7 @@ _require_scrub() {
>  # Scrub the scratch filesystem metadata (online)
>  _scratch_scrub() {
>  	case "${FSTYP}" in
> -	"xfs"|"ext4"|"ext3"|"ext2")
> +	"xfs")
>  		$XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
>  		;;
>  	*)
> diff --git a/tests/ext4/023 b/tests/ext4/023
> index 4f5cf3e..4491936 100755
> --- a/tests/ext4/023
> +++ b/tests/ext4/023
> @@ -53,7 +53,6 @@ _scratch_populate_cached > $seqres.full 2>&1
>  
>  echo "Scrub"
>  _scratch_mount >> $seqres.full 2>&1
> -_scratch_scrub >> $seqres.full

Just a quick glance at this one, shouldn't ext4/023 be removed? If
_scratch_scrub is removed from the test, all the test does is populating
the fs and mount and pass.

And I think _require_scrub should be updated too to remove ext4 support.

Thanks,
Eryu

>  
>  # success, all done
>  status=0

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 12/8] ext4: don't online scrub ever
  2017-06-30  4:22   ` Eryu Guan
@ 2017-06-30  4:26     ` Darrick J. Wong
  2017-06-30  4:33       ` Eryu Guan
  0 siblings, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-30  4:26 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Fri, Jun 30, 2017 at 12:22:08PM +0800, Eryu Guan wrote:
> On Thu, Jun 29, 2017 at 09:13:31PM -0700, Darrick J. Wong wrote:
> > The ext4 online scrub program is no longer under active development,
> > so remove all the test code that tried to use it.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/fuzzy   |    2 +-
> >  tests/ext4/023 |    1 -
> >  2 files changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/common/fuzzy b/common/fuzzy
> > index 304268e..686cf77 100644
> > --- a/common/fuzzy
> > +++ b/common/fuzzy
> > @@ -70,7 +70,7 @@ _require_scrub() {
> >  # Scrub the scratch filesystem metadata (online)
> >  _scratch_scrub() {
> >  	case "${FSTYP}" in
> > -	"xfs"|"ext4"|"ext3"|"ext2")
> > +	"xfs")
> >  		$XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
> >  		;;
> >  	*)
> > diff --git a/tests/ext4/023 b/tests/ext4/023
> > index 4f5cf3e..4491936 100755
> > --- a/tests/ext4/023
> > +++ b/tests/ext4/023
> > @@ -53,7 +53,6 @@ _scratch_populate_cached > $seqres.full 2>&1
> >  
> >  echo "Scrub"
> >  _scratch_mount >> $seqres.full 2>&1
> > -_scratch_scrub >> $seqres.full
> 
> Just a quick glance at this one, shouldn't ext4/023 be removed? If
> _scratch_scrub is removed from the test, all the test does is populating
> the fs and mount and pass.

I've been using it to verify that we can create ext4 filesystems with all
known types of metadata, and that we can actually capture metadata images
of such a filesystem.

> And I think _require_scrub should be updated too to remove ext4 support.

oops, yes.

--D

> 
> Thanks,
> Eryu
> 
> >  
> >  # success, all done
> >  status=0
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 12/8] ext4: don't online scrub ever
  2017-06-30  4:26     ` Darrick J. Wong
@ 2017-06-30  4:33       ` Eryu Guan
  0 siblings, 0 replies; 34+ messages in thread
From: Eryu Guan @ 2017-06-30  4:33 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Thu, Jun 29, 2017 at 09:26:10PM -0700, Darrick J. Wong wrote:
> On Fri, Jun 30, 2017 at 12:22:08PM +0800, Eryu Guan wrote:
> > On Thu, Jun 29, 2017 at 09:13:31PM -0700, Darrick J. Wong wrote:
> > > The ext4 online scrub program is no longer under active development,
> > > so remove all the test code that tried to use it.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> > >  common/fuzzy   |    2 +-
> > >  tests/ext4/023 |    1 -
> > >  2 files changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/common/fuzzy b/common/fuzzy
> > > index 304268e..686cf77 100644
> > > --- a/common/fuzzy
> > > +++ b/common/fuzzy
> > > @@ -70,7 +70,7 @@ _require_scrub() {
> > >  # Scrub the scratch filesystem metadata (online)
> > >  _scratch_scrub() {
> > >  	case "${FSTYP}" in
> > > -	"xfs"|"ext4"|"ext3"|"ext2")
> > > +	"xfs")
> > >  		$XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
> > >  		;;
> > >  	*)
> > > diff --git a/tests/ext4/023 b/tests/ext4/023
> > > index 4f5cf3e..4491936 100755
> > > --- a/tests/ext4/023
> > > +++ b/tests/ext4/023
> > > @@ -53,7 +53,6 @@ _scratch_populate_cached > $seqres.full 2>&1
> > >  
> > >  echo "Scrub"
> > >  _scratch_mount >> $seqres.full 2>&1
> > > -_scratch_scrub >> $seqres.full
> > 
> > Just a quick glance at this one, shouldn't ext4/023 be removed? If
> > _scratch_scrub is removed from the test, all the test does is populating
> > the fs and mount and pass.
> 
> I've been using it to verify that we can create ext4 filesystems with all
> known types of metadata, and that we can actually capture metadata images
> of such a filesystem.

Then the test descriptions should be updated too, it no longer matches
what the test does. And 'echo "Scrub"' then just mounts the fs is
confusing too :)

Thanks,
Eryu

> 
> > And I think _require_scrub should be updated too to remove ext4 support.
> 
> oops, yes.
> 
> --D
> 
> > 
> > Thanks,
> > Eryu
> > 
> > >  
> > >  # success, all done
> > >  status=0
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 12/8] ext4: don't online scrub ever
  2017-06-30  4:13 ` [PATCH 12/8] ext4: don't online scrub ever Darrick J. Wong
  2017-06-30  4:22   ` Eryu Guan
@ 2017-06-30  4:58   ` Darrick J. Wong
  2017-06-30 12:32     ` Eryu Guan
  1 sibling, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-06-30  4:58 UTC (permalink / raw)
  To: eguan; +Cc: linux-xfs, fstests

The ext4 online scrub program is no longer under active development,
so remove all the test code that tried to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v2: Fix the description to match what it does now
---
 common/fuzzy       |    2 +-
 tests/ext4/023     |    7 ++++---
 tests/ext4/023.out |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/common/fuzzy b/common/fuzzy
index 304268e..686cf77 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -70,7 +70,7 @@ _require_scrub() {
 # Scrub the scratch filesystem metadata (online)
 _scratch_scrub() {
 	case "${FSTYP}" in
-	"xfs"|"ext4"|"ext3"|"ext2")
+	"xfs")
 		$XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
 		;;
 	*)
diff --git a/tests/ext4/023 b/tests/ext4/023
index 4f5cf3e..7ca3d7d 100755
--- a/tests/ext4/023
+++ b/tests/ext4/023
@@ -1,7 +1,9 @@
 #! /bin/bash
 # FS QA Test No. 023
 #
-# Populate a ext4 filesystem and ensure that scrub and repair are happy.
+# Ensure that the populate helpers actually /can/ populate a ext4
+# filesystem with all types of metadata and create an image of the
+# metadata.  Check that fsck is happy with the resulting fs.
 #
 #-----------------------------------------------------------------------
 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
@@ -51,9 +53,8 @@ _require_scrub
 echo "Format and populate"
 _scratch_populate_cached > $seqres.full 2>&1
 
-echo "Scrub"
+echo "Mount"
 _scratch_mount >> $seqres.full 2>&1
-_scratch_scrub >> $seqres.full
 
 # success, all done
 status=0
diff --git a/tests/ext4/023.out b/tests/ext4/023.out
index da2bd60..8a7659b 100644
--- a/tests/ext4/023.out
+++ b/tests/ext4/023.out
@@ -1,3 +1,3 @@
 QA output created by 023
 Format and populate
-Scrub
+Mount

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 12/8] ext4: don't online scrub ever
  2017-06-30  4:58   ` [PATCH v2 " Darrick J. Wong
@ 2017-06-30 12:32     ` Eryu Guan
  0 siblings, 0 replies; 34+ messages in thread
From: Eryu Guan @ 2017-06-30 12:32 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Thu, Jun 29, 2017 at 09:58:12PM -0700, Darrick J. Wong wrote:
> The ext4 online scrub program is no longer under active development,
> so remove all the test code that tried to use it.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> v2: Fix the description to match what it does now
> ---
>  common/fuzzy       |    2 +-
>  tests/ext4/023     |    7 ++++---
>  tests/ext4/023.out |    2 +-
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/common/fuzzy b/common/fuzzy
> index 304268e..686cf77 100644
> --- a/common/fuzzy
> +++ b/common/fuzzy
> @@ -70,7 +70,7 @@ _require_scrub() {
>  # Scrub the scratch filesystem metadata (online)
>  _scratch_scrub() {
>  	case "${FSTYP}" in
> -	"xfs"|"ext4"|"ext3"|"ext2")
> +	"xfs")
>  		$XFS_SCRUB_PROG -d -T -v "$@" $SCRATCH_MNT
>  		;;
>  	*)

The _require_scrub part is still missed, but it's easy enough for me to
fix at commit time :)

I'll give these patches  more exposure time in the list and leave them
to next week's update.

Thanks,
Eryu

> diff --git a/tests/ext4/023 b/tests/ext4/023
> index 4f5cf3e..7ca3d7d 100755
> --- a/tests/ext4/023
> +++ b/tests/ext4/023
> @@ -1,7 +1,9 @@
>  #! /bin/bash
>  # FS QA Test No. 023
>  #
> -# Populate a ext4 filesystem and ensure that scrub and repair are happy.
> +# Ensure that the populate helpers actually /can/ populate a ext4
> +# filesystem with all types of metadata and create an image of the
> +# metadata.  Check that fsck is happy with the resulting fs.
>  #
>  #-----------------------------------------------------------------------
>  # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
> @@ -51,9 +53,8 @@ _require_scrub
>  echo "Format and populate"
>  _scratch_populate_cached > $seqres.full 2>&1
>  
> -echo "Scrub"
> +echo "Mount"
>  _scratch_mount >> $seqres.full 2>&1
> -_scratch_scrub >> $seqres.full
>  
>  # success, all done
>  status=0
> diff --git a/tests/ext4/023.out b/tests/ext4/023.out
> index da2bd60..8a7659b 100644
> --- a/tests/ext4/023.out
> +++ b/tests/ext4/023.out
> @@ -1,3 +1,3 @@
>  QA output created by 023
>  Format and populate
> -Scrub
> +Mount
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 11/8] common/inject: refactor helpers to use new errortag interface
  2017-06-30  4:13 ` [PATCH 11/8] common/inject: refactor helpers to use new errortag interface Darrick J. Wong
@ 2017-07-05 12:16   ` Brian Foster
  2017-07-05 16:29     ` Darrick J. Wong
  0 siblings, 1 reply; 34+ messages in thread
From: Brian Foster @ 2017-07-05 12:16 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: eguan, linux-xfs, fstests

On Thu, Jun 29, 2017 at 09:13:08PM -0700, Darrick J. Wong wrote:
> Refactor the XFS error injection helpers to use the new errortag
> interface to configure error injection.  If that isn't present, fall
> back either to the xfs_io/ioctl based injection or the older sysfs
> knobs.  Refactor existing testcases to use the new helpers.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/inject |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  tests/xfs/051 |    7 ++++--
>  tests/xfs/141 |    5 +++--
>  tests/xfs/196 |   17 ++++++----------
>  4 files changed, 73 insertions(+), 18 deletions(-)
> 
> diff --git a/common/inject b/common/inject
> index 8ecc290..1f12a2b 100644
> --- a/common/inject
> +++ b/common/inject
> @@ -35,10 +35,50 @@ _require_error_injection()
>  	esac
>  }
>  
> +# Find a given xfs mount's errortag injection knob in sysfs
> +_find_xfs_errortag_knob()
> +{
> +	dev="$1"
> +	knob="$2"
> +	shortdev="$(_short_dev "${dev}")"
> +	tagfile="/sys/fs/xfs/${shortdev}/errortag/${knob}"
> +
> +	# Some of the new sysfs errortag knobs were previously available via
> +	# another sysfs path.
> +	case "${knob}" in
> +	"log_bad_crc")
> +		if [ ! -w "${tagfile}" ]; then
> +			tagfile="/sys/fs/xfs/${shortdev}/log/log_badcrc_factor"
> +		fi
> +		;;
> +	"drop_writes")
> +		if [ ! -w "${tagfile}" ]; then
> +			tagfile="/sys/fs/xfs/${shortdev}/drop_writes"
> +		fi
> +		if [ ! -w "${tagfile}" ]; then
> +			tagfile="/sys/fs/xfs/${shortdev}/fail_writes"
> +		fi
> +		;;
> +	"log_recovery_delay"|"bug_on_assert")

What's the purpose for having these here? I'm not sure that either is
really related to error injection (which I find a little confusing
despite that this code can be reused to generically send a value to a
sysfs knob).

> +		# These apply to all xfs filesystems
> +		tagfile="/sys/fs/xfs/debug/${knob}"
> +		;;
> +	*)
> +		;;
> +	esac
> +
> +	echo "${tagfile}"
> +}
> +
>  # Requires that xfs_io inject command knows about this error type
>  _require_xfs_io_error_injection()
>  {
>  	type="$1"
> +
> +	# Can we find the error injection knobs via the new errortag
> +	# configuration mechanism?
> +	test -w "$(_find_xfs_errortag_knob "${TEST_DEV}" "${type}")" && return
> +
>  	_require_error_injection
>  
>  	# NOTE: We can't actually test error injection here because xfs
...
> diff --git a/tests/xfs/196 b/tests/xfs/196
> index e9b0649..5afc343 100755
> --- a/tests/xfs/196
> +++ b/tests/xfs/196
...
> @@ -53,13 +54,7 @@ rm -f $seqres.full
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch
> -
> -DROP_WRITES="drop_writes"
> -# replace "drop_writes" with "fail_writes" for old kernel
> -if [ -f /sys/fs/xfs/$(_short_dev $TEST_DEV)/fail_writes ];then
> -	DROP_WRITES="fail_writes"
> -fi
> -_require_xfs_sysfs $(_short_dev $TEST_DEV)/${DROP_WRITES}
> +_require_xfs_io_error_injection "drop_writes"
>  
>  _scratch_mkfs >/dev/null 2>&1
>  _scratch_mount
> @@ -72,7 +67,7 @@ bytes=$((64 * 1024))
>  $XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1
>  
>  # Enable write drops. All buffered writes are dropped from this point on.
> -echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> +_scratch_inject_error "drop_writes"

I'd prefer to keep the parameter in this case (and below) just as a
defense against future changes in the default value. Otherwise the rest
looks pretty good.

Brian

>  
>  # Write every other 4k range to split the larger delalloc extent into many more
>  # smaller extents. Use pwrite because with write failures enabled, all
> @@ -89,7 +84,7 @@ for i in $(seq 4096 8192 $endoff); do
>  	$XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1
>  done
>  
> -echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> +_scratch_inject_error "drop_writes" 0
>  
>  _scratch_cycle_mount
>  $XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap
> @@ -104,9 +99,9 @@ for offset in $(seq 0 100 500); do
>  	$XFS_IO_PROG -fc "pwrite ${offset}m 100m" $file >> $seqres.full 2>&1
>  
>  	punchoffset=$((offset + 75))
> -	echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> +	_scratch_inject_error "drop_writes"
>  	$XFS_IO_PROG -c "pwrite ${punchoffset}m 4k" $file >> $seqres.full 2>&1
> -	echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> +	_scratch_inject_error "drop_writes" 0
>  done
>  
>  echo "Silence is golden."
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 11/8] common/inject: refactor helpers to use new errortag interface
  2017-07-05 12:16   ` Brian Foster
@ 2017-07-05 16:29     ` Darrick J. Wong
  2017-07-05 16:45       ` Brian Foster
  0 siblings, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-07-05 16:29 UTC (permalink / raw)
  To: Brian Foster; +Cc: eguan, linux-xfs, fstests

On Wed, Jul 05, 2017 at 08:16:11AM -0400, Brian Foster wrote:
> On Thu, Jun 29, 2017 at 09:13:08PM -0700, Darrick J. Wong wrote:
> > Refactor the XFS error injection helpers to use the new errortag
> > interface to configure error injection.  If that isn't present, fall
> > back either to the xfs_io/ioctl based injection or the older sysfs
> > knobs.  Refactor existing testcases to use the new helpers.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/inject |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> >  tests/xfs/051 |    7 ++++--
> >  tests/xfs/141 |    5 +++--
> >  tests/xfs/196 |   17 ++++++----------
> >  4 files changed, 73 insertions(+), 18 deletions(-)
> > 
> > diff --git a/common/inject b/common/inject
> > index 8ecc290..1f12a2b 100644
> > --- a/common/inject
> > +++ b/common/inject
> > @@ -35,10 +35,50 @@ _require_error_injection()
> >  	esac
> >  }
> >  
> > +# Find a given xfs mount's errortag injection knob in sysfs
> > +_find_xfs_errortag_knob()
> > +{
> > +	dev="$1"
> > +	knob="$2"
> > +	shortdev="$(_short_dev "${dev}")"
> > +	tagfile="/sys/fs/xfs/${shortdev}/errortag/${knob}"
> > +
> > +	# Some of the new sysfs errortag knobs were previously available via
> > +	# another sysfs path.
> > +	case "${knob}" in
> > +	"log_bad_crc")
> > +		if [ ! -w "${tagfile}" ]; then
> > +			tagfile="/sys/fs/xfs/${shortdev}/log/log_badcrc_factor"
> > +		fi
> > +		;;
> > +	"drop_writes")
> > +		if [ ! -w "${tagfile}" ]; then
> > +			tagfile="/sys/fs/xfs/${shortdev}/drop_writes"
> > +		fi
> > +		if [ ! -w "${tagfile}" ]; then
> > +			tagfile="/sys/fs/xfs/${shortdev}/fail_writes"
> > +		fi
> > +		;;
> > +	"log_recovery_delay"|"bug_on_assert")
> 
> What's the purpose for having these here? I'm not sure that either is
> really related to error injection (which I find a little confusing
> despite that this code can be reused to generically send a value to a
> sysfs knob).

I was entertaining the thought of making all the debugging knobs
available through a single helper function, though I concede that these
two affect all of XFS and are thus a little weird.

Perhaps a second helper function for module-wide knobs?

> 
> > +		# These apply to all xfs filesystems
> > +		tagfile="/sys/fs/xfs/debug/${knob}"
> > +		;;
> > +	*)
> > +		;;
> > +	esac
> > +
> > +	echo "${tagfile}"
> > +}
> > +
> >  # Requires that xfs_io inject command knows about this error type
> >  _require_xfs_io_error_injection()
> >  {
> >  	type="$1"
> > +
> > +	# Can we find the error injection knobs via the new errortag
> > +	# configuration mechanism?
> > +	test -w "$(_find_xfs_errortag_knob "${TEST_DEV}" "${type}")" && return
> > +
> >  	_require_error_injection
> >  
> >  	# NOTE: We can't actually test error injection here because xfs
> ...
> > diff --git a/tests/xfs/196 b/tests/xfs/196
> > index e9b0649..5afc343 100755
> > --- a/tests/xfs/196
> > +++ b/tests/xfs/196
> ...
> > @@ -53,13 +54,7 @@ rm -f $seqres.full
> >  _supported_fs generic
> >  _supported_os Linux
> >  _require_scratch
> > -
> > -DROP_WRITES="drop_writes"
> > -# replace "drop_writes" with "fail_writes" for old kernel
> > -if [ -f /sys/fs/xfs/$(_short_dev $TEST_DEV)/fail_writes ];then
> > -	DROP_WRITES="fail_writes"
> > -fi
> > -_require_xfs_sysfs $(_short_dev $TEST_DEV)/${DROP_WRITES}
> > +_require_xfs_io_error_injection "drop_writes"
> >  
> >  _scratch_mkfs >/dev/null 2>&1
> >  _scratch_mount
> > @@ -72,7 +67,7 @@ bytes=$((64 * 1024))
> >  $XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1
> >  
> >  # Enable write drops. All buffered writes are dropped from this point on.
> > -echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > +_scratch_inject_error "drop_writes"
> 
> I'd prefer to keep the parameter in this case (and below) just as a
> defense against future changes in the default value. Otherwise the rest
> looks pretty good.

Ok.

> 
> Brian
> 
> >  
> >  # Write every other 4k range to split the larger delalloc extent into many more
> >  # smaller extents. Use pwrite because with write failures enabled, all
> > @@ -89,7 +84,7 @@ for i in $(seq 4096 8192 $endoff); do
> >  	$XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1
> >  done
> >  
> > -echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > +_scratch_inject_error "drop_writes" 0
> >  
> >  _scratch_cycle_mount
> >  $XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap
> > @@ -104,9 +99,9 @@ for offset in $(seq 0 100 500); do
> >  	$XFS_IO_PROG -fc "pwrite ${offset}m 100m" $file >> $seqres.full 2>&1
> >  
> >  	punchoffset=$((offset + 75))
> > -	echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > +	_scratch_inject_error "drop_writes"
> >  	$XFS_IO_PROG -c "pwrite ${punchoffset}m 4k" $file >> $seqres.full 2>&1
> > -	echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > +	_scratch_inject_error "drop_writes" 0
> >  done
> >  
> >  echo "Silence is golden."
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 11/8] common/inject: refactor helpers to use new errortag interface
  2017-07-05 16:29     ` Darrick J. Wong
@ 2017-07-05 16:45       ` Brian Foster
  2017-07-05 21:05         ` Darrick J. Wong
  0 siblings, 1 reply; 34+ messages in thread
From: Brian Foster @ 2017-07-05 16:45 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: eguan, linux-xfs, fstests

On Wed, Jul 05, 2017 at 09:29:14AM -0700, Darrick J. Wong wrote:
> On Wed, Jul 05, 2017 at 08:16:11AM -0400, Brian Foster wrote:
> > On Thu, Jun 29, 2017 at 09:13:08PM -0700, Darrick J. Wong wrote:
> > > Refactor the XFS error injection helpers to use the new errortag
> > > interface to configure error injection.  If that isn't present, fall
> > > back either to the xfs_io/ioctl based injection or the older sysfs
> > > knobs.  Refactor existing testcases to use the new helpers.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> > >  common/inject |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> > >  tests/xfs/051 |    7 ++++--
> > >  tests/xfs/141 |    5 +++--
> > >  tests/xfs/196 |   17 ++++++----------
> > >  4 files changed, 73 insertions(+), 18 deletions(-)
> > > 
> > > diff --git a/common/inject b/common/inject
> > > index 8ecc290..1f12a2b 100644
> > > --- a/common/inject
> > > +++ b/common/inject
> > > @@ -35,10 +35,50 @@ _require_error_injection()
> > >  	esac
> > >  }
> > >  
> > > +# Find a given xfs mount's errortag injection knob in sysfs
> > > +_find_xfs_errortag_knob()
> > > +{
> > > +	dev="$1"
> > > +	knob="$2"
> > > +	shortdev="$(_short_dev "${dev}")"
> > > +	tagfile="/sys/fs/xfs/${shortdev}/errortag/${knob}"
> > > +
> > > +	# Some of the new sysfs errortag knobs were previously available via
> > > +	# another sysfs path.
> > > +	case "${knob}" in
> > > +	"log_bad_crc")
> > > +		if [ ! -w "${tagfile}" ]; then
> > > +			tagfile="/sys/fs/xfs/${shortdev}/log/log_badcrc_factor"
> > > +		fi
> > > +		;;
> > > +	"drop_writes")
> > > +		if [ ! -w "${tagfile}" ]; then
> > > +			tagfile="/sys/fs/xfs/${shortdev}/drop_writes"
> > > +		fi
> > > +		if [ ! -w "${tagfile}" ]; then
> > > +			tagfile="/sys/fs/xfs/${shortdev}/fail_writes"
> > > +		fi
> > > +		;;
> > > +	"log_recovery_delay"|"bug_on_assert")
> > 
> > What's the purpose for having these here? I'm not sure that either is
> > really related to error injection (which I find a little confusing
> > despite that this code can be reused to generically send a value to a
> > sysfs knob).
> 
> I was entertaining the thought of making all the debugging knobs
> available through a single helper function, though I concede that these
> two affect all of XFS and are thus a little weird.
> 
> Perhaps a second helper function for module-wide knobs?
> 

Yeah, though I'm not sure we need to factor the helpers based on whether
a knob is per-fs or global. I was thinking about a generic set of
helpers to handle sysfs knobs, but in poking around it appears we
already have something like that. See xfs/264 and _set_fs_sysfs_attr()
and friends. These currently expect a device param, but we should be
able to fix that up to support either. Perhaps we could also reuse those
to implement the error injection helpers?

Brian

> > 
> > > +		# These apply to all xfs filesystems
> > > +		tagfile="/sys/fs/xfs/debug/${knob}"
> > > +		;;
> > > +	*)
> > > +		;;
> > > +	esac
> > > +
> > > +	echo "${tagfile}"
> > > +}
> > > +
> > >  # Requires that xfs_io inject command knows about this error type
> > >  _require_xfs_io_error_injection()
> > >  {
> > >  	type="$1"
> > > +
> > > +	# Can we find the error injection knobs via the new errortag
> > > +	# configuration mechanism?
> > > +	test -w "$(_find_xfs_errortag_knob "${TEST_DEV}" "${type}")" && return
> > > +
> > >  	_require_error_injection
> > >  
> > >  	# NOTE: We can't actually test error injection here because xfs
> > ...
> > > diff --git a/tests/xfs/196 b/tests/xfs/196
> > > index e9b0649..5afc343 100755
> > > --- a/tests/xfs/196
> > > +++ b/tests/xfs/196
> > ...
> > > @@ -53,13 +54,7 @@ rm -f $seqres.full
> > >  _supported_fs generic
> > >  _supported_os Linux
> > >  _require_scratch
> > > -
> > > -DROP_WRITES="drop_writes"
> > > -# replace "drop_writes" with "fail_writes" for old kernel
> > > -if [ -f /sys/fs/xfs/$(_short_dev $TEST_DEV)/fail_writes ];then
> > > -	DROP_WRITES="fail_writes"
> > > -fi
> > > -_require_xfs_sysfs $(_short_dev $TEST_DEV)/${DROP_WRITES}
> > > +_require_xfs_io_error_injection "drop_writes"
> > >  
> > >  _scratch_mkfs >/dev/null 2>&1
> > >  _scratch_mount
> > > @@ -72,7 +67,7 @@ bytes=$((64 * 1024))
> > >  $XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1
> > >  
> > >  # Enable write drops. All buffered writes are dropped from this point on.
> > > -echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > +_scratch_inject_error "drop_writes"
> > 
> > I'd prefer to keep the parameter in this case (and below) just as a
> > defense against future changes in the default value. Otherwise the rest
> > looks pretty good.
> 
> Ok.
> 
> > 
> > Brian
> > 
> > >  
> > >  # Write every other 4k range to split the larger delalloc extent into many more
> > >  # smaller extents. Use pwrite because with write failures enabled, all
> > > @@ -89,7 +84,7 @@ for i in $(seq 4096 8192 $endoff); do
> > >  	$XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1
> > >  done
> > >  
> > > -echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > +_scratch_inject_error "drop_writes" 0
> > >  
> > >  _scratch_cycle_mount
> > >  $XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap
> > > @@ -104,9 +99,9 @@ for offset in $(seq 0 100 500); do
> > >  	$XFS_IO_PROG -fc "pwrite ${offset}m 100m" $file >> $seqres.full 2>&1
> > >  
> > >  	punchoffset=$((offset + 75))
> > > -	echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > +	_scratch_inject_error "drop_writes"
> > >  	$XFS_IO_PROG -c "pwrite ${punchoffset}m 4k" $file >> $seqres.full 2>&1
> > > -	echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > +	_scratch_inject_error "drop_writes" 0
> > >  done
> > >  
> > >  echo "Silence is golden."
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 11/8] common/inject: refactor helpers to use new errortag interface
  2017-07-05 16:45       ` Brian Foster
@ 2017-07-05 21:05         ` Darrick J. Wong
  2017-07-06 10:07           ` Brian Foster
  0 siblings, 1 reply; 34+ messages in thread
From: Darrick J. Wong @ 2017-07-05 21:05 UTC (permalink / raw)
  To: Brian Foster; +Cc: eguan, linux-xfs, fstests

On Wed, Jul 05, 2017 at 12:45:35PM -0400, Brian Foster wrote:
> On Wed, Jul 05, 2017 at 09:29:14AM -0700, Darrick J. Wong wrote:
> > On Wed, Jul 05, 2017 at 08:16:11AM -0400, Brian Foster wrote:
> > > On Thu, Jun 29, 2017 at 09:13:08PM -0700, Darrick J. Wong wrote:
> > > > Refactor the XFS error injection helpers to use the new errortag
> > > > interface to configure error injection.  If that isn't present, fall
> > > > back either to the xfs_io/ioctl based injection or the older sysfs
> > > > knobs.  Refactor existing testcases to use the new helpers.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > > ---
> > > >  common/inject |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> > > >  tests/xfs/051 |    7 ++++--
> > > >  tests/xfs/141 |    5 +++--
> > > >  tests/xfs/196 |   17 ++++++----------
> > > >  4 files changed, 73 insertions(+), 18 deletions(-)
> > > > 
> > > > diff --git a/common/inject b/common/inject
> > > > index 8ecc290..1f12a2b 100644
> > > > --- a/common/inject
> > > > +++ b/common/inject
> > > > @@ -35,10 +35,50 @@ _require_error_injection()
> > > >  	esac
> > > >  }
> > > >  
> > > > +# Find a given xfs mount's errortag injection knob in sysfs
> > > > +_find_xfs_errortag_knob()
> > > > +{
> > > > +	dev="$1"
> > > > +	knob="$2"
> > > > +	shortdev="$(_short_dev "${dev}")"
> > > > +	tagfile="/sys/fs/xfs/${shortdev}/errortag/${knob}"
> > > > +
> > > > +	# Some of the new sysfs errortag knobs were previously available via
> > > > +	# another sysfs path.
> > > > +	case "${knob}" in
> > > > +	"log_bad_crc")
> > > > +		if [ ! -w "${tagfile}" ]; then
> > > > +			tagfile="/sys/fs/xfs/${shortdev}/log/log_badcrc_factor"
> > > > +		fi
> > > > +		;;
> > > > +	"drop_writes")
> > > > +		if [ ! -w "${tagfile}" ]; then
> > > > +			tagfile="/sys/fs/xfs/${shortdev}/drop_writes"
> > > > +		fi
> > > > +		if [ ! -w "${tagfile}" ]; then
> > > > +			tagfile="/sys/fs/xfs/${shortdev}/fail_writes"
> > > > +		fi
> > > > +		;;
> > > > +	"log_recovery_delay"|"bug_on_assert")
> > > 
> > > What's the purpose for having these here? I'm not sure that either is
> > > really related to error injection (which I find a little confusing
> > > despite that this code can be reused to generically send a value to a
> > > sysfs knob).
> > 
> > I was entertaining the thought of making all the debugging knobs
> > available through a single helper function, though I concede that these
> > two affect all of XFS and are thus a little weird.
> > 
> > Perhaps a second helper function for module-wide knobs?
> > 
> 
> Yeah, though I'm not sure we need to factor the helpers based on whether
> a knob is per-fs or global. I was thinking about a generic set of
> helpers to handle sysfs knobs, but in poking around it appears we
> already have something like that. See xfs/264 and _set_fs_sysfs_attr()
> and friends. These currently expect a device param, but we should be
> able to fix that up to support either. Perhaps we could also reuse those
> to implement the error injection helpers?

It's definitely possible, but I'm not convinced we'd gain enough from
wrapping "echo value > key".  For error injection we have to check that
the sysfs path exists; if so, then write to the path, and if not, call
the ioctl.  Therefore, we'd have to add a _check_fs_sysfs or something
that returns whether or not a sysfs path exists (as opposed to
_require_fs_sysfs which will _notrun the test) and rewrite
_scratch_inject_error to call _check_fs_sysfs and _set_fs_sysfs_attr.
It's certainly doable, but that seems like a lot of work to encapsulate
test -w and echo.

--D

> 
> Brian
> 
> > > 
> > > > +		# These apply to all xfs filesystems
> > > > +		tagfile="/sys/fs/xfs/debug/${knob}"
> > > > +		;;
> > > > +	*)
> > > > +		;;
> > > > +	esac
> > > > +
> > > > +	echo "${tagfile}"
> > > > +}
> > > > +
> > > >  # Requires that xfs_io inject command knows about this error type
> > > >  _require_xfs_io_error_injection()
> > > >  {
> > > >  	type="$1"
> > > > +
> > > > +	# Can we find the error injection knobs via the new errortag
> > > > +	# configuration mechanism?
> > > > +	test -w "$(_find_xfs_errortag_knob "${TEST_DEV}" "${type}")" && return
> > > > +
> > > >  	_require_error_injection
> > > >  
> > > >  	# NOTE: We can't actually test error injection here because xfs
> > > ...
> > > > diff --git a/tests/xfs/196 b/tests/xfs/196
> > > > index e9b0649..5afc343 100755
> > > > --- a/tests/xfs/196
> > > > +++ b/tests/xfs/196
> > > ...
> > > > @@ -53,13 +54,7 @@ rm -f $seqres.full
> > > >  _supported_fs generic
> > > >  _supported_os Linux
> > > >  _require_scratch
> > > > -
> > > > -DROP_WRITES="drop_writes"
> > > > -# replace "drop_writes" with "fail_writes" for old kernel
> > > > -if [ -f /sys/fs/xfs/$(_short_dev $TEST_DEV)/fail_writes ];then
> > > > -	DROP_WRITES="fail_writes"
> > > > -fi
> > > > -_require_xfs_sysfs $(_short_dev $TEST_DEV)/${DROP_WRITES}
> > > > +_require_xfs_io_error_injection "drop_writes"
> > > >  
> > > >  _scratch_mkfs >/dev/null 2>&1
> > > >  _scratch_mount
> > > > @@ -72,7 +67,7 @@ bytes=$((64 * 1024))
> > > >  $XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1
> > > >  
> > > >  # Enable write drops. All buffered writes are dropped from this point on.
> > > > -echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > > +_scratch_inject_error "drop_writes"
> > > 
> > > I'd prefer to keep the parameter in this case (and below) just as a
> > > defense against future changes in the default value. Otherwise the rest
> > > looks pretty good.
> > 
> > Ok.
> > 
> > > 
> > > Brian
> > > 
> > > >  
> > > >  # Write every other 4k range to split the larger delalloc extent into many more
> > > >  # smaller extents. Use pwrite because with write failures enabled, all
> > > > @@ -89,7 +84,7 @@ for i in $(seq 4096 8192 $endoff); do
> > > >  	$XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1
> > > >  done
> > > >  
> > > > -echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > > +_scratch_inject_error "drop_writes" 0
> > > >  
> > > >  _scratch_cycle_mount
> > > >  $XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap
> > > > @@ -104,9 +99,9 @@ for offset in $(seq 0 100 500); do
> > > >  	$XFS_IO_PROG -fc "pwrite ${offset}m 100m" $file >> $seqres.full 2>&1
> > > >  
> > > >  	punchoffset=$((offset + 75))
> > > > -	echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > > +	_scratch_inject_error "drop_writes"
> > > >  	$XFS_IO_PROG -c "pwrite ${punchoffset}m 4k" $file >> $seqres.full 2>&1
> > > > -	echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > > +	_scratch_inject_error "drop_writes" 0
> > > >  done
> > > >  
> > > >  echo "Silence is golden."
> > > > --
> > > > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > > > the body of a message to majordomo@vger.kernel.org
> > > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 11/8] common/inject: refactor helpers to use new errortag interface
  2017-07-05 21:05         ` Darrick J. Wong
@ 2017-07-06 10:07           ` Brian Foster
  0 siblings, 0 replies; 34+ messages in thread
From: Brian Foster @ 2017-07-06 10:07 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: eguan, linux-xfs, fstests

On Wed, Jul 05, 2017 at 02:05:01PM -0700, Darrick J. Wong wrote:
> On Wed, Jul 05, 2017 at 12:45:35PM -0400, Brian Foster wrote:
> > On Wed, Jul 05, 2017 at 09:29:14AM -0700, Darrick J. Wong wrote:
> > > On Wed, Jul 05, 2017 at 08:16:11AM -0400, Brian Foster wrote:
> > > > On Thu, Jun 29, 2017 at 09:13:08PM -0700, Darrick J. Wong wrote:
> > > > > Refactor the XFS error injection helpers to use the new errortag
> > > > > interface to configure error injection.  If that isn't present, fall
> > > > > back either to the xfs_io/ioctl based injection or the older sysfs
> > > > > knobs.  Refactor existing testcases to use the new helpers.
> > > > > 
> > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > > > ---
> > > > >  common/inject |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> > > > >  tests/xfs/051 |    7 ++++--
> > > > >  tests/xfs/141 |    5 +++--
> > > > >  tests/xfs/196 |   17 ++++++----------
> > > > >  4 files changed, 73 insertions(+), 18 deletions(-)
> > > > > 
> > > > > diff --git a/common/inject b/common/inject
> > > > > index 8ecc290..1f12a2b 100644
> > > > > --- a/common/inject
> > > > > +++ b/common/inject
> > > > > @@ -35,10 +35,50 @@ _require_error_injection()
> > > > >  	esac
> > > > >  }
> > > > >  
> > > > > +# Find a given xfs mount's errortag injection knob in sysfs
> > > > > +_find_xfs_errortag_knob()
> > > > > +{
> > > > > +	dev="$1"
> > > > > +	knob="$2"
> > > > > +	shortdev="$(_short_dev "${dev}")"
> > > > > +	tagfile="/sys/fs/xfs/${shortdev}/errortag/${knob}"
> > > > > +
> > > > > +	# Some of the new sysfs errortag knobs were previously available via
> > > > > +	# another sysfs path.
> > > > > +	case "${knob}" in
> > > > > +	"log_bad_crc")
> > > > > +		if [ ! -w "${tagfile}" ]; then
> > > > > +			tagfile="/sys/fs/xfs/${shortdev}/log/log_badcrc_factor"
> > > > > +		fi
> > > > > +		;;
> > > > > +	"drop_writes")
> > > > > +		if [ ! -w "${tagfile}" ]; then
> > > > > +			tagfile="/sys/fs/xfs/${shortdev}/drop_writes"
> > > > > +		fi
> > > > > +		if [ ! -w "${tagfile}" ]; then
> > > > > +			tagfile="/sys/fs/xfs/${shortdev}/fail_writes"
> > > > > +		fi
> > > > > +		;;
> > > > > +	"log_recovery_delay"|"bug_on_assert")
> > > > 
> > > > What's the purpose for having these here? I'm not sure that either is
> > > > really related to error injection (which I find a little confusing
> > > > despite that this code can be reused to generically send a value to a
> > > > sysfs knob).
> > > 
> > > I was entertaining the thought of making all the debugging knobs
> > > available through a single helper function, though I concede that these
> > > two affect all of XFS and are thus a little weird.
> > > 
> > > Perhaps a second helper function for module-wide knobs?
> > > 
> > 
> > Yeah, though I'm not sure we need to factor the helpers based on whether
> > a knob is per-fs or global. I was thinking about a generic set of
> > helpers to handle sysfs knobs, but in poking around it appears we
> > already have something like that. See xfs/264 and _set_fs_sysfs_attr()
> > and friends. These currently expect a device param, but we should be
> > able to fix that up to support either. Perhaps we could also reuse those
> > to implement the error injection helpers?
> 
> It's definitely possible, but I'm not convinced we'd gain enough from
> wrapping "echo value > key".  For error injection we have to check that
> the sysfs path exists; if so, then write to the path, and if not, call
> the ioctl.  Therefore, we'd have to add a _check_fs_sysfs or something
> that returns whether or not a sysfs path exists (as opposed to
> _require_fs_sysfs which will _notrun the test) and rewrite
> _scratch_inject_error to call _check_fs_sysfs and _set_fs_sysfs_attr.
> It's certainly doable, but that seems like a lot of work to encapsulate
> test -w and echo.
> 

Indeed, it's probably not be worth it if the common code ends up as
basically just the knob update. Perhaps we should just update the
existing _set_fs_sysfs_attr() api to support a NULL device for such
global knobs and call it a day (and this patch can just drop the bits
unrelated to error injection).

Brian

> --D
> 
> > 
> > Brian
> > 
> > > > 
> > > > > +		# These apply to all xfs filesystems
> > > > > +		tagfile="/sys/fs/xfs/debug/${knob}"
> > > > > +		;;
> > > > > +	*)
> > > > > +		;;
> > > > > +	esac
> > > > > +
> > > > > +	echo "${tagfile}"
> > > > > +}
> > > > > +
> > > > >  # Requires that xfs_io inject command knows about this error type
> > > > >  _require_xfs_io_error_injection()
> > > > >  {
> > > > >  	type="$1"
> > > > > +
> > > > > +	# Can we find the error injection knobs via the new errortag
> > > > > +	# configuration mechanism?
> > > > > +	test -w "$(_find_xfs_errortag_knob "${TEST_DEV}" "${type}")" && return
> > > > > +
> > > > >  	_require_error_injection
> > > > >  
> > > > >  	# NOTE: We can't actually test error injection here because xfs
> > > > ...
> > > > > diff --git a/tests/xfs/196 b/tests/xfs/196
> > > > > index e9b0649..5afc343 100755
> > > > > --- a/tests/xfs/196
> > > > > +++ b/tests/xfs/196
> > > > ...
> > > > > @@ -53,13 +54,7 @@ rm -f $seqres.full
> > > > >  _supported_fs generic
> > > > >  _supported_os Linux
> > > > >  _require_scratch
> > > > > -
> > > > > -DROP_WRITES="drop_writes"
> > > > > -# replace "drop_writes" with "fail_writes" for old kernel
> > > > > -if [ -f /sys/fs/xfs/$(_short_dev $TEST_DEV)/fail_writes ];then
> > > > > -	DROP_WRITES="fail_writes"
> > > > > -fi
> > > > > -_require_xfs_sysfs $(_short_dev $TEST_DEV)/${DROP_WRITES}
> > > > > +_require_xfs_io_error_injection "drop_writes"
> > > > >  
> > > > >  _scratch_mkfs >/dev/null 2>&1
> > > > >  _scratch_mount
> > > > > @@ -72,7 +67,7 @@ bytes=$((64 * 1024))
> > > > >  $XFS_IO_PROG -f -c "pwrite 0 $bytes" $file >> $seqres.full 2>&1
> > > > >  
> > > > >  # Enable write drops. All buffered writes are dropped from this point on.
> > > > > -echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > > > +_scratch_inject_error "drop_writes"
> > > > 
> > > > I'd prefer to keep the parameter in this case (and below) just as a
> > > > defense against future changes in the default value. Otherwise the rest
> > > > looks pretty good.
> > > 
> > > Ok.
> > > 
> > > > 
> > > > Brian
> > > > 
> > > > >  
> > > > >  # Write every other 4k range to split the larger delalloc extent into many more
> > > > >  # smaller extents. Use pwrite because with write failures enabled, all
> > > > > @@ -89,7 +84,7 @@ for i in $(seq 4096 8192 $endoff); do
> > > > >  	$XFS_IO_PROG -c "pwrite $i 4k" $file >> $seqres.full 2>&1
> > > > >  done
> > > > >  
> > > > > -echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > > > +_scratch_inject_error "drop_writes" 0
> > > > >  
> > > > >  _scratch_cycle_mount
> > > > >  $XFS_IO_PROG -c 'bmap -vp' $file | _filter_bmap
> > > > > @@ -104,9 +99,9 @@ for offset in $(seq 0 100 500); do
> > > > >  	$XFS_IO_PROG -fc "pwrite ${offset}m 100m" $file >> $seqres.full 2>&1
> > > > >  
> > > > >  	punchoffset=$((offset + 75))
> > > > > -	echo 1 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > > > +	_scratch_inject_error "drop_writes"
> > > > >  	$XFS_IO_PROG -c "pwrite ${punchoffset}m 4k" $file >> $seqres.full 2>&1
> > > > > -	echo 0 > /sys/fs/xfs/$sdev/$DROP_WRITES
> > > > > +	_scratch_inject_error "drop_writes" 0
> > > > >  done
> > > > >  
> > > > >  echo "Silence is golden."
> > > > > --
> > > > > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > > > > the body of a message to majordomo@vger.kernel.org
> > > > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > > > --
> > > > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > > > the body of a message to majordomo@vger.kernel.org
> > > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2017-07-06 10:07 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 21:57 [PATCH 0/8] miscellaneous tests Darrick J. Wong
2017-06-21 21:57 ` [PATCH 1/8] ext4: fsmap tests Darrick J. Wong
2017-06-23  7:41   ` Eryu Guan
2017-06-23 15:35     ` Darrick J. Wong
2017-06-21 21:57 ` [PATCH 2/8] xfs/274: flip shared bits to reflect xfsprogs usage Darrick J. Wong
2017-06-21 21:57 ` [PATCH 3/8] xfs: don't allow realtime swap files Darrick J. Wong
2017-06-21 21:57 ` [PATCH 4/8] xfs/040: use compare-libxfs in xfsprogs Darrick J. Wong
2017-06-21 21:57 ` [PATCH 5/8] reflink: test unlinking a huge extent with a lot of refcount adjustments Darrick J. Wong
2017-06-29  9:36   ` Eryu Guan
2017-06-29 16:07     ` Darrick J. Wong
2017-06-29 17:19       ` Eryu Guan
2017-06-21 21:57 ` [PATCH 6/8] xfs: test that we can SEEK_HOLE/DATA data and holes that are in the CoW fork only Darrick J. Wong
2017-06-21 21:58 ` [PATCH 7/8] xfs: test freeze/rmap repair race Darrick J. Wong
2017-06-29  9:47   ` Eryu Guan
2017-06-29 17:17     ` Darrick J. Wong
2017-06-21 21:58 ` [PATCH 8/8] xfs: scrub while appending to a file Darrick J. Wong
2017-06-22  6:26 ` [PATCH 9/8] common/populate: remember multi-device configurations Darrick J. Wong
2017-06-23  7:49   ` Eryu Guan
2017-06-23 15:34     ` Darrick J. Wong
2017-06-30  4:12   ` [PATCH v2 " Darrick J. Wong
2017-06-23  7:59 ` [PATCH 0/8] miscellaneous tests Eryu Guan
2017-06-30  4:12 ` [PATCH 10/8] common/rc: test that the xfs_io scrub/repair commands actually work Darrick J. Wong
2017-06-30  4:13 ` [PATCH 11/8] common/inject: refactor helpers to use new errortag interface Darrick J. Wong
2017-07-05 12:16   ` Brian Foster
2017-07-05 16:29     ` Darrick J. Wong
2017-07-05 16:45       ` Brian Foster
2017-07-05 21:05         ` Darrick J. Wong
2017-07-06 10:07           ` Brian Foster
2017-06-30  4:13 ` [PATCH 12/8] ext4: don't online scrub ever Darrick J. Wong
2017-06-30  4:22   ` Eryu Guan
2017-06-30  4:26     ` Darrick J. Wong
2017-06-30  4:33       ` Eryu Guan
2017-06-30  4:58   ` [PATCH v2 " Darrick J. Wong
2017-06-30 12:32     ` Eryu Guan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.