lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 29 Jun 2015 21:16:28 -0700
From:	"Darrick J. Wong" <darrick.wong@...cle.com>
To:	david@...morbit.com, darrick.wong@...cle.com
Cc:	linux-ext4@...r.kernel.org, linux-btrfs@...r.kernel.org,
	fstests@...r.kernel.org, xfs@....sgi.com
Subject: [PATCH 10/11] test xfs-specific reflink pieces

Check that growfs and xfs_fsr still work properly on reflinked fses.

Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
 tests/xfs/800     |   77 ++++++++++++++++++++++++++++++++++++
 tests/xfs/800.out |    5 ++
 tests/xfs/801     |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/801.out |   15 +++++++
 tests/xfs/group   |    2 +
 5 files changed, 213 insertions(+)
 create mode 100755 tests/xfs/800
 create mode 100644 tests/xfs/800.out
 create mode 100755 tests/xfs/801
 create mode 100644 tests/xfs/801.out


diff --git a/tests/xfs/800 b/tests/xfs/800
new file mode 100755
index 0000000..62b431a
--- /dev/null
+++ b/tests/xfs/800
@@ -0,0 +1,77 @@
+#! /bin/bash
+# FS QA Test No. 800
+#
+# Tests xfs_growfs on a reflinked filesystem
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_scratch_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+
+echo "Format and mount"
+_scratch_mkfs -d size=$((2 * 4096 * 4096)) -l size=4194304 > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file and reflink to copy1, copy2"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR/original \
+    >> $seqres.full 2>&1
+cp --reflink $TESTDIR/original $TESTDIR/copy1
+cp --reflink $TESTDIR/copy1 $TESTDIR/copy2
+
+echo "Grow fs"
+$XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 |  _filter_growfs >> $seqres.full
+
+xfs_info $SCRATCH_MNT >> $seqres.full
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/800.out b/tests/xfs/800.out
new file mode 100644
index 0000000..280daa5
--- /dev/null
+++ b/tests/xfs/800.out
@@ -0,0 +1,5 @@
+QA output created by 800
+Format and mount
+Create the original file and reflink to copy1, copy2
+Grow fs
+Check scratch fs
diff --git a/tests/xfs/801 b/tests/xfs/801
new file mode 100755
index 0000000..5a75e5f
--- /dev/null
+++ b/tests/xfs/801
@@ -0,0 +1,114 @@
+#! /bin/bash
+# FS QA Test No. 801
+#
+# Ensure that xfs_fsr un-reflinks files while defragmenting
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. common/rc
+. common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_scratch_reflink
+_supported_os Linux
+
+_require_xfs_io_command "fiemap"
+_require_cp_reflink
+
+echo "Format and mount"
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+TESTDIR=$SCRATCH_MNT/test-$seq
+rm -rf $TESTDIR
+mkdir $TESTDIR
+
+echo "Create the original file and reflink to copy1, copy2"
+$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 66000' $TESTDIR/original \
+    >> $seqres.full 2>&1
+cp --reflink $TESTDIR/original $TESTDIR/copy1
+cp --reflink $TESTDIR/copy1 $TESTDIR/copy2
+cp --reflink $TESTDIR/copy2 $TESTDIR/copy3
+
+echo "CoW the reflink copies"
+$XFS_IO_PROG -f -c 'pwrite -S 0x62 0 4096' $TESTDIR/copy1 >> $seqres.full
+$XFS_IO_PROG -f -c 'pwrite -S 0x63 0 4096' $TESTDIR/copy2 >> $seqres.full
+sync
+
+echo "Defragment"
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 >> $seqres.full
+lsattr -l $TESTDIR/ | sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
+xfs_fsr -v -d $TESTDIR/original >> $seqres.full
+xfs_fsr -v -d $TESTDIR/copy1 >> $seqres.full
+xfs_fsr -v -d $TESTDIR/copy2 >> $seqres.full
+xfs_fsr -v -d $TESTDIR/copy3 >> $seqres.full
+
+echo "Check fiemap"
+lsattr -l $TESTDIR/ | sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original | tail -n +2) \
+       <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 | tail -n +2) \
+       || echo "Sections should match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original | tail -n +2) \
+       <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 | tail -n +2) \
+       && echo "Sections shouldn't match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original | tail -n +2) \
+       <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 | tail -n +2) \
+       && echo "Sections shouldn't match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 | tail -n +2) \
+       <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 | tail -n +2) \
+       && echo "Sections shouldn't match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 | tail -n +2) \
+       <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 | tail -n +2) \
+       && echo "Sections shouldn't match"
+cmp -s <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 | tail -n +2) \
+       <($XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 | tail -n +2) \
+       && echo "Sections shouldn't match"
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/original >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy1 >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy2 >> $seqres.full
+$XFS_IO_PROG -f -c 'fiemap -v' $TESTDIR/copy3 >> $seqres.full
+
+echo "Check scratch fs"
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/801.out b/tests/xfs/801.out
new file mode 100644
index 0000000..74e7757
--- /dev/null
+++ b/tests/xfs/801.out
@@ -0,0 +1,15 @@
+QA output created by 801
+Format and mount
+Create the original file and reflink to copy1, copy2
+CoW the reflink copies
+Defragment
+SCRATCH_MNT/test-801/original       ---
+SCRATCH_MNT/test-801/copy1          ---
+SCRATCH_MNT/test-801/copy2          ---
+SCRATCH_MNT/test-801/copy3          ---
+Check fiemap
+SCRATCH_MNT/test-801/original       ---
+SCRATCH_MNT/test-801/copy1          No_COW
+SCRATCH_MNT/test-801/copy2          No_COW
+SCRATCH_MNT/test-801/copy3          ---
+Check scratch fs
diff --git a/tests/xfs/group b/tests/xfs/group
index c12b90a..db0694e 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -193,3 +193,5 @@
 304 auto quick quota
 305 auto quota
 700 fuzzers
+800 auto quick clone
+801 auto quick clone

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