2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Oracle. All Rights Reserved.
5 # FS QA Test No. btrfs/101
7 # Test device delete when the source device has EIO
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
30 . ./common/filter.btrfs
35 _require_scratch_dev_pool 3
36 _require_btrfs_dev_del_by_devid
37 _require_dm_target error
41 dev1="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $2}'`"
42 dev2="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $3}'`"
45 _mkfs_dev -f -d raid1 -m raid1 $dev1 $dev2 $DMERROR_DEV
48 _run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
49 $BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | _filter_btrfs_filesystem_show
51 error_devid=`$BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT |\
52 egrep $DMERROR_DEV | $AWK_PROG '{print $2}'`
54 snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT"
55 snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`"
56 run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
59 # now load the error into the DMERROR_DEV
60 _dmerror_load_error_table
62 _run_btrfs_util_prog device delete $error_devid $SCRATCH_MNT
64 _run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
65 $BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | _filter_btrfs_filesystem_show
67 echo "=== device delete completed"