generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / btrfs / 184
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 SUSE LLC. All Rights Reserved.
4 #
5 # FS QA Test 184
6 #
7 # Verify that when a device is removed from a multi-device
8 # filesystem its superblock copies are correctly deleted
9 #
10 . ./common/preamble
11 _begin_fstest auto quick volume
12
13 # Import common functions.
14 . ./common/filter
15
16 # real QA test starts here
17 _supported_fs btrfs
18 _require_scratch
19 _require_scratch_dev_pool 2
20 _require_btrfs_command inspect-internal dump-super
21
22 _scratch_dev_pool_get 2
23
24 # Explicitly use raid0 mode to ensure at least one of the devices can be
25 # removed.
26 _scratch_pool_mkfs "-d raid0 -m raid0" >> $seqres.full 2>&1 || _fail "mkfs failed"
27 _scratch_mount
28
29 # pick last dev in the list
30 dev_del=`echo ${SCRATCH_DEV_POOL} | $AWK_PROG '{print $NF}'`
31 $BTRFS_UTIL_PROG device delete $dev_del $SCRATCH_MNT || _fail "btrfs device delete failed"
32 for i in {0..2}; do
33         output=$($BTRFS_UTIL_PROG inspect-internal dump-super -s $i $dev_del 2>&1)
34         $BTRFS_UTIL_PROG inspect-internal dump-super -s $i $dev_del 2>&1 | grep -q "bad magic"
35         ret=$?
36         if [[ "$output" != "" && $ret -eq 1 ]]; then
37                 _fail "Deleted dev superblocks not scratched"
38         fi
39 done
40 _scratch_unmount
41
42 _scratch_dev_pool_put
43
44 # success, all done
45 echo "Silence is golden"
46 status=0
47 exit