All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] xfstests: misc reflink test fixes
@ 2016-12-11 21:52 ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:52 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Hi all,

The following patchset enable the use of xfstests to test reflink
functionality under ocfs2.  The first patch tests the ability to reflink
into and out of inline-data files on ocfs2.  Patches 2-6 fix various
problems with the tests that came up when qualifying ocfs2.

The last patch maliciously corrupts ext4 and xfs filesystems to
exploit nonexistent checking of i_size in order to coerce Linux into
loading a file with negative size.  It then exploits integer overflows
in the VFS writeback code to hard lock the kernel.  Don't run the tests
in this patch ({ext4,xfs}/40[01]) unless you have a fixed kernel (4.10?)

Comments and questions are, as always, welcome.

--D

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

* [Ocfs2-devel] [PATCH 0/7] xfstests: misc reflink test fixes
@ 2016-12-11 21:52 ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:52 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Hi all,

The following patchset enable the use of xfstests to test reflink
functionality under ocfs2.  The first patch tests the ability to reflink
into and out of inline-data files on ocfs2.  Patches 2-6 fix various
problems with the tests that came up when qualifying ocfs2.

The last patch maliciously corrupts ext4 and xfs filesystems to
exploit nonexistent checking of i_size in order to coerce Linux into
loading a file with negative size.  It then exploits integer overflows
in the VFS writeback code to hard lock the kernel.  Don't run the tests
in this patch ({ext4,xfs}/40[01]) unless you have a fixed kernel (4.10?)

Comments and questions are, as always, welcome.

--D

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

* [PATCH 1/7] ocfs2: test reflinking to inline data files
  2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-11 21:52   ` Darrick J. Wong
  -1 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:52 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Make sure that we can handle reflinking from and to inline-data files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink       |    2 +
 tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ocfs2/001.out  |   14 ++++++++
 tests/ocfs2/Makefile |   20 +++++++++++
 tests/ocfs2/group    |    1 +
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100755 tests/ocfs2/001
 create mode 100644 tests/ocfs2/001.out
 create mode 100644 tests/ocfs2/Makefile
 create mode 100644 tests/ocfs2/group


diff --git a/common/reflink b/common/reflink
index 9d51729..d048045 100644
--- a/common/reflink
+++ b/common/reflink
@@ -197,7 +197,7 @@ _cp_reflink() {
 	file1="$1"
 	file2="$2"
 
-	cp --reflink=always -p "$file1" "$file2"
+	cp --reflink=always -p -f "$file1" "$file2"
 }
 
 # Reflink some file1 into file2
diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
new file mode 100755
index 0000000..afb9ce9
--- /dev/null
+++ b/tests/ocfs2/001
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 001
+#
+# Ensure that reflink works correctly with inline-data files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, 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 ocfs2
+_require_scratch_reflink
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1
+tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
+	_notrun "Inline data is not supported."
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+sz=65536
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+echo x > $testdir/file2
+echo x > $testdir/file3
+echo y > $testdir/file4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
+echo a > $testdir/file6
+_scratch_cycle_mount
+
+echo "reflink into the start of file2"
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "reflink past the stuff in file3"
+_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
+
+echo "reflink an inline-data file to a regular one"
+_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
+
+echo "reflink an inline-data file to another inline-data file"
+_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
+
+echo "Verify the whole mess"
+_scratch_cycle_mount
+md5sum $testdir/file* | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
new file mode 100644
index 0000000..99fa43a
--- /dev/null
+++ b/tests/ocfs2/001.out
@@ -0,0 +1,14 @@
+QA output created by 001
+Format and mount
+Create the original files
+reflink into the start of file2
+reflink past the stuff in file3
+reflink an inline-data file to a regular one
+reflink an inline-data file to another inline-data file
+Verify the whole mess
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
+4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
diff --git a/tests/ocfs2/Makefile b/tests/ocfs2/Makefile
new file mode 100644
index 0000000..70a4f16
--- /dev/null
+++ b/tests/ocfs2/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2016 Oracle.  All Rights Reserved.
+#
+
+TOPDIR = ../..
+include $(TOPDIR)/include/builddefs
+
+OCFS2_DIR = ocfs2
+TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(OCFS2_DIR)
+
+include $(BUILDRULES)
+
+install:
+	$(INSTALL) -m 755 -d $(TARGET_DIR)
+	$(INSTALL) -m 755 $(TESTS) $(TARGET_DIR)
+	$(INSTALL) -m 644 group $(TARGET_DIR)
+	$(INSTALL) -m 644 $(OUTFILES) $(TARGET_DIR)
+
+# Nothing.
+install-dev install-lib:
diff --git a/tests/ocfs2/group b/tests/ocfs2/group
new file mode 100644
index 0000000..28e6807
--- /dev/null
+++ b/tests/ocfs2/group
@@ -0,0 +1 @@
+001 auto quick clone


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

* [Ocfs2-devel] [PATCH 1/7] ocfs2: test reflinking to inline data files
@ 2016-12-11 21:52   ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:52 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Make sure that we can handle reflinking from and to inline-data files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink       |    2 +
 tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ocfs2/001.out  |   14 ++++++++
 tests/ocfs2/Makefile |   20 +++++++++++
 tests/ocfs2/group    |    1 +
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100755 tests/ocfs2/001
 create mode 100644 tests/ocfs2/001.out
 create mode 100644 tests/ocfs2/Makefile
 create mode 100644 tests/ocfs2/group


diff --git a/common/reflink b/common/reflink
index 9d51729..d048045 100644
--- a/common/reflink
+++ b/common/reflink
@@ -197,7 +197,7 @@ _cp_reflink() {
 	file1="$1"
 	file2="$2"
 
-	cp --reflink=always -p "$file1" "$file2"
+	cp --reflink=always -p -f "$file1" "$file2"
 }
 
 # Reflink some file1 into file2
diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
new file mode 100755
index 0000000..afb9ce9
--- /dev/null
+++ b/tests/ocfs2/001
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 001
+#
+# Ensure that reflink works correctly with inline-data files.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016, 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 ocfs2
+_require_scratch_reflink
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1
+tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
+	_notrun "Inline data is not supported."
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+sz=65536
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+echo x > $testdir/file2
+echo x > $testdir/file3
+echo y > $testdir/file4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
+echo a > $testdir/file6
+_scratch_cycle_mount
+
+echo "reflink into the start of file2"
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "reflink past the stuff in file3"
+_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
+
+echo "reflink an inline-data file to a regular one"
+_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
+
+echo "reflink an inline-data file to another inline-data file"
+_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
+
+echo "Verify the whole mess"
+_scratch_cycle_mount
+md5sum $testdir/file* | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
new file mode 100644
index 0000000..99fa43a
--- /dev/null
+++ b/tests/ocfs2/001.out
@@ -0,0 +1,14 @@
+QA output created by 001
+Format and mount
+Create the original files
+reflink into the start of file2
+reflink past the stuff in file3
+reflink an inline-data file to a regular one
+reflink an inline-data file to another inline-data file
+Verify the whole mess
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
+4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
diff --git a/tests/ocfs2/Makefile b/tests/ocfs2/Makefile
new file mode 100644
index 0000000..70a4f16
--- /dev/null
+++ b/tests/ocfs2/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2016 Oracle.  All Rights Reserved.
+#
+
+TOPDIR = ../..
+include $(TOPDIR)/include/builddefs
+
+OCFS2_DIR = ocfs2
+TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(OCFS2_DIR)
+
+include $(BUILDRULES)
+
+install:
+	$(INSTALL) -m 755 -d $(TARGET_DIR)
+	$(INSTALL) -m 755 $(TESTS) $(TARGET_DIR)
+	$(INSTALL) -m 644 group $(TARGET_DIR)
+	$(INSTALL) -m 644 $(OUTFILES) $(TARGET_DIR)
+
+# Nothing.
+install-dev install-lib:
diff --git a/tests/ocfs2/group b/tests/ocfs2/group
new file mode 100644
index 0000000..28e6807
--- /dev/null
+++ b/tests/ocfs2/group
@@ -0,0 +1 @@
+001 auto quick clone

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

* [PATCH 2/7] ocfs2/reflink: fix file block size reporting
  2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-11 21:52   ` Darrick J. Wong
  -1 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:52 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Some of the reflink tests try to require a specific filesystem block
size so that they can test file block manipulation functions.  That's
straightforward for most filesystems but ocfs2 throws in the additional
twist that data fork block mappings are stored in units of clusters, not
blocks, which causes these reflink tests to fail.

Therefore, introduce a new helper that retrieves the file minimum block
size and adapt the reflink tests to use that instead.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |   21 +++++++++++++++++++--
 tests/generic/205 |    2 +-
 tests/generic/206 |    2 +-
 tests/generic/216 |    2 +-
 tests/generic/217 |    2 +-
 tests/generic/218 |    2 +-
 tests/generic/220 |    2 +-
 tests/generic/222 |    2 +-
 tests/generic/227 |    2 +-
 tests/generic/229 |    2 +-
 tests/generic/238 |    2 +-
 11 files changed, 29 insertions(+), 12 deletions(-)


diff --git a/common/rc b/common/rc
index 2639fbd..30111d4 100644
--- a/common/rc
+++ b/common/rc
@@ -925,7 +925,7 @@ _scratch_mkfs_blocksized()
 	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
 	;;
     ocfs2)
-	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
 	;;
     *)
 	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
@@ -3029,13 +3029,30 @@ _sysfs_dev()
 	echo /sys/dev/block/$_maj:$_min
 }
 
+# Get the minimum block size of a file.  Usually this is the
+# minimum fs block size, but some filesystems (ocfs2) do block
+# mappings in larger units.
+get_file_block_size()
+{
+	if [ -z $1 ] || [ ! -d $1 ]; then
+		echo "Missing mount point argument for get_file_block_size"
+		exit 1
+	fi
+	if [ "$FSTYP" = "ocfs2" ]; then
+		stat -c '%o' $1
+	else
+		stat -f -c '%S' $1
+	fi
+}
+
+# Get the minimum block size of an fs.
 get_block_size()
 {
 	if [ -z $1 ] || [ ! -d $1 ]; then
 		echo "Missing mount point argument for get_block_size"
 		exit 1
 	fi
-	echo `stat -f -c %S $1`
+	stat -f -c %S $1
 }
 
 get_page_size()
diff --git a/tests/generic/205 b/tests/generic/205
index cfda8c3..7889ca4 100755
--- a/tests/generic/205
+++ b/tests/generic/205
@@ -60,7 +60,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/206 b/tests/generic/206
index 909956f..f82e146 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/216 b/tests/generic/216
index d9b868a..cbff75f 100755
--- a/tests/generic/216
+++ b/tests/generic/216
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/217 b/tests/generic/217
index 65113d9..5f59fd8 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/218 b/tests/generic/218
index 21029ef..bdce367 100755
--- a/tests/generic/218
+++ b/tests/generic/218
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/220 b/tests/generic/220
index c54bf06..29d2f04 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/222 b/tests/generic/222
index d7ee57e..3052a22 100755
--- a/tests/generic/222
+++ b/tests/generic/222
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/227 b/tests/generic/227
index fa6a33e..18441cf 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/229 b/tests/generic/229
index 3e2c6f4..99eb774 100755
--- a/tests/generic/229
+++ b/tests/generic/229
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 runtest() {
diff --git a/tests/generic/238 b/tests/generic/238
index a2f44e8..5419a30 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 runtest() {


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

* [Ocfs2-devel] [PATCH 2/7] ocfs2/reflink: fix file block size reporting
@ 2016-12-11 21:52   ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:52 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Some of the reflink tests try to require a specific filesystem block
size so that they can test file block manipulation functions.  That's
straightforward for most filesystems but ocfs2 throws in the additional
twist that data fork block mappings are stored in units of clusters, not
blocks, which causes these reflink tests to fail.

Therefore, introduce a new helper that retrieves the file minimum block
size and adapt the reflink tests to use that instead.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc         |   21 +++++++++++++++++++--
 tests/generic/205 |    2 +-
 tests/generic/206 |    2 +-
 tests/generic/216 |    2 +-
 tests/generic/217 |    2 +-
 tests/generic/218 |    2 +-
 tests/generic/220 |    2 +-
 tests/generic/222 |    2 +-
 tests/generic/227 |    2 +-
 tests/generic/229 |    2 +-
 tests/generic/238 |    2 +-
 11 files changed, 29 insertions(+), 12 deletions(-)


diff --git a/common/rc b/common/rc
index 2639fbd..30111d4 100644
--- a/common/rc
+++ b/common/rc
@@ -925,7 +925,7 @@ _scratch_mkfs_blocksized()
 	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
 	;;
     ocfs2)
-	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
 	;;
     *)
 	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
@@ -3029,13 +3029,30 @@ _sysfs_dev()
 	echo /sys/dev/block/$_maj:$_min
 }
 
+# Get the minimum block size of a file.  Usually this is the
+# minimum fs block size, but some filesystems (ocfs2) do block
+# mappings in larger units.
+get_file_block_size()
+{
+	if [ -z $1 ] || [ ! -d $1 ]; then
+		echo "Missing mount point argument for get_file_block_size"
+		exit 1
+	fi
+	if [ "$FSTYP" = "ocfs2" ]; then
+		stat -c '%o' $1
+	else
+		stat -f -c '%S' $1
+	fi
+}
+
+# Get the minimum block size of an fs.
 get_block_size()
 {
 	if [ -z $1 ] || [ ! -d $1 ]; then
 		echo "Missing mount point argument for get_block_size"
 		exit 1
 	fi
-	echo `stat -f -c %S $1`
+	stat -f -c %S $1
 }
 
 get_page_size()
