2 # FS QA Test No. btrfs/101
4 # Test device delete when the source device has EIO
6 # Copyright (c) 2015 Oracle. All Rights Reserved.
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation.
12 # This program is distributed in the hope that it would be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 seqres=$RESULT_DIR/$seq
24 echo "QA output created by $seq"
29 status=1 # failure is the default!
30 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
42 . ./common/filter.btrfs
48 _require_scratch_dev_pool 3
49 _require_btrfs_dev_del_by_devid
50 _require_dm_target error
54 dev1="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $2}'`"
55 dev2="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $3}'`"
58 _mkfs_dev -f -d raid1 -m raid1 $dev1 $dev2 $DMERROR_DEV
61 _run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
62 $BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | _filter_btrfs_filesystem_show
64 error_devid=`$BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT |\
65 egrep $DMERROR_DEV | $AWK_PROG '{print $2}'`
67 snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT"
68 snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`"
69 run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
72 # now load the error into the DMERROR_DEV
73 _dmerror_load_error_table
75 _run_btrfs_util_prog device delete $error_devid $SCRATCH_MNT
77 _run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
78 $BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | _filter_btrfs_filesystem_show
80 echo "=== device delete completed"