linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs test scan but not register the single device fs
Date: Thu, 5 Oct 2023 16:12:31 +0800	[thread overview]
Message-ID: <f2028f45-efad-4321-8bb9-536f3adf2b28@oracle.com> (raw)
In-Reply-To: <7f8e18168419ce6f89faddd3eea2611b53dac67d.1695891643.git.anand.jain@oracle.com>



Added to Staged. If there's any RB, please feel free to send it. Thanks.


On 9/28/23 17:01, Anand Jain wrote:
> Recently, in the kernel commit 0d9436739af2 ("btrfs: scan but don't
> register device on single device filesystem"), we adopted an approach
> where we scan the device to validate it. However, we do not register
> it in the kernel memory since it is not required to be remembered.
> 
> However, the seed device should continue to be registered because
> otherwise, the mount operation for the sprout device will fail.
> 
> This patch ensures that we honor the mount requirements and do not break
> anything while making changes in this part of the code.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>   tests/btrfs/298     | 53 +++++++++++++++++++++++++++++++++++++++++++++
>   tests/btrfs/298.out |  2 ++
>   2 files changed, 55 insertions(+)
>   create mode 100755 tests/btrfs/298
>   create mode 100644 tests/btrfs/298.out
> 
> diff --git a/tests/btrfs/298 b/tests/btrfs/298
> new file mode 100755
> index 000000000000..1d10d27c1354
> --- /dev/null
> +++ b/tests/btrfs/298
> @@ -0,0 +1,53 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 298
> +#
> +#   Check if the device scan registers for a single-device seed and drops
> +#  it from the kernel if it is eventually marked as non-seed.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick seed
> +
> +_supported_fs btrfs
> +_require_command "$BTRFS_TUNE_PROG" btrfstune
> +_require_scratch_dev_pool 2
> +_scratch_dev_pool_get 1
> +_spare_dev_get
> +
> +$WIPEFS_PROG -a $SCRATCH_DEV
> +$WIPEFS_PROG -a $SPARE_DEV
> +
> +echo "#setup seed sprout device" >> $seqres.full
> +_scratch_mkfs "-b 300M" >> $seqres.full 2>&1
> +$BTRFS_TUNE_PROG -S 1 $SCRATCH_DEV
> +_scratch_mount >> $seqres.full 2>&1
> +$BTRFS_UTIL_PROG device add $SPARE_DEV $SCRATCH_MNT
> +_scratch_unmount
> +$BTRFS_UTIL_PROG device scan --forget
> +
> +echo "#Scan seed device and check using mount" >> $seqres.full
> +$BTRFS_UTIL_PROG device scan $SCRATCH_DEV >> $seqres.full
> +_mount $SPARE_DEV $SCRATCH_MNT
> +umount $SCRATCH_MNT
> +
> +echo "#check again, ensures seed device still in kernel" >> $seqres.full
> +_mount $SPARE_DEV $SCRATCH_MNT
> +umount $SCRATCH_MNT
> +
> +echo "#Now scan of non-seed device makes kernel forget" >> $seqres.full
> +$BTRFS_TUNE_PROG -f -S 0 $SCRATCH_DEV >> $seqres.full 2>&1
> +$BTRFS_UTIL_PROG device scan $SCRATCH_DEV >> $seqres.full
> +
> +echo "#Sprout mount must fail for missing seed device" >> $seqres.full
> +_mount $SPARE_DEV $SCRATCH_MNT > /dev/null 2>&1
> +[[ $? == 32 ]] || _fail "mount failed to fail"
> +
> +_spare_dev_put
> +_scratch_dev_pool_put
> +
> +# success, all done
> +echo Silence is golden
> +status=0
> +exit
> diff --git a/tests/btrfs/298.out b/tests/btrfs/298.out
> new file mode 100644
> index 000000000000..634342678f11
> --- /dev/null
> +++ b/tests/btrfs/298.out
> @@ -0,0 +1,2 @@
> +QA output created by 298
> +Silence is golden

  reply	other threads:[~2023-10-05 14:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28  9:01 [PATCH] btrfs test scan but not register the single device fs Anand Jain
2023-10-05  8:12 ` Anand Jain [this message]
2023-10-05 14:29 ` Zorro Lang
2023-10-06  0:08   ` 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=f2028f45-efad-4321-8bb9-536f3adf2b28@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).