diff --git a/tests/generic/205 b/tests/generic/205
index cfda8c3..7889ca4 100755
--- a/tests/generic/205
+++ b/tests/generic/205
@@ -60,7 +60,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/206 b/tests/generic/206
index 909956f..f82e146 100755
--- a/tests/generic/206
+++ b/tests/generic/206
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/216 b/tests/generic/216
index d9b868a..cbff75f 100755
--- a/tests/generic/216
+++ b/tests/generic/216
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/217 b/tests/generic/217
index 65113d9..5f59fd8 100755
--- a/tests/generic/217
+++ b/tests/generic/217
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/218 b/tests/generic/218
index 21029ef..bdce367 100755
--- a/tests/generic/218
+++ b/tests/generic/218
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/220 b/tests/generic/220
index c54bf06..29d2f04 100755
--- a/tests/generic/220
+++ b/tests/generic/220
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/222 b/tests/generic/222
index d7ee57e..3052a22 100755
--- a/tests/generic/222
+++ b/tests/generic/222
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/227 b/tests/generic/227
index fa6a33e..18441cf 100755
--- a/tests/generic/227
+++ b/tests/generic/227
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 echo "Create the original files"
diff --git a/tests/generic/229 b/tests/generic/229
index 3e2c6f4..99eb774 100755
--- a/tests/generic/229
+++ b/tests/generic/229
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 runtest() {
diff --git a/tests/generic/238 b/tests/generic/238
index a2f44e8..5419a30 100755
--- a/tests/generic/238
+++ b/tests/generic/238
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-real_blksz=$(get_block_size $testdir)
+real_blksz=$(get_file_block_size $testdir)
 test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
 
 runtest() {

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

* [PATCH 3/7] reflink: fix quota tests to work properly
  2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-11 21:53   ` Darrick J. Wong
  -1 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Fix the reflink quota tests to su to the fsgqa user so that we actually
test enforcement of quotas.  Seems that XFS enforces user quotas even
if root is writing to a user file, whereas everything else lets root
writes through.  Also clean up some of the variable usage and
_require_user.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/305     |    2 +-
 tests/generic/305.out |   30 +++++++++++++++---------------
 tests/generic/326     |    2 +-
 tests/generic/326.out |   30 +++++++++++++++---------------
 tests/generic/327     |   12 +++++++-----
 tests/generic/327.out |   12 ++++++------
 tests/generic/328     |   14 ++++++++------
 tests/generic/328.out |   28 ++++++++++++++--------------
 8 files changed, 67 insertions(+), 63 deletions(-)


diff --git a/tests/generic/305 b/tests/generic/305
index d73d87f..9c3489b 100755
--- a/tests/generic/305
+++ b/tests/generic/305
@@ -51,7 +51,7 @@ _require_quota
 _require_nobody
 
 _repquota() {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota -O csv $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk -F ',' '{print $1, $4, $5, $6}'
 }
 rm -f $seqres.full
 
diff --git a/tests/generic/305.out b/tests/generic/305.out
index 0bfd620..fbd4e24 100644
--- a/tests/generic/305.out
+++ b/tests/generic/305.out
@@ -1,22 +1,22 @@
 QA output created by 305
 Format and mount
 Create the original files
-root      --    3072       0       0              7     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --       0       0       0              1     0     0       
+root 3072 0 0
+nobody 0 0 0
+fsgqa 0 0 0
 Change file ownership
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 CoW one of the files
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 Remount the FS to see if accounting changes
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 Chown one of the files
-root      --       0       0       0              4     0     0       
-nobody    --    1024       0       0              2     0     0       
-fsgqa     --    2048       0       0              3     0     0       
+root 0 0 0
+nobody 1024 0 0
+fsgqa 2048 0 0
diff --git a/tests/generic/326 b/tests/generic/326
index 8afc6a2..b86f6a2 100755
--- a/tests/generic/326
+++ b/tests/generic/326
@@ -52,7 +52,7 @@ _require_nobody
 _require_odirect
 
 _repquota() {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota -O csv $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk -F ',' '{print $1, $4, $5, $6}'
 }
 rm -f $seqres.full
 
diff --git a/tests/generic/326.out b/tests/generic/326.out
index e771eb7..de7f20b 100644
--- a/tests/generic/326.out
+++ b/tests/generic/326.out
@@ -1,22 +1,22 @@
 QA output created by 326
 Format and mount
 Create the original files
-root      --    3072       0       0              7     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --       0       0       0              1     0     0       
+root 3072 0 0
+nobody 0 0 0
+fsgqa 0 0 0
 Change file ownership
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 CoW one of the files
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 Remount the FS to see if accounting changes
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 Chown one of the files
-root      --       0       0       0              4     0     0       
-nobody    --    1024       0       0              2     0     0       
-fsgqa     --    2048       0       0              3     0     0       
+root 0 0 0
+nobody 1024 0 0
+fsgqa 2048 0 0
diff --git a/tests/generic/327 b/tests/generic/327
index c165ad5..29706e9 100755
--- a/tests/generic/327
+++ b/tests/generic/327
@@ -48,9 +48,10 @@ _require_cp_reflink
 _require_fiemap
 _require_quota
 _require_nobody
+_require_user
 
 _repquota() {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota -O csv $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk -F ',' '{print $1, $4, $5, $6}'
 }
 rm -f $seqres.full
 
@@ -67,19 +68,20 @@ mkdir $testdir
 sz=1048576
 echo "Create the original files"
 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
-chown fsgqa $testdir/file1
+chown $qa_user $testdir/file1
 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
 _repquota
 _scratch_cycle_mount
+quotaon $SCRATCH_MNT 2> /dev/null
 
 echo "Set hard quota to prevent third reflink"
-setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
+setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
 _repquota
 
 echo "Try to reflink again"
 touch $testdir/file3
-chown fsgqa $testdir/file3
-_cp_reflink $testdir/file1 $testdir/file3 2>&1 | _filter_scratch
+chown $qa_user $testdir/file3
+su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch
 _repquota
 
 # success, all done
diff --git a/tests/generic/327.out b/tests/generic/327.out
index 7160ff2..f4e145a 100644
--- a/tests/generic/327.out
+++ b/tests/generic/327.out
@@ -1,12 +1,12 @@
 QA output created by 327
 Format and mount
 Create the original files
-root      --       0       0       0              4     0     0       
-fsgqa     --    2048       0       0              2     0     0       
+root 0 0 0
+fsgqa 2048 0 0
 Set hard quota to prevent third reflink
-root      --       0       0       0              4     0     0       
-fsgqa     +-    2048       0    1024              2     0     0       
+root 0 0 0
+fsgqa 2048 0 1024
 Try to reflink again
 cp: failed to clone 'SCRATCH_MNT/test-327/file3' from 'SCRATCH_MNT/test-327/file1': Disk quota exceeded
-root      --       0       0       0              4     0     0       
-fsgqa     +-    2048       0    1024              3     0     0       
+root 0 0 0
+fsgqa 2048 0 1024
diff --git a/tests/generic/328 b/tests/generic/328
index 705368e..7800246 100755
--- a/tests/generic/328
+++ b/tests/generic/328
@@ -49,9 +49,10 @@ _require_fiemap
 _require_quota
 _require_nobody
 _require_odirect
+_require_user
 
 _repquota() {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota -O csv $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk -F ',' '{print $1, $4, $5, $6}'
 }
 rm -f $seqres.full
 
@@ -68,28 +69,29 @@ mkdir $testdir
 sz=1048576
 echo "Create the original files"
 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
-chown fsgqa $testdir/file1
+chown $qa_user $testdir/file1
 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
 _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
 _repquota
 _scratch_cycle_mount
+quotaon $SCRATCH_MNT 2> /dev/null
 
 echo "Set hard quota to prevent rewrite"
-setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
+setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
 _repquota
 
 echo "Try to dio write the whole file"
-_pwrite_byte 0x62 0 $sz $testdir/file1 -d 2>&1 >> $seqres.full | \
+su $qa_user -c '$XFS_IO_PROG -d -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
 	_filter_xfs_io_error
 _repquota
 
 echo "Try to write the whole file"
-_pwrite_byte 0x62 0 $sz $testdir/file1 2>&1 >> $seqres.full | \
+su $qa_user -c '$XFS_IO_PROG -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
 	_filter_xfs_io_error
 _repquota
 
 echo "Set hard quota to allow rewrite"
-setquota -u fsgqa 0 8192 0 0 $SCRATCH_MNT
+setquota -u $qa_user 0 8192 0 0 $SCRATCH_MNT
 _repquota
 
 echo "Try to dio write the whole file"
diff --git a/tests/generic/328.out b/tests/generic/328.out
index 4630151..b7fe9f8 100644
--- a/tests/generic/328.out
+++ b/tests/generic/328.out
@@ -1,25 +1,25 @@
 QA output created by 328
 Format and mount
 Create the original files
-root      --       0       0       0              4     0     0       
-fsgqa     --    3072       0       0              3     0     0       
+root 0 0 0
+fsgqa 3072 0 0
 Set hard quota to prevent rewrite
-root      --       0       0       0              4     0     0       
-fsgqa     +-    3072       0    1024              3     0     0       
+root 0 0 0
+fsgqa 3072 0 1024
 Try to dio write the whole file
 pwrite: Disk quota exceeded
-root      --       0       0       0              4     0     0       
-fsgqa     +-    3072       0    1024              3     0     0       
+root 0 0 0
+fsgqa 3072 0 1024
 Try to write the whole file
 pwrite: Disk quota exceeded
-root      --       0       0       0              4     0     0       
-fsgqa     +-    3072       0    1024              3     0     0       
+root 0 0 0
+fsgqa 3072 0 1024
 Set hard quota to allow rewrite
-root      --       0       0       0              4     0     0       
-fsgqa     --    3072       0    8192              3     0     0       
+root 0 0 0
+fsgqa 3072 0 8192
 Try to dio write the whole file
-root      --       0       0       0              4     0     0       
-fsgqa     --    3072       0    8192              3     0     0       
+root 0 0 0
+fsgqa 3072 0 8192
 Try to write the whole file
-root      --       0       0       0              4     0     0       
-fsgqa     --    3072       0    8192              3     0     0       
+root 0 0 0
+fsgqa 3072 0 8192


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

* [Ocfs2-devel] [PATCH 3/7] reflink: fix quota tests to work properly
@ 2016-12-11 21:53   ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Fix the reflink quota tests to su to the fsgqa user so that we actually
test enforcement of quotas.  Seems that XFS enforces user quotas even
if root is writing to a user file, whereas everything else lets root
writes through.  Also clean up some of the variable usage and
_require_user.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/305     |    2 +-
 tests/generic/305.out |   30 +++++++++++++++---------------
 tests/generic/326     |    2 +-
 tests/generic/326.out |   30 +++++++++++++++---------------
 tests/generic/327     |   12 +++++++-----
 tests/generic/327.out |   12 ++++++------
 tests/generic/328     |   14 ++++++++------
 tests/generic/328.out |   28 ++++++++++++++--------------
 8 files changed, 67 insertions(+), 63 deletions(-)


diff --git a/tests/generic/305 b/tests/generic/305
index d73d87f..9c3489b 100755
--- a/tests/generic/305
+++ b/tests/generic/305
@@ -51,7 +51,7 @@ _require_quota
 _require_nobody
 
 _repquota() {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota -O csv $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk -F ',' '{print $1, $4, $5, $6}'
 }
 rm -f $seqres.full
 
diff --git a/tests/generic/305.out b/tests/generic/305.out
index 0bfd620..fbd4e24 100644
--- a/tests/generic/305.out
+++ b/tests/generic/305.out
@@ -1,22 +1,22 @@
 QA output created by 305
 Format and mount
 Create the original files
-root      --    3072       0       0              7     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --       0       0       0              1     0     0       
+root 3072 0 0
+nobody 0 0 0
+fsgqa 0 0 0
 Change file ownership
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 CoW one of the files
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 Remount the FS to see if accounting changes
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 Chown one of the files
-root      --       0       0       0              4     0     0       
-nobody    --    1024       0       0              2     0     0       
-fsgqa     --    2048       0       0              3     0     0       
+root 0 0 0
+nobody 1024 0 0
+fsgqa 2048 0 0
diff --git a/tests/generic/326 b/tests/generic/326
index 8afc6a2..b86f6a2 100755
--- a/tests/generic/326
+++ b/tests/generic/326
@@ -52,7 +52,7 @@ _require_nobody
 _require_odirect
 
 _repquota() {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota -O csv $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk -F ',' '{print $1, $4, $5, $6}'
 }
 rm -f $seqres.full
 
diff --git a/tests/generic/326.out b/tests/generic/326.out
index e771eb7..de7f20b 100644
--- a/tests/generic/326.out
+++ b/tests/generic/326.out
@@ -1,22 +1,22 @@
 QA output created by 326
 Format and mount
 Create the original files
-root      --    3072       0       0              7     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --       0       0       0              1     0     0       
+root 3072 0 0
+nobody 0 0 0
+fsgqa 0 0 0
 Change file ownership
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 CoW one of the files
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 Remount the FS to see if accounting changes
-root      --       0       0       0              4     0     0       
-nobody    --       0       0       0              1     0     0       
-fsgqa     --    3072       0       0              4     0     0       
+root 0 0 0
+nobody 0 0 0
+fsgqa 3072 0 0
 Chown one of the files
-root      --       0       0       0              4     0     0       
-nobody    --    1024       0       0              2     0     0       
-fsgqa     --    2048       0       0              3     0     0       
+root 0 0 0
+nobody 1024 0 0
+fsgqa 2048 0 0
diff --git a/tests/generic/327 b/tests/generic/327
index c165ad5..29706e9 100755
--- a/tests/generic/327
+++ b/tests/generic/327
@@ -48,9 +48,10 @@ _require_cp_reflink
 _require_fiemap
 _require_quota
 _require_nobody
+_require_user
 
 _repquota() {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota -O csv $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk -F ',' '{print $1, $4, $5, $6}'
 }
 rm -f $seqres.full
 
@@ -67,19 +68,20 @@ mkdir $testdir
 sz=1048576
 echo "Create the original files"
 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
-chown fsgqa $testdir/file1
+chown $qa_user $testdir/file1
 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
 _repquota
 _scratch_cycle_mount
+quotaon $SCRATCH_MNT 2> /dev/null
 
 echo "Set hard quota to prevent third reflink"
-setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
+setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
 _repquota
 
 echo "Try to reflink again"
 touch $testdir/file3
-chown fsgqa $testdir/file3
-_cp_reflink $testdir/file1 $testdir/file3 2>&1 | _filter_scratch
+chown $qa_user $testdir/file3
+su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch
 _repquota
 
 # success, all done
diff --git a/tests/generic/327.out b/tests/generic/327.out
index 7160ff2..f4e145a 100644
--- a/tests/generic/327.out
+++ b/tests/generic/327.out
@@ -1,12 +1,12 @@
 QA output created by 327
 Format and mount
 Create the original files
-root      --       0       0       0              4     0     0       
-fsgqa     --    2048       0       0              2     0     0       
+root 0 0 0
+fsgqa 2048 0 0
 Set hard quota to prevent third reflink
-root      --       0       0       0              4     0     0       
-fsgqa     +-    2048       0    1024              2     0     0       
+root 0 0 0
+fsgqa 2048 0 1024
 Try to reflink again
 cp: failed to clone 'SCRATCH_MNT/test-327/file3' from 'SCRATCH_MNT/test-327/file1': Disk quota exceeded
-root      --       0       0       0              4     0     0       
-fsgqa     +-    2048       0    1024              3     0     0       
+root 0 0 0
+fsgqa 2048 0 1024
diff --git a/tests/generic/328 b/tests/generic/328
index 705368e..7800246 100755
--- a/tests/generic/328
+++ b/tests/generic/328
@@ -49,9 +49,10 @@ _require_fiemap
 _require_quota
 _require_nobody
 _require_odirect
+_require_user
 
 _repquota() {
-	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
+	repquota -O csv $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk -F ',' '{print $1, $4, $5, $6}'
 }
 rm -f $seqres.full
 
@@ -68,28 +69,29 @@ mkdir $testdir
 sz=1048576
 echo "Create the original files"
 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
-chown fsgqa $testdir/file1
+chown $qa_user $testdir/file1
 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
 _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
 _repquota
 _scratch_cycle_mount
+quotaon $SCRATCH_MNT 2> /dev/null
 
 echo "Set hard quota to prevent rewrite"
-setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT
+setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT
 _repquota
 
 echo "Try to dio write the whole file"
-_pwrite_byte 0x62 0 $sz $testdir/file1 -d 2>&1 >> $seqres.full | \
+su $qa_user -c '$XFS_IO_PROG -d -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
 	_filter_xfs_io_error
 _repquota
 
 echo "Try to write the whole file"
-_pwrite_byte 0x62 0 $sz $testdir/file1 2>&1 >> $seqres.full | \
+su $qa_user -c '$XFS_IO_PROG -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \
 	_filter_xfs_io_error
 _repquota
 
 echo "Set hard quota to allow rewrite"
-setquota -u fsgqa 0 8192 0 0 $SCRATCH_MNT
+setquota -u $qa_user 0 8192 0 0 $SCRATCH_MNT
 _repquota
 
 echo "Try to dio write the whole file"
diff --git a/tests/generic/328.out b/tests/generic/328.out
index 4630151..b7fe9f8 100644
--- a/tests/generic/328.out
+++ b/tests/generic/328.out
@@ -1,25 +1,25 @@
 QA output created by 328
 Format and mount
 Create the original files
-root      --       0       0       0              4     0     0       
-fsgqa     --    3072       0       0              3     0     0       
+root 0 0 0
+fsgqa 3072 0 0
 Set hard quota to prevent rewrite
-root      --       0       0       0              4     0     0       
-fsgqa     +-    3072       0    1024              3     0     0       
+root 0 0 0
+fsgqa 3072 0 1024
 Try to dio write the whole file
 pwrite: Disk quota exceeded
-root      --       0       0       0              4     0     0       
-fsgqa     +-    3072       0    1024              3     0     0       
+root 0 0 0
+fsgqa 3072 0 1024
 Try to write the whole file
 pwrite: Disk quota exceeded
-root      --       0       0       0              4     0     0       
-fsgqa     +-    3072       0    1024              3     0     0       
+root 0 0 0
+fsgqa 3072 0 1024
 Set hard quota to allow rewrite
-root      --       0       0       0              4     0     0       
-fsgqa     --    3072       0    8192              3     0     0       
+root 0 0 0
+fsgqa 3072 0 8192
 Try to dio write the whole file
-root      --       0       0       0              4     0     0       
-fsgqa     --    3072       0    8192              3     0     0       
+root 0 0 0
+fsgqa 3072 0 8192
 Try to write the whole file
-root      --       0       0       0              4     0     0       
-fsgqa     --    3072       0    8192              3     0     0       
+root 0 0 0
+fsgqa 3072 0 8192

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

* [PATCH 4/7] reflink: fix space consumption tests
  2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-11 21:53   ` Darrick J. Wong
  -1 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Some of the tests try to check that we can't COW when we're out of
space, but some tricky filesystems make this hard because writing N
blocks doesn't increase used blocks by N....

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/populate   |   14 ++++++++++++++
 tests/generic/171 |    5 ++---
 tests/generic/173 |    5 ++---
 tests/generic/174 |    5 ++---
 tests/generic/282 |    3 +--
 5 files changed, 21 insertions(+), 11 deletions(-)


diff --git a/common/populate b/common/populate
index d0003c5..9811d21 100644
--- a/common/populate
+++ b/common/populate
@@ -30,6 +30,20 @@ _require_xfs_db_blocktrash_z_command() {
 	$XFS_DB_PROG -x -f -c 'blocktrash -z' "${TEST_DEV}" | grep -q 'nothing on stack' || _notrun "blocktrash -z not supported"
 }
 
+# Eat free space until we can't anymore.
+_consume_free_space() {
+	dir=$1
+
+	old_nr_free=0
+	nr_free=$(stat -f -c '%f' $dir)
+	x=0
+	while [ $nr_free -gt 0 ] && [ $old_nr_free != $nr_free ]; do
+		$XFS_IO_PROG -f -c "pwrite -b 4194304 0 $((blksz * nr_free))" $dir/eat_my_space.$((x++))
+		old_nr_free=$nr_free
+		nr_free=$(stat -f -c '%f' $dir)
+	done
+}
+
 # Attempt to make files of "every" format for data, dirs, attrs etc.
 # (with apologies to Eric Sandeen for mutating xfser.sh)
 
diff --git a/tests/generic/171 b/tests/generic/171
index b01dbd5..d96fd17 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -41,6 +41,7 @@ _cleanup()
 . ./common/filter
 . ./common/attr
 . ./common/reflink
+. ./common/populate
 
 # real QA test starts here
 _supported_os Linux
@@ -75,9 +76,7 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+_consume_free_space $testdir >> $seqres.full 2>&1
 sync
 
 echo "CoW the big file"
diff --git a/tests/generic/173 b/tests/generic/173
index e35597f..20c6091 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -41,6 +41,7 @@ _cleanup()
 . ./common/filter
 . ./common/attr
 . ./common/reflink
+. ./common/populate
 
 # real QA test starts here
 _supported_os Linux
@@ -75,9 +76,7 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+_consume_free_space $testdir >> $seqres.full 2>&1
 sync
 
 echo "mmap CoW the big file"
diff --git a/tests/generic/174 b/tests/generic/174
index 38fad1d..d811307 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -41,6 +41,7 @@ _cleanup()
 . ./common/filter
 . ./common/attr
 . ./common/reflink
+. ./common/populate
 
 # real QA test starts here
 _supported_os Linux
@@ -76,9 +77,7 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+_consume_free_space $testdir >> $seqres.full 2>&1
 sync
 
 echo "CoW the big file"
diff --git a/tests/generic/282 b/tests/generic/282
index 6452025..8a30811 100755
--- a/tests/generic/282
+++ b/tests/generic/282
@@ -80,8 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
-cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 _dmerror_load_working_table
 rm -rf $testdir/file2 >> $seqres.full 2>&1
 _dmerror_unmount


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

* [Ocfs2-devel] [PATCH 4/7] reflink: fix space consumption tests
@ 2016-12-11 21:53   ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Some of the tests try to check that we can't COW when we're out of
space, but some tricky filesystems make this hard because writing N
blocks doesn't increase used blocks by N....

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/populate   |   14 ++++++++++++++
 tests/generic/171 |    5 ++---
 tests/generic/173 |    5 ++---
 tests/generic/174 |    5 ++---
 tests/generic/282 |    3 +--
 5 files changed, 21 insertions(+), 11 deletions(-)


diff --git a/common/populate b/common/populate
index d0003c5..9811d21 100644
--- a/common/populate
+++ b/common/populate
@@ -30,6 +30,20 @@ _require_xfs_db_blocktrash_z_command() {
 	$XFS_DB_PROG -x -f -c 'blocktrash -z' "${TEST_DEV}" | grep -q 'nothing on stack' || _notrun "blocktrash -z not supported"
 }
 
+# Eat free space until we can't anymore.
+_consume_free_space() {
+	dir=$1
+
+	old_nr_free=0
+	nr_free=$(stat -f -c '%f' $dir)
+	x=0
+	while [ $nr_free -gt 0 ] && [ $old_nr_free != $nr_free ]; do
+		$XFS_IO_PROG -f -c "pwrite -b 4194304 0 $((blksz * nr_free))" $dir/eat_my_space.$((x++))
+		old_nr_free=$nr_free
+		nr_free=$(stat -f -c '%f' $dir)
+	done
+}
+
 # Attempt to make files of "every" format for data, dirs, attrs etc.
 # (with apologies to Eric Sandeen for mutating xfser.sh)
 
diff --git a/tests/generic/171 b/tests/generic/171
index b01dbd5..d96fd17 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -41,6 +41,7 @@ _cleanup()
 . ./common/filter
 . ./common/attr
 . ./common/reflink
+. ./common/populate
 
 # real QA test starts here
 _supported_os Linux
@@ -75,9 +76,7 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+_consume_free_space $testdir >> $seqres.full 2>&1
 sync
 
 echo "CoW the big file"
diff --git a/tests/generic/173 b/tests/generic/173
index e35597f..20c6091 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -41,6 +41,7 @@ _cleanup()
 . ./common/filter
 . ./common/attr
 . ./common/reflink
+. ./common/populate
 
 # real QA test starts here
 _supported_os Linux
@@ -75,9 +76,7 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+_consume_free_space $testdir >> $seqres.full 2>&1
 sync
 
 echo "mmap CoW the big file"
diff --git a/tests/generic/174 b/tests/generic/174
index 38fad1d..d811307 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -41,6 +41,7 @@ _cleanup()
 . ./common/filter
 . ./common/attr
 . ./common/reflink
+. ./common/populate
 
 # real QA test starts here
 _supported_os Linux
@@ -76,9 +77,7 @@ _cp_reflink $testdir/bigfile $testdir/clonefile
 sync
 
 echo "Allocate the rest of the space"
-nr_free=$(stat -f -c '%f' $testdir)
-touch $testdir/file0 $testdir/file1
-_pwrite_byte 0x61 0 $((blksz * nr_free)) $testdir/eat_my_space >> $seqres.full 2>&1
+_consume_free_space $testdir >> $seqres.full 2>&1
 sync
 
 echo "CoW the big file"
diff --git a/tests/generic/282 b/tests/generic/282
index 6452025..8a30811 100755
--- a/tests/generic/282
+++ b/tests/generic/282
@@ -80,8 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
-cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 _dmerror_load_working_table
 rm -rf $testdir/file2 >> $seqres.full 2>&1
 _dmerror_unmount

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

* [PATCH 5/7] reflink: make error reporting consistent
  2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-11 21:53   ` Darrick J. Wong
  -1 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

When we're using dm-error to simulate failed devices, we don't really
know if the write or the fdatasync is going to receive the EIO.  So,
capture the entire output and just look for the word error instead
of enshrining it in the golden output.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/265     |    6 +++++-
 tests/generic/265.out |    1 -
 tests/generic/266     |    5 ++++-
 tests/generic/266.out |    1 -
 tests/generic/267     |    2 +-
 tests/generic/268     |    5 ++++-
 tests/generic/268.out |    1 -
 tests/generic/271     |    5 +++--
 tests/generic/271.out |    1 -
 tests/generic/272     |    5 +++--
 tests/generic/272.out |    1 -
 tests/generic/276     |    2 +-
 tests/generic/276.out |    1 -
 tests/generic/278     |    5 +++--
 tests/generic/278.out |    1 -
 tests/generic/279     |    4 ++--
 tests/generic/279.out |    1 -
 tests/generic/281     |    4 ++--
 tests/generic/281.out |    1 -
 tests/generic/283     |    6 ++++--
 tests/generic/283.out |    1 -
 21 files changed, 32 insertions(+), 27 deletions(-)


diff --git a/tests/generic/265 b/tests/generic/265
index 8e9d5bc..ceddfbe 100755
--- a/tests/generic/265
+++ b/tests/generic/265
@@ -80,7 +80,11 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
+	-c "fdatasync" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
+
 _dmerror_load_working_table
 _dmerror_unmount
 _dmerror_mount
diff --git a/tests/generic/265.out b/tests/generic/265.out
index 1b67114..31eb4e9 100644
--- a/tests/generic/265.out
+++ b/tests/generic/265.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file2
 CoW and unmount
-fdatasync: Input/output error
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
 Check for damage
diff --git a/tests/generic/266 b/tests/generic/266
index 4f9816a..09541c8 100755
--- a/tests/generic/266
+++ b/tests/generic/266
@@ -80,7 +80,10 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
+	-c "fdatasync" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
 
 echo "Clean up the mess"
 _dmerror_unmount
diff --git a/tests/generic/266.out b/tests/generic/266.out
index dd34ad3..1641654 100644
--- a/tests/generic/266.out
+++ b/tests/generic/266.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file2
 CoW and unmount
-fdatasync: Input/output error
 Clean up the mess
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
diff --git a/tests/generic/267 b/tests/generic/267
index e3a6b0c..2ec6ad9 100755
--- a/tests/generic/267
+++ b/tests/generic/267
@@ -80,7 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 _dmerror_load_working_table
 rm -rf $testdir/file2 >> $seqres.full 2>&1
 _dmerror_unmount
diff --git a/tests/generic/268 b/tests/generic/268
index c7dcd57..b7d16ab 100755
--- a/tests/generic/268
+++ b/tests/generic/268
@@ -81,7 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
+	-c "fdatasync" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
 _dmerror_load_working_table
 
 echo "Rewrite"
diff --git a/tests/generic/268.out b/tests/generic/268.out
index 234e8be..1a3b39a 100644
--- a/tests/generic/268.out
+++ b/tests/generic/268.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file2
 CoW and unmount
-fdatasync: Input/output error
 Rewrite
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
diff --git a/tests/generic/271 b/tests/generic/271
index ded8854..9439327 100755
--- a/tests/generic/271
+++ b/tests/generic/271
@@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
-	2>&1 >> $seqres.full | _filter_xfs_io_error
+urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
 _dmerror_load_working_table
 _dmerror_unmount
 _dmerror_mount
diff --git a/tests/generic/271.out b/tests/generic/271.out
index 54d5b0d..9b44ee7 100644
--- a/tests/generic/271.out
+++ b/tests/generic/271.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file2
 CoW and unmount
-pwrite: Input/output error
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
 Check for damage
diff --git a/tests/generic/272 b/tests/generic/272
index 5bc5b39..243adf5 100755
--- a/tests/generic/272
+++ b/tests/generic/272
@@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
-	2>&1 >> $seqres.full | _filter_xfs_io_error
+urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
 
 echo "Clean up the mess"
 _dmerror_unmount
diff --git a/tests/generic/272.out b/tests/generic/272.out
index 0b8bdca..10ecda9 100644
--- a/tests/generic/272.out
+++ b/tests/generic/272.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file2
 CoW and unmount
-pwrite: Input/output error
 Clean up the mess
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
diff --git a/tests/generic/276 b/tests/generic/276
index 83b902e..34b0029 100755
--- a/tests/generic/276
+++ b/tests/generic/276
@@ -82,7 +82,7 @@ echo "CoW and unmount"
 sync
 _dmerror_load_error_table
 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
-	2>&1 >> $seqres.full | _filter_xfs_io_error
+	>> $seqres.full 2>&1
 _dmerror_load_working_table
 rm -rf $testdir/file2 >> $seqres.full 2>&1
 _dmerror_unmount
diff --git a/tests/generic/276.out b/tests/generic/276.out
index 88a0162..a080dd0 100644
--- a/tests/generic/276.out
+++ b/tests/generic/276.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file2
 CoW and unmount
-pwrite: Input/output error
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
 Check for damage
diff --git a/tests/generic/278 b/tests/generic/278
index 415742a..d751f01 100755
--- a/tests/generic/278
+++ b/tests/generic/278
@@ -82,8 +82,9 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
-	2>&1 >> $seqres.full | _filter_xfs_io_error
+urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
 _dmerror_load_working_table
 
 echo "Rewrite"
diff --git a/tests/generic/278.out b/tests/generic/278.out
index 9ead4ac..cd22fcd 100644
--- a/tests/generic/278.out
+++ b/tests/generic/278.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file2
 CoW and unmount
-pwrite: Input/output error
 Rewrite
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
diff --git a/tests/generic/279 b/tests/generic/279
index 2f1ec4f..4541de3 100755
--- a/tests/generic/279
+++ b/tests/generic/279
@@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
-cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
+	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 _dmerror_load_working_table
 _dmerror_unmount
 _dmerror_mount
diff --git a/tests/generic/279.out b/tests/generic/279.out
index f34c2b2..009f05e 100644
--- a/tests/generic/279.out
+++ b/tests/generic/279.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file2
 CoW and unmount
-msync: Input/output error
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
 Check for damage
diff --git a/tests/generic/281 b/tests/generic/281
index c95acf2..e8e1661 100755
--- a/tests/generic/281
+++ b/tests/generic/281
@@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
-cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
+	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 
 echo "Clean up the mess"
 _dmerror_unmount
diff --git a/tests/generic/281.out b/tests/generic/281.out
index a2d8e3f..1bae187 100644
--- a/tests/generic/281.out
+++ b/tests/generic/281.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file2
 CoW and unmount
-msync: Input/output error
 Clean up the mess
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
diff --git a/tests/generic/283 b/tests/generic/283
index 8d56ac3..7bfdb4d 100755
--- a/tests/generic/283
+++ b/tests/generic/283
@@ -81,8 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
-cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
+	-c "msync -s 0 $filesize" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "mwrite did not fail"
 _dmerror_load_working_table
 
 echo "Rewrite"
diff --git a/tests/generic/283.out b/tests/generic/283.out
index f9fd5c8..b475054 100644
--- a/tests/generic/283.out
+++ b/tests/generic/283.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file2
 CoW and unmount
-msync: Input/output error
 Rewrite
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1


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

* [Ocfs2-devel] [PATCH 5/7] reflink: make error reporting consistent
@ 2016-12-11 21:53   ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

When we're using dm-error to simulate failed devices, we don't really
know if the write or the fdatasync is going to receive the EIO.  So,
capture the entire output and just look for the word error instead
of enshrining it in the golden output.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/265     |    6 +++++-
 tests/generic/265.out |    1 -
 tests/generic/266     |    5 ++++-
 tests/generic/266.out |    1 -
 tests/generic/267     |    2 +-
 tests/generic/268     |    5 ++++-
 tests/generic/268.out |    1 -
 tests/generic/271     |    5 +++--
 tests/generic/271.out |    1 -
 tests/generic/272     |    5 +++--
 tests/generic/272.out |    1 -
 tests/generic/276     |    2 +-
 tests/generic/276.out |    1 -
 tests/generic/278     |    5 +++--
 tests/generic/278.out |    1 -
 tests/generic/279     |    4 ++--
 tests/generic/279.out |    1 -
 tests/generic/281     |    4 ++--
 tests/generic/281.out |    1 -
 tests/generic/283     |    6 ++++--
 tests/generic/283.out |    1 -
 21 files changed, 32 insertions(+), 27 deletions(-)


diff --git a/tests/generic/265 b/tests/generic/265
index 8e9d5bc..ceddfbe 100755
--- a/tests/generic/265
+++ b/tests/generic/265
@@ -80,7 +80,11 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
+	-c "fdatasync" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
+
 _dmerror_load_working_table
 _dmerror_unmount
 _dmerror_mount
diff --git a/tests/generic/265.out b/tests/generic/265.out
index 1b67114..31eb4e9 100644
--- a/tests/generic/265.out
+++ b/tests/generic/265.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file2
 CoW and unmount
-fdatasync: Input/output error
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
 Check for damage
diff --git a/tests/generic/266 b/tests/generic/266
index 4f9816a..09541c8 100755
--- a/tests/generic/266
+++ b/tests/generic/266
@@ -80,7 +80,10 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
+	-c "fdatasync" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
 
 echo "Clean up the mess"
 _dmerror_unmount
diff --git a/tests/generic/266.out b/tests/generic/266.out
index dd34ad3..1641654 100644
--- a/tests/generic/266.out
+++ b/tests/generic/266.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file2
 CoW and unmount
-fdatasync: Input/output error
 Clean up the mess
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
diff --git a/tests/generic/267 b/tests/generic/267
index e3a6b0c..2ec6ad9 100755
--- a/tests/generic/267
+++ b/tests/generic/267
@@ -80,7 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 _dmerror_load_working_table
 rm -rf $testdir/file2 >> $seqres.full 2>&1
 _dmerror_unmount
diff --git a/tests/generic/268 b/tests/generic/268
index c7dcd57..b7d16ab 100755
--- a/tests/generic/268
+++ b/tests/generic/268
@@ -81,7 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
+urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
+	-c "fdatasync" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
 _dmerror_load_working_table
 
 echo "Rewrite"
diff --git a/tests/generic/268.out b/tests/generic/268.out
index 234e8be..1a3b39a 100644
--- a/tests/generic/268.out
+++ b/tests/generic/268.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file2
 CoW and unmount
-fdatasync: Input/output error
 Rewrite
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
diff --git a/tests/generic/271 b/tests/generic/271
index ded8854..9439327 100755
--- a/tests/generic/271
+++ b/tests/generic/271
@@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
-	2>&1 >> $seqres.full | _filter_xfs_io_error
+urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
 _dmerror_load_working_table
 _dmerror_unmount
 _dmerror_mount
diff --git a/tests/generic/271.out b/tests/generic/271.out
index 54d5b0d..9b44ee7 100644
--- a/tests/generic/271.out
+++ b/tests/generic/271.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file2
 CoW and unmount
-pwrite: Input/output error
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
 Check for damage
diff --git a/tests/generic/272 b/tests/generic/272
index 5bc5b39..243adf5 100755
--- a/tests/generic/272
+++ b/tests/generic/272
@@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
-	2>&1 >> $seqres.full | _filter_xfs_io_error
+urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
 
 echo "Clean up the mess"
 _dmerror_unmount
diff --git a/tests/generic/272.out b/tests/generic/272.out
index 0b8bdca..10ecda9 100644
--- a/tests/generic/272.out
+++ b/tests/generic/272.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file2
 CoW and unmount
-pwrite: Input/output error
 Clean up the mess
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
diff --git a/tests/generic/276 b/tests/generic/276
index 83b902e..34b0029 100755
--- a/tests/generic/276
+++ b/tests/generic/276
@@ -82,7 +82,7 @@ echo "CoW and unmount"
 sync
 _dmerror_load_error_table
 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
-	2>&1 >> $seqres.full | _filter_xfs_io_error
+	>> $seqres.full 2>&1
 _dmerror_load_working_table
 rm -rf $testdir/file2 >> $seqres.full 2>&1
 _dmerror_unmount
diff --git a/tests/generic/276.out b/tests/generic/276.out
index 88a0162..a080dd0 100644
--- a/tests/generic/276.out
+++ b/tests/generic/276.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file2
 CoW and unmount
-pwrite: Input/output error
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
 Check for damage
diff --git a/tests/generic/278 b/tests/generic/278
index 415742a..d751f01 100755
--- a/tests/generic/278
+++ b/tests/generic/278
@@ -82,8 +82,9 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
-	2>&1 >> $seqres.full | _filter_xfs_io_error
+urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
 _dmerror_load_working_table
 
 echo "Rewrite"
diff --git a/tests/generic/278.out b/tests/generic/278.out
index 9ead4ac..cd22fcd 100644
--- a/tests/generic/278.out
+++ b/tests/generic/278.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file2
 CoW and unmount
-pwrite: Input/output error
 Rewrite
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
diff --git a/tests/generic/279 b/tests/generic/279
index 2f1ec4f..4541de3 100755
--- a/tests/generic/279
+++ b/tests/generic/279
@@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
-cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
+	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 _dmerror_load_working_table
 _dmerror_unmount
 _dmerror_mount
diff --git a/tests/generic/279.out b/tests/generic/279.out
index f34c2b2..009f05e 100644
--- a/tests/generic/279.out
+++ b/tests/generic/279.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file2
 CoW and unmount
-msync: Input/output error
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
 Check for damage
diff --git a/tests/generic/281 b/tests/generic/281
index c95acf2..e8e1661 100755
--- a/tests/generic/281
+++ b/tests/generic/281
@@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
-cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
+	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 
 echo "Clean up the mess"
 _dmerror_unmount
diff --git a/tests/generic/281.out b/tests/generic/281.out
index a2d8e3f..1bae187 100644
--- a/tests/generic/281.out
+++ b/tests/generic/281.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file2
 CoW and unmount
-msync: Input/output error
 Clean up the mess
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
diff --git a/tests/generic/283 b/tests/generic/283
index 8d56ac3..7bfdb4d 100755
--- a/tests/generic/283
+++ b/tests/generic/283
@@ -81,8 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
-cat $TEST_DIR/mwrite.out | tee -a $seqres.full
+urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
+	-c "msync -s 0 $filesize" $testdir/file2 2>&1)
+echo $urk >> $seqres.full
+echo "$urk" | grep -q "error" || _fail "mwrite did not fail"
 _dmerror_load_working_table
 
 echo "Rewrite"
diff --git a/tests/generic/283.out b/tests/generic/283.out
index f9fd5c8..b475054 100644
--- a/tests/generic/283.out
+++ b/tests/generic/283.out
@@ -5,7 +5,6 @@ Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file2
 CoW and unmount
-msync: Input/output error
 Rewrite
 Compare files
 1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1

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

* [PATCH 6/7] reflink: don't test disjoint block sharing sets
  2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-11 21:53   ` Darrick J. Wong
  -1 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Unlike xfs/btrfs which store refcounting information as part of the
space metadata, ocfs2 implements block sharing (reflink) by creating
refcount btrees that are shared between subsets of files.  Effectively,
this means that a ocfs2 can have multiple disjoint sets of files that
share blocks, which also means that blocks cannot be reflinked between
two disjoint refcounted-file-sets.  generic/119 tests the ability to do
this, so we cannot run it for ocfs2.  Create a _require helper to check
for this.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink    |    9 +++++++++
 tests/generic/119 |    1 +
 2 files changed, 10 insertions(+)


diff --git a/common/reflink b/common/reflink
index d048045..55d82ac 100644
--- a/common/reflink
+++ b/common/reflink
@@ -28,6 +28,15 @@ _require_cp_reflink()
                _notrun "This test requires a cp with --reflink support."
 }
 
+# Can we reflink between arbitrary file sets?
+# i.e. if we reflink a->b and c->d, can we later share
+# blocks between b & c?
+_require_arbitrary_fileset_reflink()
+{
+	test "$FSTYP" = "ocfs2" && \
+		_notrun "reflink between arbitrary file groups not supported in $FSTYP"
+}
+
 # Given 2 files, verify that they have the same mapping but different
 # inodes - i.e. an undisturbed reflink
 # Silent if so, make noise if not
diff --git a/tests/generic/119 b/tests/generic/119
index e6a6f59..b28e044 100755
--- a/tests/generic/119
+++ b/tests/generic/119
@@ -47,6 +47,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_test_reflink
+_require_arbitrary_fileset_reflink
 
 rm -f $seqres.full
 


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

* [Ocfs2-devel] [PATCH 6/7] reflink: don't test disjoint block sharing sets
@ 2016-12-11 21:53   ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Unlike xfs/btrfs which store refcounting information as part of the
space metadata, ocfs2 implements block sharing (reflink) by creating
refcount btrees that are shared between subsets of files.  Effectively,
this means that a ocfs2 can have multiple disjoint sets of files that
share blocks, which also means that blocks cannot be reflinked between
two disjoint refcounted-file-sets.  generic/119 tests the ability to do
this, so we cannot run it for ocfs2.  Create a _require helper to check
for this.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink    |    9 +++++++++
 tests/generic/119 |    1 +
 2 files changed, 10 insertions(+)


diff --git a/common/reflink b/common/reflink
index d048045..55d82ac 100644
--- a/common/reflink
+++ b/common/reflink
@@ -28,6 +28,15 @@ _require_cp_reflink()
                _notrun "This test requires a cp with --reflink support."
 }
 
