From: Zorro Lang <zlang@redhat.com>
To: fstests@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, Zorro Lang <zlang@redhat.com>
Subject: [PATCH] fstests: test xfs_copy V5 XFS without -d option
Date: Wed, 21 Sep 2016 19:00:20 +0800 [thread overview]
Message-ID: <1474455620-25982-1-git-send-email-zlang@redhat.com> (raw)
>From linux v4.3 and xfsprogs v4.2, xfs_copy support to copy a V5 XFS.
Before that, copy a V5 XFS will cause target fs corruption, and only
use "-d" option can resolve that problem.
For this old reason, xfstests use below patch to add '-d' option to
xfs_copy, make sure xfs_copy always use that option if it try to copy
a V5 XFS:
8346e53 common: append -d option to XFS_COPY_PROG when testing v5 xfs
But xfs_copy full support v5 xfs now. So xfstest miss the coverage of
copy a V5 XFS without '-d'. For test this feature I did below things:
1. Revert commit 8346e53
2. Add a new common function _require_xfs_copy(), if a test try to
use old xfsprogs to copy a V5 xfs, it'll skip that test.
3. Add above common function into all xfs_copy related cases.
4. xfs/073 test V4 xfs forcibly by specify "-m crc=0" in case. I
think it's useless now, so remove it.
There's a xfs_copy related case I didn't add _require_xfs_copy()
to it -- xfs/032, due to it tests "xfs_copy -d" directly.
Signed-off-by: Zorro Lang <zlang@redhat.com>
---
common/rc | 27 ++++++++++++++++++++++-----
tests/xfs/073 | 9 +++------
tests/xfs/077 | 1 +
3 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/common/rc b/common/rc
index 13afc6a..9ba073b 100644
--- a/common/rc
+++ b/common/rc
@@ -3789,11 +3789,6 @@ init_rc()
# Figure out if we need to add -F ("foreign", deprecated) option to xfs_io
xfs_io -c stat $TEST_DIR 2>&1 | grep -q "is not on an XFS filesystem" && \
export XFS_IO_PROG="$XFS_IO_PROG -F"
-
- # xfs_copy doesn't work on v5 xfs yet without -d option
- if [ "$FSTYP" == "xfs" ] && [[ $MKFS_OPTIONS =~ crc=1 ]]; then
- export XFS_COPY_PROG="$XFS_COPY_PROG -d"
- fi
}
# get real device path name by following link
@@ -3994,6 +3989,28 @@ _require_xfs_mkfs_without_validation()
fi
}
+# Make sure xfs_copy full support to copy V5 XFS, due to old xfs_copy can't
+# yet copy V5 xfs without '-d'. But if xfs_copy can't copy V4 XFS, that's a
+# bug.
+_require_xfs_copy()
+{
+ _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+ . $tmp.mkfs
+
+ ${XFS_COPY_PROG} $SCRATCH_DEV $tmp.copy >/dev/null 2>&1
+ local rc=$?
+
+ rm -f $tmp.mkfs
+ rm -f $tmp.copy 2>/dev/null
+ if [ $rc -ne 0 ]; then
+ if [ $_fs_has_crcs -eq 1 ]; then
+ _notrun "This test requires xfs_copy support to copy V5 xfs without -d"
+ else
+ _fail "xfs_copy can't copy a V4 xfs"
+ fi
+ fi
+}
+
init_rc
################################################################################
diff --git a/tests/xfs/073 b/tests/xfs/073
index 9e29223..02e45d5 100755
--- a/tests/xfs/073
+++ b/tests/xfs/073
@@ -134,11 +134,12 @@ _require_attrs
[ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
_require_scratch
+_require_xfs_copy
_require_loop
rm -f $seqres.full
-_scratch_mkfs_xfs -m crc=0 -dsize=41m,agcount=2 >>$seqres.full 2>&1
+_scratch_mkfs_xfs -dsize=41m,agcount=2 >>$seqres.full 2>&1
_scratch_mount 2>/dev/null || _fail "initial scratch mount failed"
echo
@@ -158,11 +159,7 @@ _verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
echo
echo === copying scratch device to single target, large ro device
-mkfs_crc_opts="-m crc=0"
-if [ -n "$XFS_MKFS_HAS_NO_META_SUPPORT" ]; then
- mkfs_crc_opts=""
-fi
-${MKFS_XFS_PROG} $mkfs_crc_opts -dfile,name=$imgs.source,size=100g \
+${MKFS_XFS_PROG} -dfile,name=$imgs.source,size=100g \
| _filter_mkfs 2>/dev/null
rmdir $imgs.source_dir 2>/dev/null
mkdir $imgs.source_dir
diff --git a/tests/xfs/077 b/tests/xfs/077
index 007d05d..7bcbfb5 100755
--- a/tests/xfs/077
+++ b/tests/xfs/077
@@ -51,6 +51,7 @@ _cleanup()
_supported_fs xfs
_supported_os Linux
_require_scratch
+_require_xfs_copy
_require_xfs_crc
_require_meta_uuid
--
2.7.4
next reply other threads:[~2016-09-21 11:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-21 11:00 Zorro Lang [this message]
2016-09-21 15:03 ` [PATCH] fstests: test xfs_copy V5 XFS without -d option Eryu Guan
2016-09-21 21:37 ` Dave Chinner
2016-09-21 22:07 ` Eric Sandeen
2016-09-21 23:39 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474455620-25982-1-git-send-email-zlang@redhat.com \
--to=zlang@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox