blob: e3c4b74a5d80587481f9722ecc5dfae829754869 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2019 Oracle. All Rights Reserved.
#
# FS QA Test 198
#
# Test outdated and foreign non-btrfs devices in the device listing.
#
. ./common/preamble
_begin_fstest auto quick volume
. ./common/filter
. ./common/filter.btrfs
_supported_fs btrfs
_require_command "$WIPEFS_PROG" wipefs
_require_scratch
_require_scratch_dev_pool 4
# We require at least one raid setup, raid1 is the easiest, use this to gate on
# wether or not we run this test
_require_btrfs_raid_type raid1
_fixed_by_kernel_commit 96c2e067ed3e3e \
"btrfs: skip devices without magic signature when mounting"
workout()
{
raid=$1
device_nr=$2
if ! _check_btrfs_raid_type $raid; then
echo "$raid isn't supported, skipping" >> $seqres.full
return
fi
echo $raid >> $seqres.full
_scratch_dev_pool_get $device_nr
_scratch_pool_mkfs "-d$raid -m$raid" >> $seqres.full 2>&1 || \
_fail "mkfs failed"
# Make ${SCRATCH_DEV_NAME[1]} a free btrfs device for the raid created
# above by clearing its superblock
# don't test with the first device as auto fs check (_check_scratch_fs)
# picks the first device
$WIPEFS_PROG -a ${SCRATCH_DEV_NAME[1]} >> $seqres.full 2>&1
_mount -o degraded ${SCRATCH_DEV_NAME[0]} $SCRATCH_MNT
# Check if missing device is reported as in the 196.out
$BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | \
_filter_btrfs_filesystem_show > $tmp.output 2>&1
cat $tmp.output >> $seqres.full
grep -q "${SCRATCH_DEV_NAME[1]}" $tmp.output && _fail "found stale device"
_scratch_unmount
_scratch_dev_pool_put
}
workout "raid1" "2"
workout "raid5" "3"
workout "raid6" "4"
workout "raid10" "4"
# success, all done
echo "Silence is golden"
status=0
exit
|