+# Can we reflink between arbitrary file sets?
+# i.e. if we reflink a->b and c->d, can we later share
+# blocks between b & c?
+_require_arbitrary_fileset_reflink()
+{
+	test "$FSTYP" = "ocfs2" && \
+		_notrun "reflink between arbitrary file groups not supported in $FSTYP"
+}
+
 # Given 2 files, verify that they have the same mapping but different
 # inodes - i.e. an undisturbed reflink
 # Silent if so, make noise if not
diff --git a/tests/generic/119 b/tests/generic/119
index e6a6f59..b28e044 100755
--- a/tests/generic/119
+++ b/tests/generic/119
@@ -47,6 +47,7 @@ _cleanup()
 # real QA test starts here
 _supported_os Linux
 _require_test_reflink
+_require_arbitrary_fileset_reflink
 
 rm -f $seqres.full
 

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

* [PATCH 7/7] xfs/ext4: check negative inode size
  2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-11 21:53   ` Darrick J. Wong
  -1 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Craft a malicious filesystem image with a negative inode size,
then try to trigger a kernel DoS by appending data to the file.
Ideally this should trigger verifier errors instead of hanging.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/ext4/400   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/401   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/group |    2 ++
 tests/xfs/400    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/401    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/group  |    2 ++
 6 files changed, 290 insertions(+)
 create mode 100755 tests/ext4/400
 create mode 100755 tests/ext4/401
 create mode 100755 tests/xfs/400
 create mode 100755 tests/xfs/401


diff --git a/tests/ext4/400 b/tests/ext4/400
new file mode 100755
index 0000000..5857549
--- /dev/null
+++ b/tests/ext4/400
@@ -0,0 +1,71 @@
+#! /bin/bash
+# FSQA Test No. 400
+#
+# Since loff_t is a signed type, it is invalid for a filesystem to load
+# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
+# which means that we can trivially DoS the VFS by creating such a file
+# and appending to it.  This causes an integer overflow in the routines
+# underlying writeback, which results in the kernel locking up.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016-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"
+
+PIDS=""
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ext2 ext3 ext4
+_require_scratch_nocheck
+_disable_dmesg_check
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT
+echo m > $testdir/a
+
+echo "Corrupt filesystem"
+_scratch_unmount
+debugfs -w -R "sif /a size -1" $SCRATCH_DEV >> $seqres.full 2>&1
+
+echo "Remount, try to append"
+_scratch_mount
+dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
+sync
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/401 b/tests/ext4/401
new file mode 100755
index 0000000..ee7ecf3
--- /dev/null
+++ b/tests/ext4/401
@@ -0,0 +1,71 @@
+#! /bin/bash
+# FSQA Test No. 401
+#
+# Since loff_t is a signed type, it is invalid for a filesystem to load
+# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
+# which means that we can trivially DoS the VFS by creating such a file
+# and appending to it.  This causes an integer overflow in the routines
+# underlying writeback, which results in the kernel locking up.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016-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"
+
+PIDS=""
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ext2 ext3 ext4
+_require_scratch_nocheck
+_disable_dmesg_check
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT
+echo m > $testdir/a
+
+echo "Corrupt filesystem"
+_scratch_unmount
+debugfs -w -R "sif /a size 0xFFFFFFFFFFFFFE00" $SCRATCH_DEV >> $seqres.full 2>&1
+
+echo "Remount, try to append"
+_scratch_mount
+dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
+sync
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/group b/tests/ext4/group
index 53fe03e..43b2d06 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -34,3 +34,5 @@
 306 auto rw resize quick
 307 auto ioctl rw
 308 auto ioctl rw prealloc quick
+400 dangerous_fuzzers
+401 dangerous_fuzzers
diff --git a/tests/xfs/400 b/tests/xfs/400
new file mode 100755
index 0000000..498c024
--- /dev/null
+++ b/tests/xfs/400
@@ -0,0 +1,72 @@
+#! /bin/bash
+# FSQA Test No. 400
+#
+# Since loff_t is a signed type, it is invalid for a filesystem to load
+# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
+# which means that we can trivially DoS the VFS by creating such a file
+# and appending to it.  This causes an integer overflow in the routines
+# underlying writeback, which results in the kernel locking up.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016-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"
+
+PIDS=""
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_nocheck
+_disable_dmesg_check
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT
+echo m > $testdir/a
+inum=$(stat -c "%i" $testdir/a)
+
+echo "Corrupt filesystem"
+_scratch_unmount
+_scratch_xfs_db -x -c "inode ${inum}" -c 'write core.size -- -1' >> $seqres.full
+
+echo "Remount, try to append"
+_scratch_mount
+dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
+sync
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/401 b/tests/xfs/401
new file mode 100755
index 0000000..41b262d
--- /dev/null
+++ b/tests/xfs/401
@@ -0,0 +1,72 @@
+#! /bin/bash
+# FSQA Test No. 401
+#
+# Since loff_t is a signed type, it is invalid for a filesystem to load
+# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
+# which means that we can trivially DoS the VFS by creating such a file
+# and appending to it.  This causes an integer overflow in the routines
+# underlying writeback, which results in the kernel locking up.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016-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"
+
+PIDS=""
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_nocheck
+_disable_dmesg_check
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT
+echo m > $testdir/a
+inum=$(stat -c "%i" $testdir/a)
+
+echo "Corrupt filesystem"
+_scratch_unmount
+_scratch_xfs_db -x -c "inode ${inum}" -c 'write core.size -- -1' >> $seqres.full
+
+echo "Remount, try to append"
+_scratch_mount
+dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
+sync
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/group b/tests/xfs/group
index c237b50..10ba27b 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -334,3 +334,5 @@
 345 auto quick clone
 346 auto quick clone
 347 auto quick clone
+400 dangerous_fuzzers
+401 dangerous_fuzzers


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

* [Ocfs2-devel] [PATCH 7/7] xfs/ext4: check negative inode size
@ 2016-12-11 21:53   ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-11 21:53 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: ocfs2-devel, fstests

Craft a malicious filesystem image with a negative inode size,
then try to trigger a kernel DoS by appending data to the file.
Ideally this should trigger verifier errors instead of hanging.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/ext4/400   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/401   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/group |    2 ++
 tests/xfs/400    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/401    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/group  |    2 ++
 6 files changed, 290 insertions(+)
 create mode 100755 tests/ext4/400
 create mode 100755 tests/ext4/401
 create mode 100755 tests/xfs/400
 create mode 100755 tests/xfs/401


diff --git a/tests/ext4/400 b/tests/ext4/400
new file mode 100755
index 0000000..5857549
--- /dev/null
+++ b/tests/ext4/400
@@ -0,0 +1,71 @@
+#! /bin/bash
+# FSQA Test No. 400
+#
+# Since loff_t is a signed type, it is invalid for a filesystem to load
+# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
+# which means that we can trivially DoS the VFS by creating such a file
+# and appending to it.  This causes an integer overflow in the routines
+# underlying writeback, which results in the kernel locking up.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016-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"
+
+PIDS=""
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ext2 ext3 ext4
+_require_scratch_nocheck
+_disable_dmesg_check
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT
+echo m > $testdir/a
+
+echo "Corrupt filesystem"
+_scratch_unmount
+debugfs -w -R "sif /a size -1" $SCRATCH_DEV >> $seqres.full 2>&1
+
+echo "Remount, try to append"
+_scratch_mount
+dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
+sync
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/401 b/tests/ext4/401
new file mode 100755
index 0000000..ee7ecf3
--- /dev/null
+++ b/tests/ext4/401
@@ -0,0 +1,71 @@
+#! /bin/bash
+# FSQA Test No. 401
+#
+# Since loff_t is a signed type, it is invalid for a filesystem to load
+# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
+# which means that we can trivially DoS the VFS by creating such a file
+# and appending to it.  This causes an integer overflow in the routines
+# underlying writeback, which results in the kernel locking up.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016-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"
+
+PIDS=""
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs ext2 ext3 ext4
+_require_scratch_nocheck
+_disable_dmesg_check
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT
+echo m > $testdir/a
+
+echo "Corrupt filesystem"
+_scratch_unmount
+debugfs -w -R "sif /a size 0xFFFFFFFFFFFFFE00" $SCRATCH_DEV >> $seqres.full 2>&1
+
+echo "Remount, try to append"
+_scratch_mount
+dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
+sync
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/group b/tests/ext4/group
index 53fe03e..43b2d06 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -34,3 +34,5 @@
 306 auto rw resize quick
 307 auto ioctl rw
 308 auto ioctl rw prealloc quick
+400 dangerous_fuzzers
+401 dangerous_fuzzers
diff --git a/tests/xfs/400 b/tests/xfs/400
new file mode 100755
index 0000000..498c024
--- /dev/null
+++ b/tests/xfs/400
@@ -0,0 +1,72 @@
+#! /bin/bash
+# FSQA Test No. 400
+#
+# Since loff_t is a signed type, it is invalid for a filesystem to load
+# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
+# which means that we can trivially DoS the VFS by creating such a file
+# and appending to it.  This causes an integer overflow in the routines
+# underlying writeback, which results in the kernel locking up.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016-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"
+
+PIDS=""
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_nocheck
+_disable_dmesg_check
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT
+echo m > $testdir/a
+inum=$(stat -c "%i" $testdir/a)
+
+echo "Corrupt filesystem"
+_scratch_unmount
+_scratch_xfs_db -x -c "inode ${inum}" -c 'write core.size -- -1' >> $seqres.full
+
+echo "Remount, try to append"
+_scratch_mount
+dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
+sync
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/401 b/tests/xfs/401
new file mode 100755
index 0000000..41b262d
--- /dev/null
+++ b/tests/xfs/401
@@ -0,0 +1,72 @@
+#! /bin/bash
+# FSQA Test No. 401
+#
+# Since loff_t is a signed type, it is invalid for a filesystem to load
+# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
+# which means that we can trivially DoS the VFS by creating such a file
+# and appending to it.  This causes an integer overflow in the routines
+# underlying writeback, which results in the kernel locking up.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016-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"
+
+PIDS=""
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+_require_scratch_nocheck
+_disable_dmesg_check
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+
+testdir=$SCRATCH_MNT
+echo m > $testdir/a
+inum=$(stat -c "%i" $testdir/a)
+
+echo "Corrupt filesystem"
+_scratch_unmount
+_scratch_xfs_db -x -c "inode ${inum}" -c 'write core.size -- -1' >> $seqres.full
+
+echo "Remount, try to append"
+_scratch_mount
+dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
+sync
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/group b/tests/xfs/group
index c237b50..10ba27b 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -334,3 +334,5 @@
 345 auto quick clone
 346 auto quick clone
 347 auto quick clone
+400 dangerous_fuzzers
+401 dangerous_fuzzers

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

* Re: [PATCH 1/7] ocfs2: test reflinking to inline data files
  2016-12-11 21:52   ` [Ocfs2-devel] " Darrick J. Wong
  (?)
