From: Anand Jain <anand.jain@oracle.com>
To: Filipe Manana <fdmanana@kernel.org>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, zlang@redhat.com
Subject: Re: [PATCH v2 04/10] btrfs: verify that subvolume mounts are unaffected by tempfsid
Date: Fri, 23 Feb 2024 22:52:07 +0530 [thread overview]
Message-ID: <4cdfd838-b919-45a1-85dc-a5e6d5f61f84@oracle.com> (raw)
In-Reply-To: <CAL3q7H4qTrGrSuWys8rTRnQNdYFBJL=RZjsg3k_kVuU01Lf3Kw@mail.gmail.com>
On 2/20/24 22:00, Filipe Manana wrote:
> On Mon, Feb 19, 2024 at 7:49 PM Anand Jain <anand.jain@oracle.com> wrote:
>>
>> The tempfsid logic must determine whether the incoming mount request
>> is for a device already mounted or a new device mount. Verify that it
>> recognizes the device already mounted well by creating reflink across
>> the subvolume mount points.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>> v2:
>> add subvol group
>> use $UMOUNT_PROG
>> remove _fail for _cp_reflink
>>
>> tests/btrfs/311 | 89 +++++++++++++++++++++++++++++++++++++++++++++
>> tests/btrfs/311.out | 24 ++++++++++++
>> 2 files changed, 113 insertions(+)
>> create mode 100755 tests/btrfs/311
>> create mode 100644 tests/btrfs/311.out
>>
>> diff --git a/tests/btrfs/311 b/tests/btrfs/311
>> new file mode 100755
>> index 000000000000..cebbc3a59e6a
>> --- /dev/null
>> +++ b/tests/btrfs/311
>> @@ -0,0 +1,89 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2024 Oracle. All Rights Reserved.
>> +#
>> +# FS QA Test 311
>> +#
>> +# Mount the device twice check if the reflink works, this helps to
>> +# ensure device is mounted as the same device.
>> +#
>> +. ./common/preamble
>> +_begin_fstest auto quick subvol tempfsid
>> +
>> +# Override the default cleanup function.
>> +_cleanup()
>> +{
>> + cd /
>> + $UMOUNT_PROG $mnt1 > /dev/null 2>&1
>> + rm -r -f $tmp.*
>> + rm -r -f $mnt1
>> +}
>> +
>> +. ./common/filter.btrfs
>> +. ./common/reflink
>> +
>> +# Modify as appropriate.
>> +_supported_fs btrfs
>> +_require_cp_reflink
>> +_require_btrfs_sysfs_fsid
>> +_require_btrfs_fs_feature temp_fsid
>> +_require_btrfs_command inspect-internal dump-super
>> +_require_scratch
>> +
>> +mnt1=$TEST_DIR/$seq/mnt1
>> +mkdir -p $mnt1
>> +
>> +same_dev_mount()
>> +{
>> + echo ---- $FUNCNAME ----
>> +
>> + _scratch_mkfs >> $seqres.full 2>&1
>> +
>> + _scratch_mount
>> + $XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/foo | \
>> + _filter_xfs_io
>> +
>> + echo Mount the device again to a different mount point
>> + _mount $SCRATCH_DEV $mnt1
>> +
>> + _cp_reflink $SCRATCH_MNT/foo $mnt1/bar
>> + echo Checksum of reflinked files
>> + md5sum $SCRATCH_MNT/foo | _filter_scratch
>> + md5sum $mnt1/bar | _filter_test_dir
>> +
>> + check_fsid $SCRATCH_DEV
>> +}
>> +
>> +same_dev_subvol_mount()
>> +{
>> + echo ---- $FUNCNAME ----
>> + _scratch_mkfs >> $seqres.full 2>&1
>> +
>> + _scratch_mount
>> + $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol
>
> Need to use: | _filter_scratch
> See the golden output below.
>
>> +
>> + $XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/subvol/foo | \
>> + _filter_xfs_io
>> +
>> + echo Mounting a subvol
>> + _mount -o subvol=subvol $SCRATCH_DEV $mnt1
>> +
>> + _cp_reflink $SCRATCH_MNT/subvol/foo $mnt1/bar
>> + echo Checksum of reflinked files
>> + md5sum $SCRATCH_MNT/subvol/foo | _filter_scratch
>> + md5sum $mnt1/bar | _filter_test_dir
>> +
>> + check_fsid $SCRATCH_DEV
>> +}
>> +
>> +same_dev_mount
>> +
>> +_scratch_unmount
>> +_cleanup
>> +mkdir -p $mnt1
>> +
>> +same_dev_subvol_mount
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/btrfs/311.out b/tests/btrfs/311.out
>> new file mode 100644
>> index 000000000000..8787f24ab867
>> --- /dev/null
>> +++ b/tests/btrfs/311.out
>> @@ -0,0 +1,24 @@
>> +QA output created by 311
>> +---- same_dev_mount ----
>> +wrote 9000/9000 bytes at offset 0
>> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>> +Mount the device again to a different mount point
>> +Checksum of reflinked files
>> +42d69d1a6d333a7ebdf64792a555e392 SCRATCH_MNT/foo
>> +42d69d1a6d333a7ebdf64792a555e392 TEST_DIR/311/mnt1/bar
>> +On disk fsid: FSID
>> +Metadata uuid: FSID
>> +Temp fsid: FSID
>> +Tempfsid status: 0
>> +---- same_dev_subvol_mount ----
>> +Create subvolume '/mnt/scratch/subvol'
>
> Because of this...
>
> Otherwise it looks fine.
>
> With that corrected:
>
> Reviewed-by: Filipe Manana <fdmanana@suse.com>
>
Fixed this locally. Thanks, Anand
next prev parent reply other threads:[~2024-02-23 17:22 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 19:48 [PATCH v2 00/10] btrfs: functional test cases for tempfsid Anand Jain
2024-02-19 19:48 ` [PATCH v2 01/10] assign SCRATCH_DEV_POOL to an array Anand Jain
2024-02-20 16:17 ` Filipe Manana
2024-02-19 19:48 ` [PATCH v2 02/10] btrfs: introduce tempfsid test group Anand Jain
2024-02-19 19:48 ` [PATCH v2 03/10] btrfs: create a helper function, check_fsid(), to verify the tempfsid Anand Jain
2024-02-20 16:24 ` Filipe Manana
2024-02-19 19:48 ` [PATCH v2 04/10] btrfs: verify that subvolume mounts are unaffected by tempfsid Anand Jain
2024-02-20 16:30 ` Filipe Manana
2024-02-23 17:22 ` Anand Jain [this message]
2024-02-19 19:48 ` [PATCH v2 05/10] btrfs: check if cloned device mounts with tempfsid Anand Jain
2024-02-20 16:44 ` Filipe Manana
2024-02-23 17:35 ` Anand Jain
2024-02-19 19:48 ` [PATCH v2 06/10] btrfs: test case prerequisite _require_btrfs_mkfs_uuid_option Anand Jain
2024-02-20 16:47 ` Filipe Manana
2024-02-19 19:48 ` [PATCH v2 07/10] btrfs: introduce helper for creating cloned devices with mkfs Anand Jain
2024-02-20 16:51 ` Filipe Manana
2024-02-23 17:44 ` Anand Jain
2024-02-19 19:48 ` [PATCH v2 08/10] btrfs: verify tempfsid clones using mkfs Anand Jain
2024-02-20 16:55 ` Filipe Manana
2024-02-24 11:41 ` Anand Jain
2024-02-19 19:48 ` [PATCH v2 09/10] btrfs: validate send-receive operation with tempfsid Anand Jain
2024-02-20 16:57 ` Filipe Manana
2024-02-24 0:53 ` Anand Jain
2024-02-19 19:48 ` [PATCH v2 10/10] btrfs: test tempfsid with device add, seed, and balance Anand Jain
2024-02-20 17:05 ` Filipe Manana
2024-02-24 11:29 ` 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=4cdfd838-b919-45a1-85dc-a5e6d5f61f84@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox