xfs: Check for extent overflow when trivally adding a new extent
[xfstests-dev.git] / tests / btrfs / 198
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 Oracle.  All Rights Reserved.
4 #
5 # FS QA Test 198
6 #
7 # Test stale and alien non-btrfs device in the fs devices list.
8 #  Bug fixed in:
9 #    btrfs: remove identified alien device in open_fs_devices
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29 . ./common/filter.btrfs
30
31 # remove previous $seqres.full before test
32 rm -f $seqres.full
33
34 # real QA test starts here
35 _supported_fs btrfs
36 _require_command "$WIPEFS_PROG" wipefs
37 _require_scratch
38 _require_scratch_dev_pool 4
39
40 workout()
41 {
42         raid=$1
43         device_nr=$2
44
45         echo $raid
46         _scratch_dev_pool_get $device_nr
47
48         _scratch_pool_mkfs "-d$raid -m$raid" >> $seqres.full 2>&1 || \
49                                                         _fail "mkfs failed"
50
51         # Make device_1 a free btrfs device for the raid created above by
52         # clearing its superblock
53
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
58
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
64
65         _scratch_unmount
66         _scratch_dev_pool_put
67 }
68
69 workout "raid1" "2"
70 workout "raid5" "3"
71 workout "raid6" "4"
72 workout "raid10" "4"
73
74 # success, all done
75 status=0
76 exit