@ 2016-12-12  9:01   ` Eryu Guan
  2016-12-12 18:09       ` [Ocfs2-devel] " Darrick J. Wong
  -1 siblings, 1 reply; 43+ messages in thread
From: Eryu Guan @ 2016-12-12  9:01 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: ocfs2-devel, fstests

On Sun, Dec 11, 2016 at 01:52:51PM -0800, Darrick J. Wong wrote:
> Make sure that we can handle reflinking from and to inline-data files.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/reflink       |    2 +
>  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/ocfs2/001.out  |   14 ++++++++
>  tests/ocfs2/Makefile |   20 +++++++++++
>  tests/ocfs2/group    |    1 +
>  5 files changed, 124 insertions(+), 1 deletion(-)
>  create mode 100755 tests/ocfs2/001
>  create mode 100644 tests/ocfs2/001.out
>  create mode 100644 tests/ocfs2/Makefile
>  create mode 100644 tests/ocfs2/group
> 
> 
> diff --git a/common/reflink b/common/reflink
> index 9d51729..d048045 100644
> --- a/common/reflink
> +++ b/common/reflink
> @@ -197,7 +197,7 @@ _cp_reflink() {
>  	file1="$1"
>  	file2="$2"
>  
> -	cp --reflink=always -p "$file1" "$file2"
> +	cp --reflink=always -p -f "$file1" "$file2"

I'm still seeing "File exists" error with this patch, tested with your
ocfs2-vfs-reflink-6 branch, compiled on openSUSE Tumbleweed.

FSTYP         -- ocfs2
PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc8.djwong-ocfs2+
MKFS_OPTIONS  -- --fs-features=local /dev/sda5
MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch

ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
    --- tests/ocfs2/001.out     2016-12-12 13:51:38.053909486 +0800
    +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-12-12 16:49:35.038882697 +0800
    @@ -1,14 +1,18 @@
     QA output created by 001
    +mkfs.ocfs2 1.8.4
     Format and mount
     Create the original files
     reflink into the start of file2
    +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
     reflink past the stuff in file3
    ...
    (Run 'diff -u tests/ocfs2/001.out /root/xfstests/results//ocfs2/ocfs2/001.out.bad'  to see the entire diff)

--- tests/ocfs2/001.out 2016-12-12 13:51:38.053909486 +0800
+++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad     2016-12-12 16:44:31.991943842 +0800
@@ -1,14 +1,18 @@
 QA output created by 001
+mkfs.ocfs2 1.8.4
 Format and mount
 Create the original files
 reflink into the start of file2
+cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
 reflink past the stuff in file3
 reflink an inline-data file to a regular one
+cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
 reflink an inline-data file to another inline-data file
+cp: failed to reflink '/mnt/testarea/scratch/test-001/file6' from '/mnt/testarea/scratch/test-001/file4': File exists
 Verify the whole mess
 2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
-2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
+401b30e3b8b5d629635a5c613cdb7919  SCRATCH_MNT/test-001/file2
 4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
 009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
-009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
-009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file5
+60b725f10c9c85c70d97880dfe8191b3  SCRATCH_MNT/test-001/file6

I did the "reflink into the start of file2" test manually, and strace
showed that it is file1 reports EEXIST.

open("/mnt/ocfs2/testfile1", O_RDONLY)  = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=65536, ...}) = 0
ioctl(3, _IOC(_IOC_WRITE, 0x6f, 0x04, 0x18), 0x7ffc8daf09f0) = -1 EEXIST (File exists)

The same test on XFS works fine. Did I miss anything?

Thanks,
Eryu

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

* Re: [PATCH 2/7] ocfs2/reflink: fix file block size reporting
  2016-12-11 21:52   ` [Ocfs2-devel] " Darrick J. Wong
  (?)
@ 2016-12-12  9:48   ` Eryu Guan
  2016-12-12 23:08       ` [Ocfs2-devel] " Darrick J. Wong
  -1 siblings, 1 reply; 43+ messages in thread
From: Eryu Guan @ 2016-12-12  9:48 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: ocfs2-devel, fstests

On Sun, Dec 11, 2016 at 01:52:57PM -0800, Darrick J. Wong wrote:
> Some of the reflink tests try to require a specific filesystem block
> size so that they can test file block manipulation functions.  That's
> straightforward for most filesystems but ocfs2 throws in the additional
> twist that data fork block mappings are stored in units of clusters, not
> blocks, which causes these reflink tests to fail.
> 
> Therefore, introduce a new helper that retrieves the file minimum block
> size and adapt the reflink tests to use that instead.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/rc         |   21 +++++++++++++++++++--
>  tests/generic/205 |    2 +-
>  tests/generic/206 |    2 +-
>  tests/generic/216 |    2 +-
>  tests/generic/217 |    2 +-
>  tests/generic/218 |    2 +-
>  tests/generic/220 |    2 +-
>  tests/generic/222 |    2 +-
>  tests/generic/227 |    2 +-
>  tests/generic/229 |    2 +-
>  tests/generic/238 |    2 +-
>  11 files changed, 29 insertions(+), 12 deletions(-)
> 
> 
> diff --git a/common/rc b/common/rc
> index 2639fbd..30111d4 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -925,7 +925,7 @@ _scratch_mkfs_blocksized()
>  	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
>  	;;
>      ocfs2)
> -	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
> +	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
>  	;;
>      *)
>  	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
> @@ -3029,13 +3029,30 @@ _sysfs_dev()
>  	echo /sys/dev/block/$_maj:$_min
>  }
>  
> +# Get the minimum block size of a file.  Usually this is the
> +# minimum fs block size, but some filesystems (ocfs2) do block
> +# mappings in larger units.
> +get_file_block_size()

Name it with leading underscore? As it's a common helper.

> +{
> +	if [ -z $1 ] || [ ! -d $1 ]; then
> +		echo "Missing mount point argument for get_file_block_size"
> +		exit 1
> +	fi
> +	if [ "$FSTYP" = "ocfs2" ]; then
> +		stat -c '%o' $1
> +	else
> +		stat -f -c '%S' $1

We can use "get_block_size $1" here.

> +	fi
> +}
> +
> +# Get the minimum block size of an fs.
>  get_block_size()

We should rename it with a underscore too, but probably in an different
patch.

Thanks,
Eryu

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

* Re: [PATCH 3/7] reflink: fix quota tests to work properly
  2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
  (?)
@ 2016-12-12 10:06   ` Eryu Guan
  2016-12-12 23:08       ` [Ocfs2-devel] " Darrick J. Wong
  -1 siblings, 1 reply; 43+ messages in thread
From: Eryu Guan @ 2016-12-12 10:06 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: ocfs2-devel, fstests

On Sun, Dec 11, 2016 at 01:53:04PM -0800, Darrick J. Wong wrote:
> Fix the reflink quota tests to su to the fsgqa user so that we actually
> test enforcement of quotas.  Seems that XFS enforces user quotas even
> if root is writing to a user file, whereas everything else lets root
> writes through.  Also clean up some of the variable usage and
> _require_user.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/generic/305     |    2 +-
>  tests/generic/305.out |   30 +++++++++++++++---------------
>  tests/generic/326     |    2 +-
>  tests/generic/326.out |   30 +++++++++++++++---------------
>  tests/generic/327     |   12 +++++++-----
>  tests/generic/327.out |   12 ++++++------
>  tests/generic/328     |   14 ++++++++------
>  tests/generic/328.out |   28 ++++++++++++++--------------
>  8 files changed, 67 insertions(+), 63 deletions(-)
> 
> 
> diff --git a/tests/generic/305 b/tests/generic/305
> index d73d87f..9c3489b 100755
> --- a/tests/generic/305
> +++ b/tests/generic/305
> @@ -51,7 +51,7 @@ _require_quota
>  _require_nobody
>  
>  _repquota() {
> -	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
> +	repquota -O csv $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk -F ',' '{print $1, $4, $5, $6}'

The version of "quota" is a bit old shipped by RHEL7, there's no "-O"
option support. And this works for me

	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk '{print $1, $3, $4, $5}'

Still worth chaning the .out files this way?

Thanks,
Eryu

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

* Re: [PATCH 4/7] reflink: fix space consumption tests
  2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
  (?)
@ 2016-12-12 10:25   ` Eryu Guan
  2016-12-12 23:03       ` [Ocfs2-devel] " Darrick J. Wong
  -1 siblings, 1 reply; 43+ messages in thread
From: Eryu Guan @ 2016-12-12 10:25 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: ocfs2-devel, fstests

On Sun, Dec 11, 2016 at 01:53:10PM -0800, Darrick J. Wong wrote:
> Some of the tests try to check that we can't COW when we're out of
> space, but some tricky filesystems make this hard because writing N
> blocks doesn't increase used blocks by N....
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/populate   |   14 ++++++++++++++
>  tests/generic/171 |    5 ++---
>  tests/generic/173 |    5 ++---
>  tests/generic/174 |    5 ++---
>  tests/generic/282 |    3 +--
>  5 files changed, 21 insertions(+), 11 deletions(-)
> 
> 
> diff --git a/common/populate b/common/populate
> index d0003c5..9811d21 100644
> --- a/common/populate
> +++ b/common/populate
> @@ -30,6 +30,20 @@ _require_xfs_db_blocktrash_z_command() {
>  	$XFS_DB_PROG -x -f -c 'blocktrash -z' "${TEST_DEV}" | grep -q 'nothing on stack' || _notrun "blocktrash -z not supported"
>  }
>  
> +# Eat free space until we can't anymore.
> +_consume_free_space() {
> +	dir=$1
> +
> +	old_nr_free=0
> +	nr_free=$(stat -f -c '%f' $dir)
> +	x=0
> +	while [ $nr_free -gt 0 ] && [ $old_nr_free != $nr_free ]; do
> +		$XFS_IO_PROG -f -c "pwrite -b 4194304 0 $((blksz * nr_free))" $dir/eat_my_space.$((x++))

blksz not defined in the function.

Xiaoguang Wang did something similar back in Nov. and I'm still queuing
his patch. (His 1/2 patch conflicts with your scrub/repair patchset and
it might be easier for you to let your patches go first.)

generic: make 17[1-4] work well when btrfs compression is enabled
https://patchwork.kernel.org/patch/9408451/

Does this patch work for you? If so, perhaps you only need to update
generic/282 using the "_fill_fs" helper?

Thanks,
Eryu

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

* Re: [PATCH 5/7] reflink: make error reporting consistent
  2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
  (?)
@ 2016-12-12 10:47   ` Eryu Guan
  2016-12-12 23:06       ` [Ocfs2-devel] " Darrick J. Wong
  -1 siblings, 1 reply; 43+ messages in thread
From: Eryu Guan @ 2016-12-12 10:47 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: ocfs2-devel, fstests

On Sun, Dec 11, 2016 at 01:53:16PM -0800, Darrick J. Wong wrote:
> When we're using dm-error to simulate failed devices, we don't really
> know if the write or the fdatasync is going to receive the EIO.  So,
> capture the entire output and just look for the word error instead
> of enshrining it in the golden output.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/generic/265     |    6 +++++-
>  tests/generic/265.out |    1 -
>  tests/generic/266     |    5 ++++-
>  tests/generic/266.out |    1 -
>  tests/generic/267     |    2 +-
>  tests/generic/268     |    5 ++++-
>  tests/generic/268.out |    1 -
>  tests/generic/271     |    5 +++--
>  tests/generic/271.out |    1 -
>  tests/generic/272     |    5 +++--
>  tests/generic/272.out |    1 -
>  tests/generic/276     |    2 +-
>  tests/generic/276.out |    1 -
>  tests/generic/278     |    5 +++--
>  tests/generic/278.out |    1 -
>  tests/generic/279     |    4 ++--
>  tests/generic/279.out |    1 -
>  tests/generic/281     |    4 ++--
>  tests/generic/281.out |    1 -
>  tests/generic/283     |    6 ++++--
>  tests/generic/283.out |    1 -
>  21 files changed, 32 insertions(+), 27 deletions(-)
> 
> 
> diff --git a/tests/generic/265 b/tests/generic/265
> index 8e9d5bc..ceddfbe 100755
> --- a/tests/generic/265
> +++ b/tests/generic/265
> @@ -80,7 +80,11 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> +	-c "fdatasync" $testdir/file2 2>&1)
> +echo $urk >> $seqres.full
> +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
> +
>  _dmerror_load_working_table
>  _dmerror_unmount
>  _dmerror_mount
> diff --git a/tests/generic/265.out b/tests/generic/265.out
> index 1b67114..31eb4e9 100644
> --- a/tests/generic/265.out
> +++ b/tests/generic/265.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file2
>  CoW and unmount
> -fdatasync: Input/output error
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
>  Check for damage
> diff --git a/tests/generic/266 b/tests/generic/266
> index 4f9816a..09541c8 100755
> --- a/tests/generic/266
> +++ b/tests/generic/266
> @@ -80,7 +80,10 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> +	-c "fdatasync" $testdir/file2 2>&1)
> +echo $urk >> $seqres.full
> +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
>  
>  echo "Clean up the mess"
>  _dmerror_unmount
> diff --git a/tests/generic/266.out b/tests/generic/266.out
> index dd34ad3..1641654 100644
> --- a/tests/generic/266.out
> +++ b/tests/generic/266.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file2
>  CoW and unmount
> -fdatasync: Input/output error
>  Clean up the mess
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
> diff --git a/tests/generic/267 b/tests/generic/267
> index e3a6b0c..2ec6ad9 100755
> --- a/tests/generic/267
> +++ b/tests/generic/267
> @@ -80,7 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
> +$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
>  _dmerror_load_working_table
>  rm -rf $testdir/file2 >> $seqres.full 2>&1
>  _dmerror_unmount
> diff --git a/tests/generic/268 b/tests/generic/268
> index c7dcd57..b7d16ab 100755
> --- a/tests/generic/268
> +++ b/tests/generic/268
> @@ -81,7 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> +	-c "fdatasync" $testdir/file2 2>&1)
> +echo $urk >> $seqres.full
> +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
>  _dmerror_load_working_table
>  
>  echo "Rewrite"
> diff --git a/tests/generic/268.out b/tests/generic/268.out
> index 234e8be..1a3b39a 100644
> --- a/tests/generic/268.out
> +++ b/tests/generic/268.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file2
>  CoW and unmount
> -fdatasync: Input/output error
>  Rewrite
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
> diff --git a/tests/generic/271 b/tests/generic/271
> index ded8854..9439327 100755
> --- a/tests/generic/271
> +++ b/tests/generic/271
> @@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> -	2>&1 >> $seqres.full | _filter_xfs_io_error
> +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> +echo $urk >> $seqres.full
> +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
>  _dmerror_load_working_table
>  _dmerror_unmount
>  _dmerror_mount
> diff --git a/tests/generic/271.out b/tests/generic/271.out
> index 54d5b0d..9b44ee7 100644
> --- a/tests/generic/271.out
> +++ b/tests/generic/271.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file2
>  CoW and unmount
> -pwrite: Input/output error
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
>  Check for damage
> diff --git a/tests/generic/272 b/tests/generic/272
> index 5bc5b39..243adf5 100755
> --- a/tests/generic/272
> +++ b/tests/generic/272
> @@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> -	2>&1 >> $seqres.full | _filter_xfs_io_error
> +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> +echo $urk >> $seqres.full
> +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
>  
>  echo "Clean up the mess"
>  _dmerror_unmount
> diff --git a/tests/generic/272.out b/tests/generic/272.out
> index 0b8bdca..10ecda9 100644
> --- a/tests/generic/272.out
> +++ b/tests/generic/272.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file2
>  CoW and unmount
> -pwrite: Input/output error
>  Clean up the mess
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
> diff --git a/tests/generic/276 b/tests/generic/276
> index 83b902e..34b0029 100755
> --- a/tests/generic/276
> +++ b/tests/generic/276
> @@ -82,7 +82,7 @@ echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
>  $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> -	2>&1 >> $seqres.full | _filter_xfs_io_error
> +	>> $seqres.full 2>&1

This seems different, the error is ignored after this update and test
passes even if there's no error happened. Is this intentional?

The same question applies to generic/279 and generic/281.

Thanks,
Eryu

>  _dmerror_load_working_table
>  rm -rf $testdir/file2 >> $seqres.full 2>&1
>  _dmerror_unmount
> diff --git a/tests/generic/276.out b/tests/generic/276.out
> index 88a0162..a080dd0 100644
> --- a/tests/generic/276.out
> +++ b/tests/generic/276.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file2
>  CoW and unmount
> -pwrite: Input/output error
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
>  Check for damage
> diff --git a/tests/generic/278 b/tests/generic/278
> index 415742a..d751f01 100755
> --- a/tests/generic/278
> +++ b/tests/generic/278
> @@ -82,8 +82,9 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> -	2>&1 >> $seqres.full | _filter_xfs_io_error
> +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> +echo $urk >> $seqres.full
> +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
>  _dmerror_load_working_table
>  
>  echo "Rewrite"
> diff --git a/tests/generic/278.out b/tests/generic/278.out
> index 9ead4ac..cd22fcd 100644
> --- a/tests/generic/278.out
> +++ b/tests/generic/278.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file2
>  CoW and unmount
> -pwrite: Input/output error
>  Rewrite
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
> diff --git a/tests/generic/279 b/tests/generic/279
> index 2f1ec4f..4541de3 100755
> --- a/tests/generic/279
> +++ b/tests/generic/279
> @@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> +	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
>  _dmerror_load_working_table
>  _dmerror_unmount
>  _dmerror_mount
> diff --git a/tests/generic/279.out b/tests/generic/279.out
> index f34c2b2..009f05e 100644
> --- a/tests/generic/279.out
> +++ b/tests/generic/279.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file2
>  CoW and unmount
> -msync: Input/output error
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
>  Check for damage
> diff --git a/tests/generic/281 b/tests/generic/281
> index c95acf2..e8e1661 100755
> --- a/tests/generic/281
> +++ b/tests/generic/281
> @@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> +	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
>  
>  echo "Clean up the mess"
>  _dmerror_unmount
> diff --git a/tests/generic/281.out b/tests/generic/281.out
> index a2d8e3f..1bae187 100644
> --- a/tests/generic/281.out
> +++ b/tests/generic/281.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file2
>  CoW and unmount
> -msync: Input/output error
>  Clean up the mess
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
> diff --git a/tests/generic/283 b/tests/generic/283
> index 8d56ac3..7bfdb4d 100755
> --- a/tests/generic/283
> +++ b/tests/generic/283
> @@ -81,8 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
>  echo "CoW and unmount"
>  sync
>  _dmerror_load_error_table
> -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> +urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> +	-c "msync -s 0 $filesize" $testdir/file2 2>&1)
> +echo $urk >> $seqres.full
> +echo "$urk" | grep -q "error" || _fail "mwrite did not fail"
>  _dmerror_load_working_table
>  
>  echo "Rewrite"
> diff --git a/tests/generic/283.out b/tests/generic/283.out
> index f9fd5c8..b475054 100644
> --- a/tests/generic/283.out
> +++ b/tests/generic/283.out
> @@ -5,7 +5,6 @@ Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file2
>  CoW and unmount
> -msync: Input/output error
>  Rewrite
>  Compare files
>  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
> 

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

* Re: [PATCH 7/7] xfs/ext4: check negative inode size
  2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
  (?)
@ 2016-12-12 11:07   ` Eryu Guan
  2016-12-13 21:49       ` [Ocfs2-devel] " Darrick J. Wong
  -1 siblings, 1 reply; 43+ messages in thread
From: Eryu Guan @ 2016-12-12 11:07 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: ocfs2-devel, fstests

On Sun, Dec 11, 2016 at 01:53:28PM -0800, Darrick J. Wong wrote:
> Craft a malicious filesystem image with a negative inode size,
> then try to trigger a kernel DoS by appending data to the file.
> Ideally this should trigger verifier errors instead of hanging.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/ext4/400   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/ext4/401   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/ext4/group |    2 ++
>  tests/xfs/400    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/401    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/group  |    2 ++
>  6 files changed, 290 insertions(+)
>  create mode 100755 tests/ext4/400
>  create mode 100755 tests/ext4/401
>  create mode 100755 tests/xfs/400
>  create mode 100755 tests/xfs/401
> 
> 
> diff --git a/tests/ext4/400 b/tests/ext4/400
> new file mode 100755
> index 0000000..5857549
> --- /dev/null
> +++ b/tests/ext4/400
> @@ -0,0 +1,71 @@
> +#! /bin/bash
> +# FSQA Test No. 400
> +#
> +# Since loff_t is a signed type, it is invalid for a filesystem to load
> +# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
> +# which means that we can trivially DoS the VFS by creating such a file
> +# and appending to it.  This causes an integer overflow in the routines
> +# underlying writeback, which results in the kernel locking up.

The only difference between ext4/400 and ext4/401 is that 400 makes
i_size=-1 and 401 makes it 0xFFFFFFFFFFFFFE00, while xfs/400 and xfs/401
both create XFS with i_size -1. Is 0xFFFFFFFFFFFFFE00 a typo? Or update
the description accordingly if they are two different tests?

And I noticed that 400 is doing buffered I/O and 401 is doing direct
I/O, can the two be folded in one test?

> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016-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"
> +
> +PIDS=""
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs ext2 ext3 ext4

Then it belongs to shared :)

Thanks,
Eryu

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

* Re: [PATCH 1/7] ocfs2: test reflinking to inline data files
  2016-12-12  9:01   ` Eryu Guan
