From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, zlang@redhat.com, fdmanana@kernel.org
Subject: Re: [PATCH v2 1/2] shared: move btrfs clone device testcase to the shared group
Date: Tue, 9 Apr 2024 22:43:30 +0800 [thread overview]
Message-ID: <eac13a6a-4c7a-458b-8577-ffd2846df63e@oracle.com> (raw)
In-Reply-To: <440eff6d16407f12ec55df69db283ba6eb9b278c.1710599671.git.anand.jain@oracle.com>
Thanks for the comments and opinions. In v3, the patch is back to
the generic group. It is also limited by:
supported_fs generic
require_duplicate_fsid
Thanks, Anand
On 3/17/24 01:02, Anand Jain wrote:
> Given that ext4 also allows mounting of a cloned filesystem, the btrfs
> test case btrfs/312, which assesses the functionality of cloned filesystem
> support, can be refactored to be under the shared group.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> v2:
> Move to shared testcase instead of generic.
> Add _require_block_device $TEST_DEV.
> Add _require_duplicated_fsid.
>
> common/rc | 14 +++++++
> tests/btrfs/312 | 78 --------------------------------------
> tests/btrfs/312.out | 19 ----------
> tests/shared/001 | 89 ++++++++++++++++++++++++++++++++++++++++++++
> tests/shared/001.out | 4 ++
> 5 files changed, 107 insertions(+), 97 deletions(-)
> delete mode 100755 tests/btrfs/312
> delete mode 100644 tests/btrfs/312.out
> create mode 100755 tests/shared/001
> create mode 100644 tests/shared/001.out
>
> diff --git a/common/rc b/common/rc
> index 36cad89cfc5d..2638dfb8e9b3 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -5408,6 +5408,20 @@ _random_file() {
> echo "$basedir/$(ls -U $basedir | shuf -n 1)"
> }
>
> +_require_duplicate_fsid()
> +{
> + case "$FSTYP" in
> + "btrfs")
> + _require_btrfs_fs_feature temp_fsid
> + ;;
> + "ext4")
> + ;;
> + *)
> + _notrun "$FSTYP cannot support mounting with duplicate fsid"
> + ;;
> + esac
> +}
> +
> init_rc
>
> ################################################################################
> diff --git a/tests/btrfs/312 b/tests/btrfs/312
> deleted file mode 100755
> index eedcf11a2308..000000000000
> --- a/tests/btrfs/312
> +++ /dev/null
> @@ -1,78 +0,0 @@
> -#! /bin/bash
> -# SPDX-License-Identifier: GPL-2.0
> -# Copyright (c) 2024 Oracle. All Rights Reserved.
> -#
> -# FS QA Test 312
> -#
> -# On a clone a device check to see if tempfsid is activated.
> -#
> -. ./common/preamble
> -_begin_fstest auto quick clone tempfsid
> -
> -_cleanup()
> -{
> - cd /
> - $UMOUNT_PROG $mnt1 > /dev/null 2>&1
> - rm -r -f $tmp.*
> - rm -r -f $mnt1
> -}
> -
> -. ./common/filter.btrfs
> -. ./common/reflink
> -
> -_supported_fs btrfs
> -_require_scratch_dev_pool 2
> -_scratch_dev_pool_get 2
> -_require_btrfs_fs_feature temp_fsid
> -
> -mnt1=$TEST_DIR/$seq/mnt1
> -mkdir -p $mnt1
> -
> -create_cloned_devices()
> -{
> - local dev1=$1
> - local dev2=$2
> -
> - echo -n Creating cloned device...
> - _mkfs_dev -fq -b $((1024 * 1024 * 300)) $dev1
> -
> - _mount $dev1 $SCRATCH_MNT
> -
> - $XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/foo | \
> - _filter_xfs_io
> - $UMOUNT_PROG $SCRATCH_MNT
> - # device dump of $dev1 to $dev2
> - dd if=$dev1 of=$dev2 bs=300M count=1 conv=fsync status=none || \
> - _fail "dd failed: $?"
> - echo done
> -}
> -
> -mount_cloned_device()
> -{
> - echo ---- $FUNCNAME ----
> - create_cloned_devices ${SCRATCH_DEV_NAME[0]} ${SCRATCH_DEV_NAME[1]}
> -
> - echo Mounting original device
> - _mount ${SCRATCH_DEV_NAME[0]} $SCRATCH_MNT
> - $XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/foo | \
> - _filter_xfs_io
> - check_fsid ${SCRATCH_DEV_NAME[0]}
> -
> - echo Mounting cloned device
> - _mount ${SCRATCH_DEV_NAME[1]} $mnt1 || \
> - _fail "mount failed, tempfsid didn't work"
> -
> - echo cp reflink must fail
> - _cp_reflink $SCRATCH_MNT/foo $mnt1/bar 2>&1 | \
> - _filter_testdir_and_scratch
> -
> - check_fsid ${SCRATCH_DEV_NAME[1]}
> -}
> -
> -mount_cloned_device
> -
> -_scratch_dev_pool_put
> -
> -# success, all done
> -status=0
> -exit
> diff --git a/tests/btrfs/312.out b/tests/btrfs/312.out
> deleted file mode 100644
> index b7de6ce3cc6e..000000000000
> --- a/tests/btrfs/312.out
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -QA output created by 312
> ----- mount_cloned_device ----
> -Creating cloned device...wrote 9000/9000 bytes at offset 0
> -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -done
> -Mounting original device
> -wrote 9000/9000 bytes at offset 0
> -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -On disk fsid: FSID
> -Metadata uuid: FSID
> -Temp fsid: FSID
> -Tempfsid status: 0
> -Mounting cloned device
> -cp reflink must fail
> -cp: failed to clone 'TEST_DIR/312/mnt1/bar' from 'SCRATCH_MNT/foo': Invalid cross-device link
> -On disk fsid: FSID
> -Metadata uuid: FSID
> -Temp fsid: TEMPFSID
> -Tempfsid status: 1
> diff --git a/tests/shared/001 b/tests/shared/001
> new file mode 100755
> index 000000000000..3f2b85a41099
> --- /dev/null
> +++ b/tests/shared/001
> @@ -0,0 +1,89 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2024 Oracle. All Rights Reserved.
> +#
> +# FS QA Test 001
> +#
> +# Set up a filesystem, create a clone, mount both, and verify if the cp reflink
> +# operation between these two mounts fails.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick clone volume tempfsid
> +
> +_cleanup()
> +{
> + cd /
> + rm -r -f $tmp.*
> +
> + $UMOUNT_PROG $mnt2 &> /dev/null
> + rm -r -f $mnt2
> + _destroy_loop_device $loop_dev2 &> /dev/null
> + rm -r -f $loop_file2
> +
> + $UMOUNT_PROG $mnt1 &> /dev/null
> + rm -r -f $mnt1
> + _destroy_loop_device $loop_dev1 &> /dev/null
> + rm -r -f $loop_file1
> +}
> +
> +. ./common/filter
> +. ./common/reflink
> +
> +# Modify as appropriate.
> +_supported_fs btrfs ext4
> +_require_duplicate_fsid
> +_require_cp_reflink
> +_require_test
> +_require_block_device $TEST_DEV
> +_require_loop
> +
> +[[ $FSTYP == "btrfs" ]] && _require_btrfs_fs_feature temp_fsid
> +
> +clone_filesystem()
> +{
> + local dev1=$1
> + local dev2=$2
> +
> + _mkfs_dev $dev1
> +
> + _mount $dev1 $mnt1
> + $XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $mnt1/foo >> $seqres.full
> + $UMOUNT_PROG $mnt1
> +
> + # device dump of $dev1 to $dev2
> + dd if=$dev1 of=$dev2 conv=fsync status=none || _fail "dd failed: $?"
> +}
> +
> +mnt1=$TEST_DIR/$seq/mnt1
> +rm -r -f $mnt1
> +mkdir -p $mnt1
> +
> +mnt2=$TEST_DIR/$seq/mnt2
> +rm -r -f $mnt2
> +mkdir -p $mnt2
> +
> +loop_file1="$TEST_DIR/$seq/image1"
> +rm -r -f $loop_file1
> +truncate -s 300m "$loop_file1"
> +loop_dev1=$(_create_loop_device "$loop_file1")
> +
> +loop_file2="$TEST_DIR/$seq/image2"
> +rm -r -f $loop_file2
> +truncate -s 300m "$loop_file2"
> +loop_dev2=$(_create_loop_device "$loop_file2")
> +
> +clone_filesystem ${loop_dev1} ${loop_dev2}
> +
> +# Mounting original device
> +_mount $loop_dev1 $mnt1
> +$XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $mnt1/foo | _filter_xfs_io
> +
> +# Mounting cloned device
> +_mount $loop_dev2 $mnt2 || _fail "mount of cloned device failed"
> +
> +# cp reflink across two different filesystems must fail
> +_cp_reflink $mnt1/foo $mnt2/bar 2>&1 | _filter_test_dir
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/shared/001.out b/tests/shared/001.out
> new file mode 100644
> index 000000000000..56b697ca3972
> --- /dev/null
> +++ b/tests/shared/001.out
> @@ -0,0 +1,4 @@
> +QA output created by 001
> +wrote 9000/9000 bytes at offset 0
> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +cp: failed to clone 'TEST_DIR/001/mnt2/bar' from 'TEST_DIR/001/mnt1/foo': Invalid cross-device link
next prev parent reply other threads:[~2024-04-09 14:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-16 17:02 [PATCH v2 0/2] fstests: new test cases for generic group Anand Jain
2024-03-16 17:02 ` [PATCH v2 1/2] shared: move btrfs clone device testcase to the shared group Anand Jain
2024-03-18 22:02 ` David Sterba
2024-03-18 22:15 ` Christoph Hellwig
2024-03-19 4:16 ` Zorro Lang
2024-03-19 17:17 ` Anand Jain
2024-03-19 17:27 ` David Sterba
2024-03-19 20:43 ` Christoph Hellwig
2024-03-20 16:08 ` David Sterba
2024-03-21 21:41 ` Christoph Hellwig
2024-04-09 14:43 ` Anand Jain [this message]
2024-03-16 17:02 ` [PATCH v2 2/2] generic: test mount fails on physical device with configured dm volume Anand Jain
2024-03-24 8:49 ` Anand Jain
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=eac13a6a-4c7a-458b-8577-ffd2846df63e@oracle.com \
--to=anand.jain@oracle.com \
--cc=fdmanana@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=zlang@redhat.com \
/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 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.