2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 Oracle. All Rights Reserved.
7 # Test stale and alien non-btrfs device in the fs devices list.
9 # btrfs: remove identified alien device in open_fs_devices
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
29 . ./common/filter.btrfs
31 # remove previous $seqres.full before test
34 # real QA test starts here
36 _require_command "$WIPEFS_PROG" wipefs
38 _require_scratch_dev_pool 4
46 _scratch_dev_pool_get $device_nr
48 _scratch_pool_mkfs "-d$raid -m$raid" >> $seqres.full 2>&1 || \
51 # Make device_1 a free btrfs device for the raid created above by
52 # clearing its superblock
54 # don't test with the first device as auto fs check (_check_scratch_fs)
55 # picks the first device
56 device_1=$(echo $SCRATCH_DEV_POOL | awk '{print $2}')
57 $WIPEFS_PROG -a $device_1 >> $seqres.full 2>&1
59 device_2=$(echo $SCRATCH_DEV_POOL | awk '{print $1}')
60 _mount -o degraded $device_2 $SCRATCH_MNT
61 # Check if missing device is reported as in the 196.out
62 $BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | \
63 _filter_btrfs_filesystem_show