@ 2016-12-12 18:09       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 18:09 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 05:01:20PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:52:51PM -0800, Darrick J. Wong wrote:
> > Make sure that we can handle reflinking from and to inline-data files.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/reflink       |    2 +
> >  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ocfs2/001.out  |   14 ++++++++
> >  tests/ocfs2/Makefile |   20 +++++++++++
> >  tests/ocfs2/group    |    1 +
> >  5 files changed, 124 insertions(+), 1 deletion(-)
> >  create mode 100755 tests/ocfs2/001
> >  create mode 100644 tests/ocfs2/001.out
> >  create mode 100644 tests/ocfs2/Makefile
> >  create mode 100644 tests/ocfs2/group
> > 
> > 
> > diff --git a/common/reflink b/common/reflink
> > index 9d51729..d048045 100644
> > --- a/common/reflink
> > +++ b/common/reflink
> > @@ -197,7 +197,7 @@ _cp_reflink() {
> >  	file1="$1"
> >  	file2="$2"
> >  
> > -	cp --reflink=always -p "$file1" "$file2"
> > +	cp --reflink=always -p -f "$file1" "$file2"
> 
> I'm still seeing "File exists" error with this patch, tested with your
> ocfs2-vfs-reflink-6 branch, compiled on openSUSE Tumbleweed.
> 
> FSTYP         -- ocfs2
> PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc8.djwong-ocfs2+
> MKFS_OPTIONS  -- --fs-features=local /dev/sda5
> MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> 
> ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
>     --- tests/ocfs2/001.out     2016-12-12 13:51:38.053909486 +0800
>     +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-12-12 16:49:35.038882697 +0800
>     @@ -1,14 +1,18 @@
>      QA output created by 001
>     +mkfs.ocfs2 1.8.4

I guess I'll have to neuter this on newer ocfs2-tools.  (Still running 1.6.4
here).

>      Format and mount
>      Create the original files
>      reflink into the start of file2
>     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
>      reflink past the stuff in file3
>     ...
>     (Run 'diff -u tests/ocfs2/001.out /root/xfstests/results//ocfs2/ocfs2/001.out.bad'  to see the entire diff)
> 
> --- tests/ocfs2/001.out 2016-12-12 13:51:38.053909486 +0800
> +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad     2016-12-12 16:44:31.991943842 +0800
> @@ -1,14 +1,18 @@
>  QA output created by 001
> +mkfs.ocfs2 1.8.4
>  Format and mount
>  Create the original files
>  reflink into the start of file2
> +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
>  reflink past the stuff in file3
>  reflink an inline-data file to a regular one
> +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
>  reflink an inline-data file to another inline-data file
> +cp: failed to reflink '/mnt/testarea/scratch/test-001/file6' from '/mnt/testarea/scratch/test-001/file4': File exists
>  Verify the whole mess
>  2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> -2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> +401b30e3b8b5d629635a5c613cdb7919  SCRATCH_MNT/test-001/file2
>  4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
>  009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file5
> +60b725f10c9c85c70d97880dfe8191b3  SCRATCH_MNT/test-001/file6
> 
> I did the "reflink into the start of file2" test manually, and strace
> showed that it is file1 reports EEXIST.
> 
> open("/mnt/ocfs2/testfile1", O_RDONLY)  = 3
> fstat(3, {st_mode=S_IFREG|0600, st_size=65536, ...}) = 0
> ioctl(3, _IOC(_IOC_WRITE, 0x6f, 0x04, 0x18), 0x7ffc8daf09f0) = -1 EEXIST (File exists)

Wait, that's the ocfs2 reflink ioctl, not FICLONE.  Well that explains
why the functional parts of the tests fail.  I looked at latest coreutils
source, which does not use OCFS2_IOC_REFLINK, so I guess this must be an
opensuse thing?

--D

> 
> The same test on XFS works fine. Did I miss anything?
> 
> Thanks,
> Eryu

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

* [Ocfs2-devel] [PATCH 1/7] ocfs2: test reflinking to inline data files
@ 2016-12-12 18:09       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 18:09 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 05:01:20PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:52:51PM -0800, Darrick J. Wong wrote:
> > Make sure that we can handle reflinking from and to inline-data files.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/reflink       |    2 +
> >  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ocfs2/001.out  |   14 ++++++++
> >  tests/ocfs2/Makefile |   20 +++++++++++
> >  tests/ocfs2/group    |    1 +
> >  5 files changed, 124 insertions(+), 1 deletion(-)
> >  create mode 100755 tests/ocfs2/001
> >  create mode 100644 tests/ocfs2/001.out
> >  create mode 100644 tests/ocfs2/Makefile
> >  create mode 100644 tests/ocfs2/group
> > 
> > 
> > diff --git a/common/reflink b/common/reflink
> > index 9d51729..d048045 100644
> > --- a/common/reflink
> > +++ b/common/reflink
> > @@ -197,7 +197,7 @@ _cp_reflink() {
> >  	file1="$1"
> >  	file2="$2"
> >  
> > -	cp --reflink=always -p "$file1" "$file2"
> > +	cp --reflink=always -p -f "$file1" "$file2"
> 
> I'm still seeing "File exists" error with this patch, tested with your
> ocfs2-vfs-reflink-6 branch, compiled on openSUSE Tumbleweed.
> 
> FSTYP         -- ocfs2
> PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc8.djwong-ocfs2+
> MKFS_OPTIONS  -- --fs-features=local /dev/sda5
> MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> 
> ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
>     --- tests/ocfs2/001.out     2016-12-12 13:51:38.053909486 +0800
>     +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-12-12 16:49:35.038882697 +0800
>     @@ -1,14 +1,18 @@
>      QA output created by 001
>     +mkfs.ocfs2 1.8.4

I guess I'll have to neuter this on newer ocfs2-tools.  (Still running 1.6.4
here).

>      Format and mount
>      Create the original files
>      reflink into the start of file2
>     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
>      reflink past the stuff in file3
>     ...
>     (Run 'diff -u tests/ocfs2/001.out /root/xfstests/results//ocfs2/ocfs2/001.out.bad'  to see the entire diff)
> 
> --- tests/ocfs2/001.out 2016-12-12 13:51:38.053909486 +0800
> +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad     2016-12-12 16:44:31.991943842 +0800
> @@ -1,14 +1,18 @@
>  QA output created by 001
> +mkfs.ocfs2 1.8.4
>  Format and mount
>  Create the original files
>  reflink into the start of file2
> +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
>  reflink past the stuff in file3
>  reflink an inline-data file to a regular one
> +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
>  reflink an inline-data file to another inline-data file
> +cp: failed to reflink '/mnt/testarea/scratch/test-001/file6' from '/mnt/testarea/scratch/test-001/file4': File exists
>  Verify the whole mess
>  2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> -2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> +401b30e3b8b5d629635a5c613cdb7919  SCRATCH_MNT/test-001/file2
>  4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
>  009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file5
> +60b725f10c9c85c70d97880dfe8191b3  SCRATCH_MNT/test-001/file6
> 
> I did the "reflink into the start of file2" test manually, and strace
> showed that it is file1 reports EEXIST.
> 
> open("/mnt/ocfs2/testfile1", O_RDONLY)  = 3
> fstat(3, {st_mode=S_IFREG|0600, st_size=65536, ...}) = 0
> ioctl(3, _IOC(_IOC_WRITE, 0x6f, 0x04, 0x18), 0x7ffc8daf09f0) = -1 EEXIST (File exists)

Wait, that's the ocfs2 reflink ioctl, not FICLONE.  Well that explains
why the functional parts of the tests fail.  I looked at latest coreutils
source, which does not use OCFS2_IOC_REFLINK, so I guess this must be an
opensuse thing?

--D

> 
> The same test on XFS works fine. Did I miss anything?
> 
> Thanks,
> Eryu

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

* Re: [PATCH 4/7] reflink: fix space consumption tests
  2016-12-12 10:25   ` Eryu Guan
@ 2016-12-12 23:03       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 23:03 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 06:25:39PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:53:10PM -0800, Darrick J. Wong wrote:
> > Some of the tests try to check that we can't COW when we're out of
> > space, but some tricky filesystems make this hard because writing N
> > blocks doesn't increase used blocks by N....
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/populate   |   14 ++++++++++++++
> >  tests/generic/171 |    5 ++---
> >  tests/generic/173 |    5 ++---
> >  tests/generic/174 |    5 ++---
> >  tests/generic/282 |    3 +--
> >  5 files changed, 21 insertions(+), 11 deletions(-)
> > 
> > 
> > diff --git a/common/populate b/common/populate
> > index d0003c5..9811d21 100644
> > --- a/common/populate
> > +++ b/common/populate
> > @@ -30,6 +30,20 @@ _require_xfs_db_blocktrash_z_command() {
> >  	$XFS_DB_PROG -x -f -c 'blocktrash -z' "${TEST_DEV}" | grep -q 'nothing on stack' || _notrun "blocktrash -z not supported"
> >  }
> >  
> > +# Eat free space until we can't anymore.
> > +_consume_free_space() {
> > +	dir=$1
> > +
> > +	old_nr_free=0
> > +	nr_free=$(stat -f -c '%f' $dir)
> > +	x=0
> > +	while [ $nr_free -gt 0 ] && [ $old_nr_free != $nr_free ]; do
> > +		$XFS_IO_PROG -f -c "pwrite -b 4194304 0 $((blksz * nr_free))" $dir/eat_my_space.$((x++))
> 
> blksz not defined in the function.
> 
> Xiaoguang Wang did something similar back in Nov. and I'm still queuing
> his patch. (His 1/2 patch conflicts with your scrub/repair patchset and
> it might be easier for you to let your patches go first.)
> 
> generic: make 17[1-4] work well when btrfs compression is enabled
> https://patchwork.kernel.org/patch/9408451/
> 
> Does this patch work for you? If so, perhaps you only need to update
> generic/282 using the "_fill_fs" helper?

Aha!  I had this feeling in the back of my head that someone was
already trying to push a helper function.

At this point XFS online scrub/repair is slipping to 4.11 anyway so you
may as well take Xioguang's patches and I'll just rebase all my stuff
off of that.

--D

> 
> Thanks,
> Eryu
> --
> 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] 43+ messages in thread

* [Ocfs2-devel] [PATCH 4/7] reflink: fix space consumption tests
@ 2016-12-12 23:03       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 23:03 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 06:25:39PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:53:10PM -0800, Darrick J. Wong wrote:
> > Some of the tests try to check that we can't COW when we're out of
> > space, but some tricky filesystems make this hard because writing N
> > blocks doesn't increase used blocks by N....
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/populate   |   14 ++++++++++++++
> >  tests/generic/171 |    5 ++---
> >  tests/generic/173 |    5 ++---
> >  tests/generic/174 |    5 ++---
> >  tests/generic/282 |    3 +--
> >  5 files changed, 21 insertions(+), 11 deletions(-)
> > 
> > 
> > diff --git a/common/populate b/common/populate
> > index d0003c5..9811d21 100644
> > --- a/common/populate
> > +++ b/common/populate
> > @@ -30,6 +30,20 @@ _require_xfs_db_blocktrash_z_command() {
> >  	$XFS_DB_PROG -x -f -c 'blocktrash -z' "${TEST_DEV}" | grep -q 'nothing on stack' || _notrun "blocktrash -z not supported"
> >  }
> >  
> > +# Eat free space until we can't anymore.
> > +_consume_free_space() {
> > +	dir=$1
> > +
> > +	old_nr_free=0
> > +	nr_free=$(stat -f -c '%f' $dir)
> > +	x=0
> > +	while [ $nr_free -gt 0 ] && [ $old_nr_free != $nr_free ]; do
> > +		$XFS_IO_PROG -f -c "pwrite -b 4194304 0 $((blksz * nr_free))" $dir/eat_my_space.$((x++))
> 
> blksz not defined in the function.
> 
> Xiaoguang Wang did something similar back in Nov. and I'm still queuing
> his patch. (His 1/2 patch conflicts with your scrub/repair patchset and
> it might be easier for you to let your patches go first.)
> 
> generic: make 17[1-4] work well when btrfs compression is enabled
> https://patchwork.kernel.org/patch/9408451/
> 
> Does this patch work for you? If so, perhaps you only need to update
> generic/282 using the "_fill_fs" helper?

Aha!  I had this feeling in the back of my head that someone was
already trying to push a helper function.

At this point XFS online scrub/repair is slipping to 4.11 anyway so you
may as well take Xioguang's patches and I'll just rebase all my stuff
off of that.

--D

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

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

* Re: [PATCH 5/7] reflink: make error reporting consistent
  2016-12-12 10:47   ` Eryu Guan
@ 2016-12-12 23:06       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 23:06 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 06:47:43PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:53:16PM -0800, Darrick J. Wong wrote:
> > When we're using dm-error to simulate failed devices, we don't really
> > know if the write or the fdatasync is going to receive the EIO.  So,
> > capture the entire output and just look for the word error instead
> > of enshrining it in the golden output.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/generic/265     |    6 +++++-
> >  tests/generic/265.out |    1 -
> >  tests/generic/266     |    5 ++++-
> >  tests/generic/266.out |    1 -
> >  tests/generic/267     |    2 +-
> >  tests/generic/268     |    5 ++++-
> >  tests/generic/268.out |    1 -
> >  tests/generic/271     |    5 +++--
> >  tests/generic/271.out |    1 -
> >  tests/generic/272     |    5 +++--
> >  tests/generic/272.out |    1 -
> >  tests/generic/276     |    2 +-
> >  tests/generic/276.out |    1 -
> >  tests/generic/278     |    5 +++--
> >  tests/generic/278.out |    1 -
> >  tests/generic/279     |    4 ++--
> >  tests/generic/279.out |    1 -
> >  tests/generic/281     |    4 ++--
> >  tests/generic/281.out |    1 -
> >  tests/generic/283     |    6 ++++--
> >  tests/generic/283.out |    1 -
> >  21 files changed, 32 insertions(+), 27 deletions(-)
> > 
> > 
> > diff --git a/tests/generic/265 b/tests/generic/265
> > index 8e9d5bc..ceddfbe 100755
> > --- a/tests/generic/265
> > +++ b/tests/generic/265
> > @@ -80,7 +80,11 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> > +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> > +	-c "fdatasync" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
> > +
> >  _dmerror_load_working_table
> >  _dmerror_unmount
> >  _dmerror_mount
> > diff --git a/tests/generic/265.out b/tests/generic/265.out
> > index 1b67114..31eb4e9 100644
> > --- a/tests/generic/265.out
> > +++ b/tests/generic/265.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file2
> >  CoW and unmount
> > -fdatasync: Input/output error
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
> >  Check for damage
> > diff --git a/tests/generic/266 b/tests/generic/266
> > index 4f9816a..09541c8 100755
> > --- a/tests/generic/266
> > +++ b/tests/generic/266
> > @@ -80,7 +80,10 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> > +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> > +	-c "fdatasync" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
> >  
> >  echo "Clean up the mess"
> >  _dmerror_unmount
> > diff --git a/tests/generic/266.out b/tests/generic/266.out
> > index dd34ad3..1641654 100644
> > --- a/tests/generic/266.out
> > +++ b/tests/generic/266.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file2
> >  CoW and unmount
> > -fdatasync: Input/output error
> >  Clean up the mess
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
> > diff --git a/tests/generic/267 b/tests/generic/267
> > index e3a6b0c..2ec6ad9 100755
> > --- a/tests/generic/267
> > +++ b/tests/generic/267
> > @@ -80,7 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
> > +$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
> >  _dmerror_load_working_table
> >  rm -rf $testdir/file2 >> $seqres.full 2>&1
> >  _dmerror_unmount
> > diff --git a/tests/generic/268 b/tests/generic/268
> > index c7dcd57..b7d16ab 100755
> > --- a/tests/generic/268
> > +++ b/tests/generic/268
> > @@ -81,7 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> > +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> > +	-c "fdatasync" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
> >  _dmerror_load_working_table
> >  
> >  echo "Rewrite"
> > diff --git a/tests/generic/268.out b/tests/generic/268.out
> > index 234e8be..1a3b39a 100644
> > --- a/tests/generic/268.out
> > +++ b/tests/generic/268.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file2
> >  CoW and unmount
> > -fdatasync: Input/output error
> >  Rewrite
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
> > diff --git a/tests/generic/271 b/tests/generic/271
> > index ded8854..9439327 100755
> > --- a/tests/generic/271
> > +++ b/tests/generic/271
> > @@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> > -	2>&1 >> $seqres.full | _filter_xfs_io_error
> > +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
> >  _dmerror_load_working_table
> >  _dmerror_unmount
> >  _dmerror_mount
> > diff --git a/tests/generic/271.out b/tests/generic/271.out
> > index 54d5b0d..9b44ee7 100644
> > --- a/tests/generic/271.out
> > +++ b/tests/generic/271.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file2
> >  CoW and unmount
> > -pwrite: Input/output error
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
> >  Check for damage
> > diff --git a/tests/generic/272 b/tests/generic/272
> > index 5bc5b39..243adf5 100755
> > --- a/tests/generic/272
> > +++ b/tests/generic/272
> > @@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> > -	2>&1 >> $seqres.full | _filter_xfs_io_error
> > +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
> >  
> >  echo "Clean up the mess"
> >  _dmerror_unmount
> > diff --git a/tests/generic/272.out b/tests/generic/272.out
> > index 0b8bdca..10ecda9 100644
> > --- a/tests/generic/272.out
> > +++ b/tests/generic/272.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file2
> >  CoW and unmount
> > -pwrite: Input/output error
> >  Clean up the mess
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
> > diff --git a/tests/generic/276 b/tests/generic/276
> > index 83b902e..34b0029 100755
> > --- a/tests/generic/276
> > +++ b/tests/generic/276
> > @@ -82,7 +82,7 @@ echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> >  $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> > -	2>&1 >> $seqres.full | _filter_xfs_io_error
> > +	>> $seqres.full 2>&1
> 
> This seems different, the error is ignored after this update and test
> passes even if there's no error happened. Is this intentional?
> 
> The same question applies to generic/279 and generic/281.

Yes, it's intentional.  Some of the tests g/{276,279,281} let the first
write attempt fail and never retry, so it's sufficient to check the
md5sum hasn't changed even after recovery.  The others actually /do/
retry the write after removing the dm-error, so we have to check that
something spat out an error message.

Hmmm... that should go in the commit message next time around.

--D

> 
> Thanks,
> Eryu
> 
> >  _dmerror_load_working_table
> >  rm -rf $testdir/file2 >> $seqres.full 2>&1
> >  _dmerror_unmount
> > diff --git a/tests/generic/276.out b/tests/generic/276.out
> > index 88a0162..a080dd0 100644
> > --- a/tests/generic/276.out
> > +++ b/tests/generic/276.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file2
> >  CoW and unmount
> > -pwrite: Input/output error
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
> >  Check for damage
> > diff --git a/tests/generic/278 b/tests/generic/278
> > index 415742a..d751f01 100755
> > --- a/tests/generic/278
> > +++ b/tests/generic/278
> > @@ -82,8 +82,9 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> > -	2>&1 >> $seqres.full | _filter_xfs_io_error
> > +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
> >  _dmerror_load_working_table
> >  
> >  echo "Rewrite"
> > diff --git a/tests/generic/278.out b/tests/generic/278.out
> > index 9ead4ac..cd22fcd 100644
> > --- a/tests/generic/278.out
> > +++ b/tests/generic/278.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file2
> >  CoW and unmount
> > -pwrite: Input/output error
> >  Rewrite
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
> > diff --git a/tests/generic/279 b/tests/generic/279
> > index 2f1ec4f..4541de3 100755
> > --- a/tests/generic/279
> > +++ b/tests/generic/279
> > @@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> > -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> > +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> > +	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
> >  _dmerror_load_working_table
> >  _dmerror_unmount
> >  _dmerror_mount
> > diff --git a/tests/generic/279.out b/tests/generic/279.out
> > index f34c2b2..009f05e 100644
> > --- a/tests/generic/279.out
> > +++ b/tests/generic/279.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file2
> >  CoW and unmount
> > -msync: Input/output error
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
> >  Check for damage
> > diff --git a/tests/generic/281 b/tests/generic/281
> > index c95acf2..e8e1661 100755
> > --- a/tests/generic/281
> > +++ b/tests/generic/281
> > @@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> > -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> > +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> > +	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
> >  
> >  echo "Clean up the mess"
> >  _dmerror_unmount
> > diff --git a/tests/generic/281.out b/tests/generic/281.out
> > index a2d8e3f..1bae187 100644
> > --- a/tests/generic/281.out
> > +++ b/tests/generic/281.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file2
> >  CoW and unmount
> > -msync: Input/output error
> >  Clean up the mess
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
> > diff --git a/tests/generic/283 b/tests/generic/283
> > index 8d56ac3..7bfdb4d 100755
> > --- a/tests/generic/283
> > +++ b/tests/generic/283
> > @@ -81,8 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> > -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> > +urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> > +	-c "msync -s 0 $filesize" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "mwrite did not fail"
> >  _dmerror_load_working_table
> >  
> >  echo "Rewrite"
> > diff --git a/tests/generic/283.out b/tests/generic/283.out
> > index f9fd5c8..b475054 100644
> > --- a/tests/generic/283.out
> > +++ b/tests/generic/283.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file2
> >  CoW and unmount
> > -msync: Input/output error
> >  Rewrite
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
> > 
> --
> 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] 43+ messages in thread

