2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 SUSE LLC. All Rights Reserved.
7 # Verify that when a device is removed from a multi-device
8 # filesystem its superblock copies are correctly deleted
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
31 # real QA test starts here
34 _require_scratch_dev_pool 2
35 _require_btrfs_command inspect-internal dump-super
37 _scratch_dev_pool_get 2
39 # Explicitly use raid0 mode to ensure at least one of the devices can be
41 _scratch_pool_mkfs "-d raid0 -m raid0" >> $seqres.full 2>&1 || _fail "mkfs failed"
44 # pick last dev in the list
45 dev_del=`echo ${SCRATCH_DEV_POOL} | awk '{print $NF}'`
46 $BTRFS_UTIL_PROG device delete $dev_del $SCRATCH_MNT || _fail "btrfs device delete failed"
48 output=$($BTRFS_UTIL_PROG inspect-internal dump-super -s $i $dev_del 2>&1)
49 $BTRFS_UTIL_PROG inspect-internal dump-super -s $i $dev_del 2>&1 | grep -q "bad magic"
51 if [[ "$output" != "" && $ret -eq 1 ]]; then
52 _fail "Deleted dev superblocks not scratched"
60 echo "Silence is golden"