fstests: test xfs_copy V5 XFS without -d option

Before xfsprogs commit a872b62 (xfs_copy: band-aids for CRC
filesystems), xfs_copy requires the "-d" option to copy a V5 XFS,
because it can't rewrite the UUID of V5 XFS properly.

Now xfs_copy already full support to copy a V5 XFS. But for above
old problem, xfstests use below patch to make sure xfs_copy always
use "-d" option to copy a V5 XFS:

  8346e53 common: append -d option to XFS_COPY_PROG when testing v5 xfs

That cause xfstests miss the coverage of copying a V5 XFS without
"-d". For test this feature I did below things:

  1. Changed init_rc(), add "-d" to $XFS_COPY_PROG if xfs_copy can't
     copy a V5 XFS properly.
  2. xfs/073 test V4 xfs forcibly by specify "-m crc=0" in case. I
     think it's useless now, so remove it.
  3. Changed xfs/032. If xfs_copy full support to copy a V5 XFS, test
     with and without "-d" option, or only test with "-d" option.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Zorro Lang
2016-11-08 13:33:50 +08:00
committed by Eryu Guan
parent 5e885bfedb
commit 08adb2554e
3 changed files with 29 additions and 14 deletions
+11 -3
View File
@@ -3819,9 +3819,17 @@ init_rc()
$XFS_IO_PROG -i -c quit 2>/dev/null && \
export XFS_IO_PROG="$XFS_IO_PROG -i"
# 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"
# xfs_copy on v5 filesystems do not require the "-d" option if xfs_db
# can change the UUID on v5 filesystems
if [ "$FSTYP" == "xfs" ]; then
touch /tmp/$$.img
$MKFS_XFS_PROG -d file,name=/tmp/$$.img,size=512m >/dev/null 2>&1
# xfs_db will return 0 even if it can't generate a new uuid, so
# check the output to make sure if it can change UUID of V5 xfs
$XFS_DB_PROG -x -c "uuid generate" /tmp/$$.img \
| grep -q "invalid UUID\|supported on V5 fs" \
&& export XFS_COPY_PROG="$XFS_COPY_PROG -d"
rm -f /tmp/$$.img
fi
}