* [Ocfs2-devel] [PATCH 5/7] reflink: make error reporting consistent
@ 2016-12-12 23:06       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 23:06 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 06:47:43PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:53:16PM -0800, Darrick J. Wong wrote:
> > When we're using dm-error to simulate failed devices, we don't really
> > know if the write or the fdatasync is going to receive the EIO.  So,
> > capture the entire output and just look for the word error instead
> > of enshrining it in the golden output.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/generic/265     |    6 +++++-
> >  tests/generic/265.out |    1 -
> >  tests/generic/266     |    5 ++++-
> >  tests/generic/266.out |    1 -
> >  tests/generic/267     |    2 +-
> >  tests/generic/268     |    5 ++++-
> >  tests/generic/268.out |    1 -
> >  tests/generic/271     |    5 +++--
> >  tests/generic/271.out |    1 -
> >  tests/generic/272     |    5 +++--
> >  tests/generic/272.out |    1 -
> >  tests/generic/276     |    2 +-
> >  tests/generic/276.out |    1 -
> >  tests/generic/278     |    5 +++--
> >  tests/generic/278.out |    1 -
> >  tests/generic/279     |    4 ++--
> >  tests/generic/279.out |    1 -
> >  tests/generic/281     |    4 ++--
> >  tests/generic/281.out |    1 -
> >  tests/generic/283     |    6 ++++--
> >  tests/generic/283.out |    1 -
> >  21 files changed, 32 insertions(+), 27 deletions(-)
> > 
> > 
> > diff --git a/tests/generic/265 b/tests/generic/265
> > index 8e9d5bc..ceddfbe 100755
> > --- a/tests/generic/265
> > +++ b/tests/generic/265
> > @@ -80,7 +80,11 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> > +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> > +	-c "fdatasync" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
> > +
> >  _dmerror_load_working_table
> >  _dmerror_unmount
> >  _dmerror_mount
> > diff --git a/tests/generic/265.out b/tests/generic/265.out
> > index 1b67114..31eb4e9 100644
> > --- a/tests/generic/265.out
> > +++ b/tests/generic/265.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file2
> >  CoW and unmount
> > -fdatasync: Input/output error
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-265/file1
> >  Check for damage
> > diff --git a/tests/generic/266 b/tests/generic/266
> > index 4f9816a..09541c8 100755
> > --- a/tests/generic/266
> > +++ b/tests/generic/266
> > @@ -80,7 +80,10 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> > +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> > +	-c "fdatasync" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
> >  
> >  echo "Clean up the mess"
> >  _dmerror_unmount
> > diff --git a/tests/generic/266.out b/tests/generic/266.out
> > index dd34ad3..1641654 100644
> > --- a/tests/generic/266.out
> > +++ b/tests/generic/266.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file2
> >  CoW and unmount
> > -fdatasync: Input/output error
> >  Clean up the mess
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-266/file1
> > diff --git a/tests/generic/267 b/tests/generic/267
> > index e3a6b0c..2ec6ad9 100755
> > --- a/tests/generic/267
> > +++ b/tests/generic/267
> > @@ -80,7 +80,7 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full
> > +$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
> >  _dmerror_load_working_table
> >  rm -rf $testdir/file2 >> $seqres.full 2>&1
> >  _dmerror_unmount
> > diff --git a/tests/generic/268 b/tests/generic/268
> > index c7dcd57..b7d16ab 100755
> > --- a/tests/generic/268
> > +++ b/tests/generic/268
> > @@ -81,7 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full
> > +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
> > +	-c "fdatasync" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "pwrite did not fail"
> >  _dmerror_load_working_table
> >  
> >  echo "Rewrite"
> > diff --git a/tests/generic/268.out b/tests/generic/268.out
> > index 234e8be..1a3b39a 100644
> > --- a/tests/generic/268.out
> > +++ b/tests/generic/268.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file2
> >  CoW and unmount
> > -fdatasync: Input/output error
> >  Rewrite
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-268/file1
> > diff --git a/tests/generic/271 b/tests/generic/271
> > index ded8854..9439327 100755
> > --- a/tests/generic/271
> > +++ b/tests/generic/271
> > @@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> > -	2>&1 >> $seqres.full | _filter_xfs_io_error
> > +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
> >  _dmerror_load_working_table
> >  _dmerror_unmount
> >  _dmerror_mount
> > diff --git a/tests/generic/271.out b/tests/generic/271.out
> > index 54d5b0d..9b44ee7 100644
> > --- a/tests/generic/271.out
> > +++ b/tests/generic/271.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file2
> >  CoW and unmount
> > -pwrite: Input/output error
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-271/file1
> >  Check for damage
> > diff --git a/tests/generic/272 b/tests/generic/272
> > index 5bc5b39..243adf5 100755
> > --- a/tests/generic/272
> > +++ b/tests/generic/272
> > @@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> > -	2>&1 >> $seqres.full | _filter_xfs_io_error
> > +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
> >  
> >  echo "Clean up the mess"
> >  _dmerror_unmount
> > diff --git a/tests/generic/272.out b/tests/generic/272.out
> > index 0b8bdca..10ecda9 100644
> > --- a/tests/generic/272.out
> > +++ b/tests/generic/272.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file2
> >  CoW and unmount
> > -pwrite: Input/output error
> >  Clean up the mess
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-272/file1
> > diff --git a/tests/generic/276 b/tests/generic/276
> > index 83b902e..34b0029 100755
> > --- a/tests/generic/276
> > +++ b/tests/generic/276
> > @@ -82,7 +82,7 @@ echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> >  $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> > -	2>&1 >> $seqres.full | _filter_xfs_io_error
> > +	>> $seqres.full 2>&1
> 
> This seems different, the error is ignored after this update and test
> passes even if there's no error happened. Is this intentional?
> 
> The same question applies to generic/279 and generic/281.

Yes, it's intentional.  Some of the tests g/{276,279,281} let the first
write attempt fail and never retry, so it's sufficient to check the
md5sum hasn't changed even after recovery.  The others actually /do/
retry the write after removing the dm-error, so we have to check that
something spat out an error message.

Hmmm... that should go in the commit message next time around.

--D

> 
> Thanks,
> Eryu
> 
> >  _dmerror_load_working_table
> >  rm -rf $testdir/file2 >> $seqres.full 2>&1
> >  _dmerror_unmount
> > diff --git a/tests/generic/276.out b/tests/generic/276.out
> > index 88a0162..a080dd0 100644
> > --- a/tests/generic/276.out
> > +++ b/tests/generic/276.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file2
> >  CoW and unmount
> > -pwrite: Input/output error
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-276/file1
> >  Check for damage
> > diff --git a/tests/generic/278 b/tests/generic/278
> > index 415742a..d751f01 100755
> > --- a/tests/generic/278
> > +++ b/tests/generic/278
> > @@ -82,8 +82,9 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
> > -	2>&1 >> $seqres.full | _filter_xfs_io_error
> > +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail"
> >  _dmerror_load_working_table
> >  
> >  echo "Rewrite"
> > diff --git a/tests/generic/278.out b/tests/generic/278.out
> > index 9ead4ac..cd22fcd 100644
> > --- a/tests/generic/278.out
> > +++ b/tests/generic/278.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file2
> >  CoW and unmount
> > -pwrite: Input/output error
> >  Rewrite
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-278/file1
> > diff --git a/tests/generic/279 b/tests/generic/279
> > index 2f1ec4f..4541de3 100755
> > --- a/tests/generic/279
> > +++ b/tests/generic/279
> > @@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> > -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> > +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> > +	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
> >  _dmerror_load_working_table
> >  _dmerror_unmount
> >  _dmerror_mount
> > diff --git a/tests/generic/279.out b/tests/generic/279.out
> > index f34c2b2..009f05e 100644
> > --- a/tests/generic/279.out
> > +++ b/tests/generic/279.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file2
> >  CoW and unmount
> > -msync: Input/output error
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-279/file1
> >  Check for damage
> > diff --git a/tests/generic/281 b/tests/generic/281
> > index c95acf2..e8e1661 100755
> > --- a/tests/generic/281
> > +++ b/tests/generic/281
> > @@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> > -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> > +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> > +	-c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
> >  
> >  echo "Clean up the mess"
> >  _dmerror_unmount
> > diff --git a/tests/generic/281.out b/tests/generic/281.out
> > index a2d8e3f..1bae187 100644
> > --- a/tests/generic/281.out
> > +++ b/tests/generic/281.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file2
> >  CoW and unmount
> > -msync: Input/output error
> >  Clean up the mess
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-281/file1
> > diff --git a/tests/generic/283 b/tests/generic/283
> > index 8d56ac3..7bfdb4d 100755
> > --- a/tests/generic/283
> > +++ b/tests/generic/283
> > @@ -81,8 +81,10 @@ md5sum $testdir/file2 | _filter_scratch
> >  echo "CoW and unmount"
> >  sync
> >  _dmerror_load_error_table
> > -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1)
> > -cat $TEST_DIR/mwrite.out | tee -a $seqres.full
> > +urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
> > +	-c "msync -s 0 $filesize" $testdir/file2 2>&1)
> > +echo $urk >> $seqres.full
> > +echo "$urk" | grep -q "error" || _fail "mwrite did not fail"
> >  _dmerror_load_working_table
> >  
> >  echo "Rewrite"
> > diff --git a/tests/generic/283.out b/tests/generic/283.out
> > index f9fd5c8..b475054 100644
> > --- a/tests/generic/283.out
> > +++ b/tests/generic/283.out
> > @@ -5,7 +5,6 @@ Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file2
> >  CoW and unmount
> > -msync: Input/output error
> >  Rewrite
> >  Compare files
> >  1886e67cf8783e89ce6ddc5bb09a3944  SCRATCH_MNT/test-283/file1
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/7] reflink: fix quota tests to work properly
  2016-12-12 10:06   ` Eryu Guan
@ 2016-12-12 23:08       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 23:08 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 06:06:22PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:53:04PM -0800, Darrick J. Wong wrote:
> > Fix the reflink quota tests to su to the fsgqa user so that we actually
> > test enforcement of quotas.  Seems that XFS enforces user quotas even
> > if root is writing to a user file, whereas everything else lets root
> > writes through.  Also clean up some of the variable usage and
> > _require_user.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/generic/305     |    2 +-
> >  tests/generic/305.out |   30 +++++++++++++++---------------
> >  tests/generic/326     |    2 +-
> >  tests/generic/326.out |   30 +++++++++++++++---------------
> >  tests/generic/327     |   12 +++++++-----
> >  tests/generic/327.out |   12 ++++++------
> >  tests/generic/328     |   14 ++++++++------
> >  tests/generic/328.out |   28 ++++++++++++++--------------
> >  8 files changed, 67 insertions(+), 63 deletions(-)
> > 
> > 
> > diff --git a/tests/generic/305 b/tests/generic/305
> > index d73d87f..9c3489b 100755
> > --- a/tests/generic/305
> > +++ b/tests/generic/305
> > @@ -51,7 +51,7 @@ _require_quota
> >  _require_nobody
> >  
> >  _repquota() {
> > -	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
> > +	repquota -O csv $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk -F ',' '{print $1, $4, $5, $6}'
> 
> The version of "quota" is a bit old shipped by RHEL7, there's no "-O"
> option support. And this works for me
> 
> 	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk '{print $1, $3, $4, $5}'
> 
> Still worth chaning the .out files this way?

Yes, because the inode usage counts aren't guaranteed to be the same
between filesystems due to weirdness in the root inode counts.

Basically, ocfs2 charges an additional 2 root inode count right off the
bat, which screws up the golden output.  btrfs doesn't have user/group
quotas, so the reflink-quota tests only ever checked XFS in the past.

I'll fix it not to rely on -O csv.

--D

> 
> Thanks,
> Eryu
> --
> 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] 43+ messages in thread

* [Ocfs2-devel] [PATCH 3/7] reflink: fix quota tests to work properly
@ 2016-12-12 23:08       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 23:08 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 06:06:22PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:53:04PM -0800, Darrick J. Wong wrote:
> > Fix the reflink quota tests to su to the fsgqa user so that we actually
> > test enforcement of quotas.  Seems that XFS enforces user quotas even
> > if root is writing to a user file, whereas everything else lets root
> > writes through.  Also clean up some of the variable usage and
> > _require_user.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/generic/305     |    2 +-
> >  tests/generic/305.out |   30 +++++++++++++++---------------
> >  tests/generic/326     |    2 +-
> >  tests/generic/326.out |   30 +++++++++++++++---------------
> >  tests/generic/327     |   12 +++++++-----
> >  tests/generic/327.out |   12 ++++++------
> >  tests/generic/328     |   14 ++++++++------
> >  tests/generic/328.out |   28 ++++++++++++++--------------
> >  8 files changed, 67 insertions(+), 63 deletions(-)
> > 
> > 
> > diff --git a/tests/generic/305 b/tests/generic/305
> > index d73d87f..9c3489b 100755
> > --- a/tests/generic/305
> > +++ b/tests/generic/305
> > @@ -51,7 +51,7 @@ _require_quota
> >  _require_nobody
> >  
> >  _repquota() {
> > -	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)'
> > +	repquota -O csv $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk -F ',' '{print $1, $4, $5, $6}'
> 
> The version of "quota" is a bit old shipped by RHEL7, there's no "-O"
> option support. And this works for me
> 
> 	repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' | awk '{print $1, $3, $4, $5}'
> 
> Still worth chaning the .out files this way?

Yes, because the inode usage counts aren't guaranteed to be the same
between filesystems due to weirdness in the root inode counts.

Basically, ocfs2 charges an additional 2 root inode count right off the
bat, which screws up the golden output.  btrfs doesn't have user/group
quotas, so the reflink-quota tests only ever checked XFS in the past.

I'll fix it not to rely on -O csv.

--D

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

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

* Re: [PATCH 2/7] ocfs2/reflink: fix file block size reporting
  2016-12-12  9:48   ` Eryu Guan
@ 2016-12-12 23:08       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 23:08 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 05:48:20PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:52:57PM -0800, Darrick J. Wong wrote:
> > Some of the reflink tests try to require a specific filesystem block
> > size so that they can test file block manipulation functions.  That's
> > straightforward for most filesystems but ocfs2 throws in the additional
> > twist that data fork block mappings are stored in units of clusters, not
> > blocks, which causes these reflink tests to fail.
> > 
> > Therefore, introduce a new helper that retrieves the file minimum block
> > size and adapt the reflink tests to use that instead.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/rc         |   21 +++++++++++++++++++--
> >  tests/generic/205 |    2 +-
> >  tests/generic/206 |    2 +-
> >  tests/generic/216 |    2 +-
> >  tests/generic/217 |    2 +-
> >  tests/generic/218 |    2 +-
> >  tests/generic/220 |    2 +-
> >  tests/generic/222 |    2 +-
> >  tests/generic/227 |    2 +-
> >  tests/generic/229 |    2 +-
> >  tests/generic/238 |    2 +-
> >  11 files changed, 29 insertions(+), 12 deletions(-)
> > 
> > 
> > diff --git a/common/rc b/common/rc
> > index 2639fbd..30111d4 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -925,7 +925,7 @@ _scratch_mkfs_blocksized()
> >  	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
> >  	;;
> >      ocfs2)
> > -	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
> > +	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
> >  	;;
> >      *)
> >  	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
> > @@ -3029,13 +3029,30 @@ _sysfs_dev()
> >  	echo /sys/dev/block/$_maj:$_min
> >  }
> >  
> > +# Get the minimum block size of a file.  Usually this is the
> > +# minimum fs block size, but some filesystems (ocfs2) do block
> > +# mappings in larger units.
> > +get_file_block_size()
> 
> Name it with leading underscore? As it's a common helper.
> 
> > +{
> > +	if [ -z $1 ] || [ ! -d $1 ]; then
> > +		echo "Missing mount point argument for get_file_block_size"
> > +		exit 1
> > +	fi
> > +	if [ "$FSTYP" = "ocfs2" ]; then
> > +		stat -c '%o' $1
> > +	else
> > +		stat -f -c '%S' $1
> 
> We can use "get_block_size $1" here.
> 
> > +	fi
> > +}
> > +
> > +# Get the minimum block size of an fs.
> >  get_block_size()
> 
> We should rename it with a underscore too, but probably in an different
> patch.

Ok.

--D

> 
> Thanks,
> Eryu
> --
> 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] 43+ messages in thread

* [Ocfs2-devel] [PATCH 2/7] ocfs2/reflink: fix file block size reporting
@ 2016-12-12 23:08       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-12 23:08 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 05:48:20PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:52:57PM -0800, Darrick J. Wong wrote:
> > Some of the reflink tests try to require a specific filesystem block
> > size so that they can test file block manipulation functions.  That's
> > straightforward for most filesystems but ocfs2 throws in the additional
> > twist that data fork block mappings are stored in units of clusters, not
> > blocks, which causes these reflink tests to fail.
> > 
> > Therefore, introduce a new helper that retrieves the file minimum block
> > size and adapt the reflink tests to use that instead.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/rc         |   21 +++++++++++++++++++--
> >  tests/generic/205 |    2 +-
> >  tests/generic/206 |    2 +-
> >  tests/generic/216 |    2 +-
> >  tests/generic/217 |    2 +-
> >  tests/generic/218 |    2 +-
> >  tests/generic/220 |    2 +-
> >  tests/generic/222 |    2 +-
> >  tests/generic/227 |    2 +-
> >  tests/generic/229 |    2 +-
> >  tests/generic/238 |    2 +-
> >  11 files changed, 29 insertions(+), 12 deletions(-)
> > 
> > 
> > diff --git a/common/rc b/common/rc
> > index 2639fbd..30111d4 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -925,7 +925,7 @@ _scratch_mkfs_blocksized()
> >  	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
> >  	;;
> >      ocfs2)
> > -	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
> > +	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
> >  	;;
> >      *)
> >  	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
> > @@ -3029,13 +3029,30 @@ _sysfs_dev()
> >  	echo /sys/dev/block/$_maj:$_min
> >  }
> >  
> > +# Get the minimum block size of a file.  Usually this is the
> > +# minimum fs block size, but some filesystems (ocfs2) do block
> > +# mappings in larger units.
> > +get_file_block_size()
> 
> Name it with leading underscore? As it's a common helper.
> 
> > +{
> > +	if [ -z $1 ] || [ ! -d $1 ]; then
> > +		echo "Missing mount point argument for get_file_block_size"
> > +		exit 1
> > +	fi
> > +	if [ "$FSTYP" = "ocfs2" ]; then
> > +		stat -c '%o' $1
> > +	else
> > +		stat -f -c '%S' $1
> 
> We can use "get_block_size $1" here.
> 
> > +	fi
> > +}
> > +
> > +# Get the minimum block size of an fs.
> >  get_block_size()
> 
> We should rename it with a underscore too, but probably in an different
> patch.

Ok.

--D

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

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

