public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: guaneryu@gmail.com, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH] fstests: Verify that removed device has its superblocks deleted
Date: Mon, 25 Mar 2019 20:41:27 +0800	[thread overview]
Message-ID: <b7d33a7f-9f38-11a5-aab0-eb4639b603a0@oracle.com> (raw)
In-Reply-To: <620fe973-9b9a-8915-8b41-bb1baccfee2b@oracle.com>



On 3/25/19 8:36 PM, Anand Jain wrote:
> 
> 
> On 3/25/19 5:42 PM, Nikolay Borisov wrote:
>> When a device is removed from a btrfs filesystem its superblock copies
>> must be deleted. This test ensures this is indeed the case.
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
>> ---
>>   tests/btrfs/184     | 57 
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   tests/btrfs/184.out |  2 ++
>>   tests/btrfs/group   |  1 +
>>   3 files changed, 60 insertions(+)
>>   create mode 100755 tests/btrfs/184
>>   create mode 100644 tests/btrfs/184.out
>>
>> diff --git a/tests/btrfs/184 b/tests/btrfs/184
>> new file mode 100755
>> index 000000000000..3bf7d201a145
>> --- /dev/null
>> +++ b/tests/btrfs/184
>> @@ -0,0 +1,57 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2019 SUSE LLC. All Rights Reserved.
>> +#
>> +# FS QA Test 184
>> +#
>> +# Verify that when a device is removed from a multi-device
>> +# filesystem its superblock copies are correctly deleted
>> +#
>> +seq=`basename $0`
>> +seqres=$RESULT_DIR/$seq
>> +echo "QA output created by $seq"
>> +
>> +here=`pwd`
>> +tmp=/tmp/$$
>> +status=1    # failure is the default!
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> +    cd /
>> +    rm -f $tmp.*
>> +}
>> +
>> +# get standard environment, filters and checks
>> +. ./common/rc
>> +. ./common/filter
>> +
>> +rm -f $seqres.full
>> +
>> +# real QA test starts here
>> +_supported_fs btrfs
>> +_supported_os Linux
>> +_require_scratch
>> +_require_scratch_dev_pool 2
>> +_require_btrfs_command inspect-internal dump-super
>> +
>> +_scratch_pool_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
>> +_scratch_mount
>> +
>> +# pick last dev in the list
>> +dev_del=`echo ${SCRATCH_DEV_POOL} | awk '{print $NF}'`
> 
>> +$BTRFS_UTIL_PROG device delete $dev_del $SCRATCH_MNT || _fail "btrfs 
>> device delete failed"
> 
>   Device delete will fail with the raid1 mkfs option in the config fail.

  Also needs

  _scratch_dev_pool_get 2
  _scratch_dev_pool_put


> Thanks, Anand
> 
> 
>> +for i in {0..2}; do
>> +    output=$($BTRFS_UTIL_PROG inspect-internal dump-super -s $i 
>> $dev_del 2>&1)
>> +    $BTRFS_UTIL_PROG inspect-internal dump-super -s $i $dev_del 2>&1 
>> | grep -q "bad magic"
>> +    ret=$?
>> +    if [[ "$output" != "" && $ret -eq 1 ]]; then
>> +        _fail "Deleted dev superblocks not scratched"
>> +    fi
>> +done
>> +_scratch_unmount
>> +
>> +# success, all done
>> +echo "Silence is golden"
>> +status=0
>> +exit
>> diff --git a/tests/btrfs/184.out b/tests/btrfs/184.out
>> new file mode 100644
>> index 000000000000..b4ce96cfc047
>> --- /dev/null
>> +++ b/tests/btrfs/184.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 184
>> +Silence is golden
>> diff --git a/tests/btrfs/group b/tests/btrfs/group
>> index f3227c1708d9..c1d215bf5ff8 100644
>> --- a/tests/btrfs/group
>> +++ b/tests/btrfs/group
>> @@ -186,3 +186,4 @@
>>   181 auto quick balance
>>   182 auto quick balance
>>   183 auto quick clone compress punch
>> +184 auto quick volume
>>

  reply	other threads:[~2019-03-25 12:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25  9:42 [PATCH] fstests: Verify that removed device has its superblocks deleted Nikolay Borisov
2019-03-25 12:36 ` Anand Jain
2019-03-25 12:41   ` Anand Jain [this message]
2019-03-25 14:07 ` [PATCH v2] " Nikolay Borisov
2019-03-25 21:55   ` Anand Jain
2019-03-26 14:11     ` Nikolay Borisov

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=b7d33a7f-9f38-11a5-aab0-eb4639b603a0@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.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