* Re: [PATCH 1/7] ocfs2: test reflinking to inline data files
  2016-12-12 18:09       ` [Ocfs2-devel] " Darrick J. Wong
  (?)
@ 2016-12-13  3:20       ` Eryu Guan
  2016-12-13  7:11           ` [Ocfs2-devel] " Darrick J. Wong
  -1 siblings, 1 reply; 43+ messages in thread
From: Eryu Guan @ 2016-12-13  3:20 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 10:09:22AM -0800, Darrick J. Wong wrote:
> On Mon, Dec 12, 2016 at 05:01:20PM +0800, Eryu Guan wrote:
> > On Sun, Dec 11, 2016 at 01:52:51PM -0800, Darrick J. Wong wrote:
> > > Make sure that we can handle reflinking from and to inline-data files.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> > >  common/reflink       |    2 +
> > >  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  tests/ocfs2/001.out  |   14 ++++++++
> > >  tests/ocfs2/Makefile |   20 +++++++++++
> > >  tests/ocfs2/group    |    1 +
> > >  5 files changed, 124 insertions(+), 1 deletion(-)
> > >  create mode 100755 tests/ocfs2/001
> > >  create mode 100644 tests/ocfs2/001.out
> > >  create mode 100644 tests/ocfs2/Makefile
> > >  create mode 100644 tests/ocfs2/group
> > > 
> > > 
> > > diff --git a/common/reflink b/common/reflink
> > > index 9d51729..d048045 100644
> > > --- a/common/reflink
> > > +++ b/common/reflink
> > > @@ -197,7 +197,7 @@ _cp_reflink() {
> > >  	file1="$1"
> > >  	file2="$2"
> > >  
> > > -	cp --reflink=always -p "$file1" "$file2"
> > > +	cp --reflink=always -p -f "$file1" "$file2"
> > 
> > I'm still seeing "File exists" error with this patch, tested with your
> > ocfs2-vfs-reflink-6 branch, compiled on openSUSE Tumbleweed.
> > 
> > FSTYP         -- ocfs2
> > PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc8.djwong-ocfs2+
> > MKFS_OPTIONS  -- --fs-features=local /dev/sda5
> > MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> > 
> > ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
> >     --- tests/ocfs2/001.out     2016-12-12 13:51:38.053909486 +0800
> >     +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-12-12 16:49:35.038882697 +0800
> >     @@ -1,14 +1,18 @@
> >      QA output created by 001
> >     +mkfs.ocfs2 1.8.4
> 
> I guess I'll have to neuter this on newer ocfs2-tools.  (Still running 1.6.4
> here).

I have a patch pending on review that could fix & filter this, FYI

fstests: teach _scratch_mkfs to handle mkfs option conflicts
https://www.spinics.net/lists/fstests/msg04550.html

> 
> >      Format and mount
> >      Create the original files
> >      reflink into the start of file2
> >     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> >      reflink past the stuff in file3
> >     ...
> >     (Run 'diff -u tests/ocfs2/001.out /root/xfstests/results//ocfs2/ocfs2/001.out.bad'  to see the entire diff)
> > 
> > --- tests/ocfs2/001.out 2016-12-12 13:51:38.053909486 +0800
> > +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad     2016-12-12 16:44:31.991943842 +0800
> > @@ -1,14 +1,18 @@
> >  QA output created by 001
> > +mkfs.ocfs2 1.8.4
> >  Format and mount
> >  Create the original files
> >  reflink into the start of file2
> > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> >  reflink past the stuff in file3
> >  reflink an inline-data file to a regular one
> > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
> >  reflink an inline-data file to another inline-data file
> > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file6' from '/mnt/testarea/scratch/test-001/file4': File exists
> >  Verify the whole mess
> >  2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> > -2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> > +401b30e3b8b5d629635a5c613cdb7919  SCRATCH_MNT/test-001/file2
> >  4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> >  009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file5
> > +60b725f10c9c85c70d97880dfe8191b3  SCRATCH_MNT/test-001/file6
> > 
> > I did the "reflink into the start of file2" test manually, and strace
> > showed that it is file1 reports EEXIST.
> > 
> > open("/mnt/ocfs2/testfile1", O_RDONLY)  = 3
> > fstat(3, {st_mode=S_IFREG|0600, st_size=65536, ...}) = 0
> > ioctl(3, _IOC(_IOC_WRITE, 0x6f, 0x04, 0x18), 0x7ffc8daf09f0) = -1 EEXIST (File exists)
> 
> Wait, that's the ocfs2 reflink ioctl, not FICLONE.  Well that explains
> why the functional parts of the tests fail.  I looked at latest coreutils
> source, which does not use OCFS2_IOC_REFLINK, so I guess this must be an
> opensuse thing?

Ok, I'll try a newer coreutils.

Thanks,
Eryu

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

* Re: [PATCH 4/7] reflink: fix space consumption tests
  2016-12-12 23:03       ` [Ocfs2-devel] " Darrick J. Wong
  (?)
@ 2016-12-13  3:22       ` Eryu Guan
  -1 siblings, 0 replies; 43+ messages in thread
From: Eryu Guan @ 2016-12-13  3:22 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 03:03:53PM -0800, Darrick J. Wong wrote:
> On Mon, Dec 12, 2016 at 06:25:39PM +0800, Eryu Guan wrote:
> > On Sun, Dec 11, 2016 at 01:53:10PM -0800, Darrick J. Wong wrote:
> > > Some of the tests try to check that we can't COW when we're out of
> > > space, but some tricky filesystems make this hard because writing N
> > > blocks doesn't increase used blocks by N....
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> > >  common/populate   |   14 ++++++++++++++
> > >  tests/generic/171 |    5 ++---
> > >  tests/generic/173 |    5 ++---
> > >  tests/generic/174 |    5 ++---
> > >  tests/generic/282 |    3 +--
> > >  5 files changed, 21 insertions(+), 11 deletions(-)
> > > 
> > > 
> > > diff --git a/common/populate b/common/populate
> > > index d0003c5..9811d21 100644
> > > --- a/common/populate
> > > +++ b/common/populate
> > > @@ -30,6 +30,20 @@ _require_xfs_db_blocktrash_z_command() {
> > >  	$XFS_DB_PROG -x -f -c 'blocktrash -z' "${TEST_DEV}" | grep -q 'nothing on stack' || _notrun "blocktrash -z not supported"
> > >  }
> > >  
> > > +# Eat free space until we can't anymore.
> > > +_consume_free_space() {
> > > +	dir=$1
> > > +
> > > +	old_nr_free=0
> > > +	nr_free=$(stat -f -c '%f' $dir)
> > > +	x=0
> > > +	while [ $nr_free -gt 0 ] && [ $old_nr_free != $nr_free ]; do
> > > +		$XFS_IO_PROG -f -c "pwrite -b 4194304 0 $((blksz * nr_free))" $dir/eat_my_space.$((x++))
> > 
> > blksz not defined in the function.
> > 
> > Xiaoguang Wang did something similar back in Nov. and I'm still queuing
> > his patch. (His 1/2 patch conflicts with your scrub/repair patchset and
> > it might be easier for you to let your patches go first.)
> > 
> > generic: make 17[1-4] work well when btrfs compression is enabled
> > https://patchwork.kernel.org/patch/9408451/
> > 
> > Does this patch work for you? If so, perhaps you only need to update
> > generic/282 using the "_fill_fs" helper?
> 
> Aha!  I had this feeling in the back of my head that someone was
> already trying to push a helper function.
> 
> At this point XFS online scrub/repair is slipping to 4.11 anyway so you
> may as well take Xioguang's patches and I'll just rebase all my stuff
> off of that.

Ok, thanks!

Eryu

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

* Re: [PATCH 1/7] ocfs2: test reflinking to inline data files
  2016-12-13  3:20       ` Eryu Guan
@ 2016-12-13  7:11           ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-13  7:11 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Tue, Dec 13, 2016 at 11:20:57AM +0800, Eryu Guan wrote:
> On Mon, Dec 12, 2016 at 10:09:22AM -0800, Darrick J. Wong wrote:
> > On Mon, Dec 12, 2016 at 05:01:20PM +0800, Eryu Guan wrote:
> > > On Sun, Dec 11, 2016 at 01:52:51PM -0800, Darrick J. Wong wrote:
> > > > Make sure that we can handle reflinking from and to inline-data files.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > > ---
> > > >  common/reflink       |    2 +
> > > >  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > > >  tests/ocfs2/001.out  |   14 ++++++++
> > > >  tests/ocfs2/Makefile |   20 +++++++++++
> > > >  tests/ocfs2/group    |    1 +
> > > >  5 files changed, 124 insertions(+), 1 deletion(-)
> > > >  create mode 100755 tests/ocfs2/001
> > > >  create mode 100644 tests/ocfs2/001.out
> > > >  create mode 100644 tests/ocfs2/Makefile
> > > >  create mode 100644 tests/ocfs2/group
> > > > 
> > > > 
> > > > diff --git a/common/reflink b/common/reflink
> > > > index 9d51729..d048045 100644
> > > > --- a/common/reflink
> > > > +++ b/common/reflink
> > > > @@ -197,7 +197,7 @@ _cp_reflink() {
> > > >  	file1="$1"
> > > >  	file2="$2"
> > > >  
> > > > -	cp --reflink=always -p "$file1" "$file2"
> > > > +	cp --reflink=always -p -f "$file1" "$file2"
> > > 
> > > I'm still seeing "File exists" error with this patch, tested with your
> > > ocfs2-vfs-reflink-6 branch, compiled on openSUSE Tumbleweed.
> > > 
> > > FSTYP         -- ocfs2
> > > PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc8.djwong-ocfs2+
> > > MKFS_OPTIONS  -- --fs-features=local /dev/sda5
> > > MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> > > 
> > > ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
> > >     --- tests/ocfs2/001.out     2016-12-12 13:51:38.053909486 +0800
> > >     +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-12-12 16:49:35.038882697 +0800
> > >     @@ -1,14 +1,18 @@
> > >      QA output created by 001
> > >     +mkfs.ocfs2 1.8.4
> > 
> > I guess I'll have to neuter this on newer ocfs2-tools.  (Still running 1.6.4
> > here).
> 
> I have a patch pending on review that could fix & filter this, FYI
> 
> fstests: teach _scratch_mkfs to handle mkfs option conflicts
> https://www.spinics.net/lists/fstests/msg04550.html

<nod> I actually meant the printing of the mkfs version string.

> 
> > 
> > >      Format and mount
> > >      Create the original files
> > >      reflink into the start of file2
> > >     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> > >      reflink past the stuff in file3
> > >     ...
> > >     (Run 'diff -u tests/ocfs2/001.out /root/xfstests/results//ocfs2/ocfs2/001.out.bad'  to see the entire diff)
> > > 
> > > --- tests/ocfs2/001.out 2016-12-12 13:51:38.053909486 +0800
> > > +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad     2016-12-12 16:44:31.991943842 +0800
> > > @@ -1,14 +1,18 @@
> > >  QA output created by 001
> > > +mkfs.ocfs2 1.8.4
> > >  Format and mount
> > >  Create the original files
> > >  reflink into the start of file2
> > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> > >  reflink past the stuff in file3
> > >  reflink an inline-data file to a regular one
> > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
> > >  reflink an inline-data file to another inline-data file
> > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file6' from '/mnt/testarea/scratch/test-001/file4': File exists
> > >  Verify the whole mess
> > >  2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> > > -2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> > > +401b30e3b8b5d629635a5c613cdb7919  SCRATCH_MNT/test-001/file2
> > >  4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> > >  009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> > > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> > > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> > > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file5
> > > +60b725f10c9c85c70d97880dfe8191b3  SCRATCH_MNT/test-001/file6
> > > 
> > > I did the "reflink into the start of file2" test manually, and strace
> > > showed that it is file1 reports EEXIST.
> > > 
> > > open("/mnt/ocfs2/testfile1", O_RDONLY)  = 3
> > > fstat(3, {st_mode=S_IFREG|0600, st_size=65536, ...}) = 0
> > > ioctl(3, _IOC(_IOC_WRITE, 0x6f, 0x04, 0x18), 0x7ffc8daf09f0) = -1 EEXIST (File exists)
> > 
> > Wait, that's the ocfs2 reflink ioctl, not FICLONE.  Well that explains
> > why the functional parts of the tests fail.  I looked at latest coreutils
> > source, which does not use OCFS2_IOC_REFLINK, so I guess this must be an
> > opensuse thing?
> 
> Ok, I'll try a newer coreutils.

coreutils 8.26 (latest) doesn't have any OCFS2_IOC_REFLINK support; I
suspect a distro patch in the srpm or something....

--D

> 
> Thanks,
> Eryu
> --
> 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] 43+ messages in thread

* [Ocfs2-devel] [PATCH 1/7] ocfs2: test reflinking to inline data files
@ 2016-12-13  7:11           ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-13  7:11 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Tue, Dec 13, 2016 at 11:20:57AM +0800, Eryu Guan wrote:
> On Mon, Dec 12, 2016 at 10:09:22AM -0800, Darrick J. Wong wrote:
> > On Mon, Dec 12, 2016 at 05:01:20PM +0800, Eryu Guan wrote:
> > > On Sun, Dec 11, 2016 at 01:52:51PM -0800, Darrick J. Wong wrote:
> > > > Make sure that we can handle reflinking from and to inline-data files.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > > ---
> > > >  common/reflink       |    2 +
> > > >  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > > >  tests/ocfs2/001.out  |   14 ++++++++
> > > >  tests/ocfs2/Makefile |   20 +++++++++++
> > > >  tests/ocfs2/group    |    1 +
> > > >  5 files changed, 124 insertions(+), 1 deletion(-)
> > > >  create mode 100755 tests/ocfs2/001
> > > >  create mode 100644 tests/ocfs2/001.out
> > > >  create mode 100644 tests/ocfs2/Makefile
> > > >  create mode 100644 tests/ocfs2/group
> > > > 
> > > > 
> > > > diff --git a/common/reflink b/common/reflink
> > > > index 9d51729..d048045 100644
> > > > --- a/common/reflink
> > > > +++ b/common/reflink
> > > > @@ -197,7 +197,7 @@ _cp_reflink() {
> > > >  	file1="$1"
> > > >  	file2="$2"
> > > >  
> > > > -	cp --reflink=always -p "$file1" "$file2"
> > > > +	cp --reflink=always -p -f "$file1" "$file2"
> > > 
> > > I'm still seeing "File exists" error with this patch, tested with your
> > > ocfs2-vfs-reflink-6 branch, compiled on openSUSE Tumbleweed.
> > > 
> > > FSTYP         -- ocfs2
> > > PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc8.djwong-ocfs2+
> > > MKFS_OPTIONS  -- --fs-features=local /dev/sda5
> > > MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> > > 
> > > ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
> > >     --- tests/ocfs2/001.out     2016-12-12 13:51:38.053909486 +0800
> > >     +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-12-12 16:49:35.038882697 +0800
> > >     @@ -1,14 +1,18 @@
> > >      QA output created by 001
> > >     +mkfs.ocfs2 1.8.4
> > 
> > I guess I'll have to neuter this on newer ocfs2-tools.  (Still running 1.6.4
> > here).
> 
> I have a patch pending on review that could fix & filter this, FYI
> 
> fstests: teach _scratch_mkfs to handle mkfs option conflicts
> https://www.spinics.net/lists/fstests/msg04550.html

<nod> I actually meant the printing of the mkfs version string.

> 
> > 
> > >      Format and mount
> > >      Create the original files
> > >      reflink into the start of file2
> > >     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> > >      reflink past the stuff in file3
> > >     ...
> > >     (Run 'diff -u tests/ocfs2/001.out /root/xfstests/results//ocfs2/ocfs2/001.out.bad'  to see the entire diff)
> > > 
> > > --- tests/ocfs2/001.out 2016-12-12 13:51:38.053909486 +0800
> > > +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad     2016-12-12 16:44:31.991943842 +0800
> > > @@ -1,14 +1,18 @@
> > >  QA output created by 001
> > > +mkfs.ocfs2 1.8.4
> > >  Format and mount
> > >  Create the original files
> > >  reflink into the start of file2
> > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> > >  reflink past the stuff in file3
> > >  reflink an inline-data file to a regular one
> > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
> > >  reflink an inline-data file to another inline-data file
> > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file6' from '/mnt/testarea/scratch/test-001/file4': File exists
> > >  Verify the whole mess
> > >  2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> > > -2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> > > +401b30e3b8b5d629635a5c613cdb7919  SCRATCH_MNT/test-001/file2
> > >  4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> > >  009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> > > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> > > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> > > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file5
> > > +60b725f10c9c85c70d97880dfe8191b3  SCRATCH_MNT/test-001/file6
> > > 
> > > I did the "reflink into the start of file2" test manually, and strace
> > > showed that it is file1 reports EEXIST.
> > > 
> > > open("/mnt/ocfs2/testfile1", O_RDONLY)  = 3
> > > fstat(3, {st_mode=S_IFREG|0600, st_size=65536, ...}) = 0
> > > ioctl(3, _IOC(_IOC_WRITE, 0x6f, 0x04, 0x18), 0x7ffc8daf09f0) = -1 EEXIST (File exists)
> > 
> > Wait, that's the ocfs2 reflink ioctl, not FICLONE.  Well that explains
> > why the functional parts of the tests fail.  I looked at latest coreutils
> > source, which does not use OCFS2_IOC_REFLINK, so I guess this must be an
> > opensuse thing?
> 
> Ok, I'll try a newer coreutils.

coreutils 8.26 (latest) doesn't have any OCFS2_IOC_REFLINK support; I
suspect a distro patch in the srpm or something....

--D

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

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

* Re: [PATCH 1/7] ocfs2: test reflinking to inline data files
  2016-12-13  7:11           ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-13 21:35             ` Darrick J. Wong
  -1 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-13 21:35 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 11:11:36PM -0800, Darrick J. Wong wrote:
> On Tue, Dec 13, 2016 at 11:20:57AM +0800, Eryu Guan wrote:
> > On Mon, Dec 12, 2016 at 10:09:22AM -0800, Darrick J. Wong wrote:
> > > On Mon, Dec 12, 2016 at 05:01:20PM +0800, Eryu Guan wrote:
> > > > On Sun, Dec 11, 2016 at 01:52:51PM -0800, Darrick J. Wong wrote:
> > > > > Make sure that we can handle reflinking from and to inline-data files.
> > > > > 
> > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > > > ---
> > > > >  common/reflink       |    2 +
> > > > >  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > > > >  tests/ocfs2/001.out  |   14 ++++++++
> > > > >  tests/ocfs2/Makefile |   20 +++++++++++
> > > > >  tests/ocfs2/group    |    1 +
> > > > >  5 files changed, 124 insertions(+), 1 deletion(-)
> > > > >  create mode 100755 tests/ocfs2/001
> > > > >  create mode 100644 tests/ocfs2/001.out
> > > > >  create mode 100644 tests/ocfs2/Makefile
> > > > >  create mode 100644 tests/ocfs2/group
> > > > > 
> > > > > 
> > > > > diff --git a/common/reflink b/common/reflink
> > > > > index 9d51729..d048045 100644
> > > > > --- a/common/reflink
> > > > > +++ b/common/reflink
> > > > > @@ -197,7 +197,7 @@ _cp_reflink() {
> > > > >  	file1="$1"
> > > > >  	file2="$2"
> > > > >  
> > > > > -	cp --reflink=always -p "$file1" "$file2"
> > > > > +	cp --reflink=always -p -f "$file1" "$file2"
> > > > 
> > > > I'm still seeing "File exists" error with this patch, tested with your
> > > > ocfs2-vfs-reflink-6 branch, compiled on openSUSE Tumbleweed.
> > > > 
> > > > FSTYP         -- ocfs2
> > > > PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc8.djwong-ocfs2+
> > > > MKFS_OPTIONS  -- --fs-features=local /dev/sda5
> > > > MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> > > > 
> > > > ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
> > > >     --- tests/ocfs2/001.out     2016-12-12 13:51:38.053909486 +0800
> > > >     +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-12-12 16:49:35.038882697 +0800
> > > >     @@ -1,14 +1,18 @@
> > > >      QA output created by 001
> > > >     +mkfs.ocfs2 1.8.4
> > > 
> > > I guess I'll have to neuter this on newer ocfs2-tools.  (Still running 1.6.4
> > > here).
> > 
> > I have a patch pending on review that could fix & filter this, FYI
> > 
> > fstests: teach _scratch_mkfs to handle mkfs option conflicts
> > https://www.spinics.net/lists/fstests/msg04550.html
> 
> <nod> I actually meant the printing of the mkfs version string.
> 
> > 
> > > 
> > > >      Format and mount
> > > >      Create the original files
> > > >      reflink into the start of file2
> > > >     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> > > >      reflink past the stuff in file3
> > > >     ...
> > > >     (Run 'diff -u tests/ocfs2/001.out /root/xfstests/results//ocfs2/ocfs2/001.out.bad'  to see the entire diff)
> > > > 
> > > > --- tests/ocfs2/001.out 2016-12-12 13:51:38.053909486 +0800
> > > > +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad     2016-12-12 16:44:31.991943842 +0800
> > > > @@ -1,14 +1,18 @@
> > > >  QA output created by 001
> > > > +mkfs.ocfs2 1.8.4
> > > >  Format and mount
> > > >  Create the original files
> > > >  reflink into the start of file2
> > > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> > > >  reflink past the stuff in file3
> > > >  reflink an inline-data file to a regular one
> > > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
> > > >  reflink an inline-data file to another inline-data file
> > > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file6' from '/mnt/testarea/scratch/test-001/file4': File exists
> > > >  Verify the whole mess
> > > >  2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> > > > -2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> > > > +401b30e3b8b5d629635a5c613cdb7919  SCRATCH_MNT/test-001/file2
> > > >  4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> > > >  009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> > > > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> > > > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> > > > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file5
> > > > +60b725f10c9c85c70d97880dfe8191b3  SCRATCH_MNT/test-001/file6
> > > > 
> > > > I did the "reflink into the start of file2" test manually, and strace
> > > > showed that it is file1 reports EEXIST.
> > > > 
> > > > open("/mnt/ocfs2/testfile1", O_RDONLY)  = 3
> > > > fstat(3, {st_mode=S_IFREG|0600, st_size=65536, ...}) = 0
> > > > ioctl(3, _IOC(_IOC_WRITE, 0x6f, 0x04, 0x18), 0x7ffc8daf09f0) = -1 EEXIST (File exists)
> > > 
> > > Wait, that's the ocfs2 reflink ioctl, not FICLONE.  Well that explains
> > > why the functional parts of the tests fail.  I looked at latest coreutils
> > > source, which does not use OCFS2_IOC_REFLINK, so I guess this must be an
> > > opensuse thing?
> > 
> > Ok, I'll try a newer coreutils.
> 
> coreutils 8.26 (latest) doesn't have any OCFS2_IOC_REFLINK support; I
> suspect a distro patch in the srpm or something....

Confirmed.  SuSE's coreutils package has a patch that tries the ocfs2
reflink ioctl and bails out of cp without trying the btrfs/vfs clone
ioctl if the ocfs2 ioctl returns EEXIST.  I suppose that'll have to get
fixed in their coreutils package, but until then it'll just be broken.
:/

FWIW I also confirm that none of (upstream, RHEL, OL, Debian, or Ubuntu)
have this patch, so this shouldn't be a problem on any of them.

--D

> 
> --D
> 
> > 
> > Thanks,
> > Eryu
> > --
> > 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] 43+ messages in thread

* [Ocfs2-devel] [PATCH 1/7] ocfs2: test reflinking to inline data files
@ 2016-12-13 21:35             ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-13 21:35 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 11:11:36PM -0800, Darrick J. Wong wrote:
> On Tue, Dec 13, 2016 at 11:20:57AM +0800, Eryu Guan wrote:
> > On Mon, Dec 12, 2016 at 10:09:22AM -0800, Darrick J. Wong wrote:
> > > On Mon, Dec 12, 2016 at 05:01:20PM +0800, Eryu Guan wrote:
> > > > On Sun, Dec 11, 2016 at 01:52:51PM -0800, Darrick J. Wong wrote:
> > > > > Make sure that we can handle reflinking from and to inline-data files.
> > > > > 
> > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > > > ---
> > > > >  common/reflink       |    2 +
> > > > >  tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > > > >  tests/ocfs2/001.out  |   14 ++++++++
> > > > >  tests/ocfs2/Makefile |   20 +++++++++++
> > > > >  tests/ocfs2/group    |    1 +
> > > > >  5 files changed, 124 insertions(+), 1 deletion(-)
> > > > >  create mode 100755 tests/ocfs2/001
> > > > >  create mode 100644 tests/ocfs2/001.out
> > > > >  create mode 100644 tests/ocfs2/Makefile
> > > > >  create mode 100644 tests/ocfs2/group
> > > > > 
> > > > > 
> > > > > diff --git a/common/reflink b/common/reflink
> > > > > index 9d51729..d048045 100644
> > > > > --- a/common/reflink
> > > > > +++ b/common/reflink
> > > > > @@ -197,7 +197,7 @@ _cp_reflink() {
> > > > >  	file1="$1"
> > > > >  	file2="$2"
> > > > >  
> > > > > -	cp --reflink=always -p "$file1" "$file2"
> > > > > +	cp --reflink=always -p -f "$file1" "$file2"
> > > > 
> > > > I'm still seeing "File exists" error with this patch, tested with your
> > > > ocfs2-vfs-reflink-6 branch, compiled on openSUSE Tumbleweed.
> > > > 
> > > > FSTYP         -- ocfs2
> > > > PLATFORM      -- Linux/x86_64 bootp-73-5-234 4.9.0-rc8.djwong-ocfs2+
> > > > MKFS_OPTIONS  -- --fs-features=local /dev/sda5
> > > > MOUNT_OPTIONS -- /dev/sda5 /mnt/testarea/scratch
> > > > 
> > > > ocfs2/001        - output mismatch (see /root/xfstests/results//ocfs2/ocfs2/001.out.bad)
> > > >     --- tests/ocfs2/001.out     2016-12-12 13:51:38.053909486 +0800
> > > >     +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad 2016-12-12 16:49:35.038882697 +0800
> > > >     @@ -1,14 +1,18 @@
> > > >      QA output created by 001
> > > >     +mkfs.ocfs2 1.8.4
> > > 
> > > I guess I'll have to neuter this on newer ocfs2-tools.  (Still running 1.6.4
> > > here).
> > 
> > I have a patch pending on review that could fix & filter this, FYI
> > 
> > fstests: teach _scratch_mkfs to handle mkfs option conflicts
> > https://www.spinics.net/lists/fstests/msg04550.html
> 
> <nod> I actually meant the printing of the mkfs version string.
> 
> > 
> > > 
> > > >      Format and mount
> > > >      Create the original files
> > > >      reflink into the start of file2
> > > >     +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> > > >      reflink past the stuff in file3
> > > >     ...
> > > >     (Run 'diff -u tests/ocfs2/001.out /root/xfstests/results//ocfs2/ocfs2/001.out.bad'  to see the entire diff)
> > > > 
> > > > --- tests/ocfs2/001.out 2016-12-12 13:51:38.053909486 +0800
> > > > +++ /root/xfstests/results//ocfs2/ocfs2/001.out.bad     2016-12-12 16:44:31.991943842 +0800
> > > > @@ -1,14 +1,18 @@
> > > >  QA output created by 001
> > > > +mkfs.ocfs2 1.8.4
> > > >  Format and mount
> > > >  Create the original files
> > > >  reflink into the start of file2
> > > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file2' from '/mnt/testarea/scratch/test-001/file1': File exists
> > > >  reflink past the stuff in file3
> > > >  reflink an inline-data file to a regular one
> > > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file5' from '/mnt/testarea/scratch/test-001/file4': File exists
> > > >  reflink an inline-data file to another inline-data file
> > > > +cp: failed to reflink '/mnt/testarea/scratch/test-001/file6' from '/mnt/testarea/scratch/test-001/file4': File exists
> > > >  Verify the whole mess
> > > >  2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
> > > > -2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
> > > > +401b30e3b8b5d629635a5c613cdb7919  SCRATCH_MNT/test-001/file2
> > > >  4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
> > > >  009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
> > > > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
> > > > -009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
> > > > +2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file5
> > > > +60b725f10c9c85c70d97880dfe8191b3  SCRATCH_MNT/test-001/file6
> > > > 
> > > > I did the "reflink into the start of file2" test manually, and strace
> > > > showed that it is file1 reports EEXIST.
> > > > 
> > > > open("/mnt/ocfs2/testfile1", O_RDONLY)  = 3
> > > > fstat(3, {st_mode=S_IFREG|0600, st_size=65536, ...}) = 0
> > > > ioctl(3, _IOC(_IOC_WRITE, 0x6f, 0x04, 0x18), 0x7ffc8daf09f0) = -1 EEXIST (File exists)
> > > 
> > > Wait, that's the ocfs2 reflink ioctl, not FICLONE.  Well that explains
> > > why the functional parts of the tests fail.  I looked at latest coreutils
> > > source, which does not use OCFS2_IOC_REFLINK, so I guess this must be an
> > > opensuse thing?
> > 
> > Ok, I'll try a newer coreutils.
> 
> coreutils 8.26 (latest) doesn't have any OCFS2_IOC_REFLINK support; I
> suspect a distro patch in the srpm or something....

Confirmed.  SuSE's coreutils package has a patch that tries the ocfs2
reflink ioctl and bails out of cp without trying the btrfs/vfs clone
ioctl if the ocfs2 ioctl returns EEXIST.  I suppose that'll have to get
fixed in their coreutils package, but until then it'll just be broken.
:/

FWIW I also confirm that none of (upstream, RHEL, OL, Debian, or Ubuntu)
have this patch, so this shouldn't be a problem on any of them.

--D

> 
> --D
> 
> > 
> > Thanks,
> > Eryu
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo at 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 at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 7/7] xfs/ext4: check negative inode size
  2016-12-12 11:07   ` Eryu Guan
@ 2016-12-13 21:49       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-13 21:49 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 07:07:21PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:53:28PM -0800, Darrick J. Wong wrote:
> > Craft a malicious filesystem image with a negative inode size,
> > then try to trigger a kernel DoS by appending data to the file.
> > Ideally this should trigger verifier errors instead of hanging.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/ext4/400   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ext4/401   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ext4/group |    2 ++
> >  tests/xfs/400    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/401    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/group  |    2 ++
> >  6 files changed, 290 insertions(+)
> >  create mode 100755 tests/ext4/400
> >  create mode 100755 tests/ext4/401
> >  create mode 100755 tests/xfs/400
> >  create mode 100755 tests/xfs/401
> > 
> > 
> > diff --git a/tests/ext4/400 b/tests/ext4/400
> > new file mode 100755
> > index 0000000..5857549
> > --- /dev/null
> > +++ b/tests/ext4/400
> > @@ -0,0 +1,71 @@
> > +#! /bin/bash
> > +# FSQA Test No. 400
> > +#
> > +# Since loff_t is a signed type, it is invalid for a filesystem to load
> > +# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
> > +# which means that we can trivially DoS the VFS by creating such a file
> > +# and appending to it.  This causes an integer overflow in the routines
> > +# underlying writeback, which results in the kernel locking up.
> 
> The only difference between ext4/400 and ext4/401 is that 400 makes
> i_size=-1 and 401 makes it 0xFFFFFFFFFFFFFE00, while xfs/400 and xfs/401
> both create XFS with i_size -1. Is 0xFFFFFFFFFFFFFE00 a typo? Or update
> the description accordingly if they are two different tests?

The 0xFFFFFFFFFFFFFE00 rounds the file size down to a multiple of 512
so that we can do the directio... which means that xfs/401 is buggy.
Good catch!

Hmmm, no golden output either.  WTF? :)

> And I noticed that 400 is doing buffered I/O and 401 is doing direct
> I/O, can the two be folded in one test?

<shrug> They're testing different code paths (at least with pre-iomap
filesystems) so I prefer they stay separate.

> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016-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"
> > +
> > +PIDS=""
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs ext2 ext3 ext4
> 
> Then it belongs to shared :)

Ah, so that's what tests/shared/ is for.  I've been wondering that for
a long time.

--D

> Thanks,
> Eryu
> --
> 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] 43+ messages in thread

* [Ocfs2-devel] [PATCH 7/7] xfs/ext4: check negative inode size
@ 2016-12-13 21:49       ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2016-12-13 21:49 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ocfs2-devel, fstests

On Mon, Dec 12, 2016 at 07:07:21PM +0800, Eryu Guan wrote:
> On Sun, Dec 11, 2016 at 01:53:28PM -0800, Darrick J. Wong wrote:
> > Craft a malicious filesystem image with a negative inode size,
> > then try to trigger a kernel DoS by appending data to the file.
> > Ideally this should trigger verifier errors instead of hanging.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/ext4/400   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ext4/401   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/ext4/group |    2 ++
> >  tests/xfs/400    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/401    |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/group  |    2 ++
> >  6 files changed, 290 insertions(+)
> >  create mode 100755 tests/ext4/400
> >  create mode 100755 tests/ext4/401
> >  create mode 100755 tests/xfs/400
> >  create mode 100755 tests/xfs/401
> > 
> > 
> > diff --git a/tests/ext4/400 b/tests/ext4/400
> > new file mode 100755
> > index 0000000..5857549
> > --- /dev/null
> > +++ b/tests/ext4/400
> > @@ -0,0 +1,71 @@
> > +#! /bin/bash
> > +# FSQA Test No. 400
> > +#
> > +# Since loff_t is a signed type, it is invalid for a filesystem to load
> > +# an inode with i_size = -1ULL.  Unfortunately, nobody checks this,
> > +# which means that we can trivially DoS the VFS by creating such a file
> > +# and appending to it.  This causes an integer overflow in the routines
> > +# underlying writeback, which results in the kernel locking up.
> 
> The only difference between ext4/400 and ext4/401 is that 400 makes
> i_size=-1 and 401 makes it 0xFFFFFFFFFFFFFE00, while xfs/400 and xfs/401
> both create XFS with i_size -1. Is 0xFFFFFFFFFFFFFE00 a typo? Or update
> the description accordingly if they are two different tests?

The 0xFFFFFFFFFFFFFE00 rounds the file size down to a multiple of 512
so that we can do the directio... which means that xfs/401 is buggy.
Good catch!

Hmmm, no golden output either.  WTF? :)

> And I noticed that 400 is doing buffered I/O and 401 is doing direct
> I/O, can the two be folded in one test?

<shrug> They're testing different code paths (at least with pre-iomap
filesystems) so I prefer they stay separate.

> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016-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"
> > +
> > +PIDS=""
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +	rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +_supported_os Linux
> > +_supported_fs ext2 ext3 ext4
> 
> Then it belongs to shared :)

Ah, so that's what tests/shared/ is for.  I've been wondering that for
a long time.

--D

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

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

* Re: [PATCH 1/7] ocfs2: test reflinking to inline data files
  2016-12-13 21:35             ` [Ocfs2-devel] " Darrick J. Wong
@ 2016-12-14  7:32               ` Eric Ren
  -1 siblings, 0 replies; 43+ messages in thread
From: Eric Ren @ 2016-12-14  7:32 UTC (permalink / raw)
  To: Darrick J. Wong, Eryu Guan; +Cc: ocfs2-devel, fstests

Hi!

On 12/14/2016 05:35 AM, Darrick J. Wong wrote:
> On Mon, Dec 12, 2016 at 11:11:36PM -0800, Darrick J. Wong wrote:
>> coreutils 8.26 (latest) doesn't have any OCFS2_IOC_REFLINK support; I
>> suspect a distro patch in the srpm or something....
> Confirmed.  SuSE's coreutils package has a patch that tries the ocfs2
> reflink ioctl and bails out of cp without trying the btrfs/vfs clone
> ioctl if the ocfs2 ioctl returns EEXIST.  I suppose that'll have to get
> fixed in their coreutils package, but until then it'll just be broken.
> :/
>
> FWIW I also confirm that none of (upstream, RHEL, OL, Debian, or Ubuntu)
> have this patch, so this shouldn't be a problem on any of them.

I'm going to fix this issue for openSUSE. Thanks for your guys' efforts!

Thanks!
Eric
>
> --D
>
>> --D
>>
>>> Thanks,
>>> Eryu
>>> --
>>> 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 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] 43+ messages in thread

* [Ocfs2-devel] [PATCH 1/7] ocfs2: test reflinking to inline data files
@ 2016-12-14  7:32               ` Eric Ren
  0 siblings, 0 replies; 43+ messages in thread
From: Eric Ren @ 2016-12-14  7:32 UTC (permalink / raw)
  To: Darrick J. Wong, Eryu Guan; +Cc: ocfs2-devel, fstests

Hi!

On 12/14/2016 05:35 AM, Darrick J. Wong wrote:
> On Mon, Dec 12, 2016 at 11:11:36PM -0800, Darrick J. Wong wrote:
>> coreutils 8.26 (latest) doesn't have any OCFS2_IOC_REFLINK support; I
>> suspect a distro patch in the srpm or something....
> Confirmed.  SuSE's coreutils package has a patch that tries the ocfs2
> reflink ioctl and bails out of cp without trying the btrfs/vfs clone
> ioctl if the ocfs2 ioctl returns EEXIST.  I suppose that'll have to get
> fixed in their coreutils package, but until then it'll just be broken.
> :/
>
> FWIW I also confirm that none of (upstream, RHEL, OL, Debian, or Ubuntu)
> have this patch, so this shouldn't be a problem on any of them.

I'm going to fix this issue for openSUSE. Thanks for your guys' efforts!

Thanks!
Eric
>
> --D
>
>> --D
>>
>>> Thanks,
>>> Eryu
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>>> the body of a message to majordomo at 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 at 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 at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* [PATCH 1/7] ocfs2: test reflinking to inline data files
  2017-01-05  1:04 [PATCH 0/7] xfstests: misc reflink test fixes Darrick J. Wong
@ 2017-01-05  1:04 ` Darrick J. Wong
  0 siblings, 0 replies; 43+ messages in thread
From: Darrick J. Wong @ 2017-01-05  1:04 UTC (permalink / raw)
  To: eguan, darrick.wong; +Cc: linux-xfs, fstests

Make sure that we can handle reflinking from and to inline-data files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/reflink       |    2 +
 tests/ocfs2/001      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ocfs2/001.out  |   14 ++++++++
 tests/ocfs2/Makefile |   20 +++++++++++
 tests/ocfs2/group    |    1 +
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100755 tests/ocfs2/001
 create mode 100644 tests/ocfs2/001.out
 create mode 100644 tests/ocfs2/Makefile
 create mode 100644 tests/ocfs2/group


diff --git a/common/reflink b/common/reflink
index 64ee04f..55d82ac 100644
--- a/common/reflink
+++ b/common/reflink
@@ -206,7 +206,7 @@ _cp_reflink() {
 	file1="$1"
 	file2="$2"
 
-	cp --reflink=always -p "$file1" "$file2"
+	cp --reflink=always -p -f "$file1" "$file2"
 }
 
 # Reflink some file1 into file2
diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
new file mode 100755
index 0000000..1cd9dc5
--- /dev/null
+++ b/tests/ocfs2/001
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 001
+#
+# Ensure that reflink works correctly with inline-data files.
+#
+#-----------------------------------------------------------------------
+# 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 ocfs2
+_require_scratch_reflink
+_require_cp_reflink
+
+rm -f $seqres.full
+
+echo "Format and mount"
+_scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1
+tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
+	_notrun "Inline data is not supported."
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT/test-$seq
+mkdir $testdir
+
+sz=65536
+echo "Create the original files"
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
+echo x > $testdir/file2
+echo x > $testdir/file3
+echo y > $testdir/file4
+$XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file5 >> $seqres.full
+echo a > $testdir/file6
+_scratch_cycle_mount
+
+echo "reflink into the start of file2"
+_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
+
+echo "reflink past the stuff in file3"
+_reflink_range $testdir/file1 0 $testdir/file3 $sz $sz >> $seqres.full
+
+echo "reflink an inline-data file to a regular one"
+_cp_reflink $testdir/file4 $testdir/file5 >> $seqres.full
+
+echo "reflink an inline-data file to another inline-data file"
+_cp_reflink $testdir/file4 $testdir/file6 >> $seqres.full
+
+echo "Verify the whole mess"
+_scratch_cycle_mount
+md5sum $testdir/file* | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/ocfs2/001.out b/tests/ocfs2/001.out
new file mode 100644
index 0000000..99fa43a
--- /dev/null
+++ b/tests/ocfs2/001.out
@@ -0,0 +1,14 @@
+QA output created by 001
+Format and mount
+Create the original files
+reflink into the start of file2
+reflink past the stuff in file3
+reflink an inline-data file to a regular one
+reflink an inline-data file to another inline-data file
+Verify the whole mess
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file1
+2d61aa54b58c2e94403fb092c3dbc027  SCRATCH_MNT/test-001/file2
+4e68a2e24b6b0f386ab39d01d902293d  SCRATCH_MNT/test-001/file3
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file4
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file5
+009520053b00386d1173f3988c55d192  SCRATCH_MNT/test-001/file6
diff --git a/tests/ocfs2/Makefile b/tests/ocfs2/Makefile
new file mode 100644
index 0000000..e133790
--- /dev/null
+++ b/tests/ocfs2/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2017 Oracle.  All Rights Reserved.
+#
+
+TOPDIR = ../..
+include $(TOPDIR)/include/builddefs
+
+OCFS2_DIR = ocfs2
+TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(OCFS2_DIR)
+
+include $(BUILDRULES)
+
+install:
+	$(INSTALL) -m 755 -d $(TARGET_DIR)
+	$(INSTALL) -m 755 $(TESTS) $(TARGET_DIR)
+	$(INSTALL) -m 644 group $(TARGET_DIR)
+	$(INSTALL) -m 644 $(OUTFILES) $(TARGET_DIR)
+
+# Nothing.
+install-dev install-lib:
diff --git a/tests/ocfs2/group b/tests/ocfs2/group
new file mode 100644
index 0000000..28e6807
--- /dev/null
+++ b/tests/ocfs2/group
@@ -0,0 +1 @@
+001 auto quick clone


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

end of thread, other threads:[~2017-01-05  1:04 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-11 21:52 [PATCH 0/7] xfstests: misc reflink test fixes Darrick J. Wong
2016-12-11 21:52 ` [Ocfs2-devel] " Darrick J. Wong
2016-12-11 21:52 ` [PATCH 1/7] ocfs2: test reflinking to inline data files Darrick J. Wong
2016-12-11 21:52   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-12  9:01   ` Eryu Guan
2016-12-12 18:09     ` Darrick J. Wong
2016-12-12 18:09       ` [Ocfs2-devel] " Darrick J. Wong
2016-12-13  3:20       ` Eryu Guan
2016-12-13  7:11         ` Darrick J. Wong
2016-12-13  7:11           ` [Ocfs2-devel] " Darrick J. Wong
2016-12-13 21:35           ` Darrick J. Wong
2016-12-13 21:35             ` [Ocfs2-devel] " Darrick J. Wong
2016-12-14  7:32             ` Eric Ren
2016-12-14  7:32               ` [Ocfs2-devel] " Eric Ren
2016-12-11 21:52 ` [PATCH 2/7] ocfs2/reflink: fix file block size reporting Darrick J. Wong
2016-12-11 21:52   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-12  9:48   ` Eryu Guan
2016-12-12 23:08     ` Darrick J. Wong
2016-12-12 23:08       ` [Ocfs2-devel] " Darrick J. Wong
2016-12-11 21:53 ` [PATCH 3/7] reflink: fix quota tests to work properly Darrick J. Wong
2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-12 10:06   ` Eryu Guan
2016-12-12 23:08     ` Darrick J. Wong
2016-12-12 23:08       ` [Ocfs2-devel] " Darrick J. Wong
2016-12-11 21:53 ` [PATCH 4/7] reflink: fix space consumption tests Darrick J. Wong
2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-12 10:25   ` Eryu Guan
2016-12-12 23:03     ` Darrick J. Wong
2016-12-12 23:03       ` [Ocfs2-devel] " Darrick J. Wong
2016-12-13  3:22       ` Eryu Guan
2016-12-11 21:53 ` [PATCH 5/7] reflink: make error reporting consistent Darrick J. Wong
2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-12 10:47   ` Eryu Guan
2016-12-12 23:06     ` Darrick J. Wong
2016-12-12 23:06       ` [Ocfs2-devel] " Darrick J. Wong
2016-12-11 21:53 ` [PATCH 6/7] reflink: don't test disjoint block sharing sets Darrick J. Wong
2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-11 21:53 ` [PATCH 7/7] xfs/ext4: check negative inode size Darrick J. Wong
2016-12-11 21:53   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-12 11:07   ` Eryu Guan
2016-12-13 21:49     ` Darrick J. Wong
2016-12-13 21:49       ` [Ocfs2-devel] " Darrick J. Wong
2017-01-05  1:04 [PATCH 0/7] xfstests: misc reflink test fixes Darrick J. Wong
2017-01-05  1:04 ` [PATCH 1/7] ocfs2: test reflinking to inline data files Darrick J. Wong

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.