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
47 _require_scratch_dev_pool 3
48 _require_btrfs_dev_del_by_devid
49 _require_dm_target error
53 dev1="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $2}'`"
54 dev2="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $3}'`"
57 _mkfs_dev -f -d raid1 -m raid1 $dev1 $dev2 $DMERROR_DEV
60 _run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
61 $BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | _filter_btrfs_filesystem_show
63 error_devid=`$BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT |\
64 egrep $DMERROR_DEV | $AWK_PROG '{print $2}'`
66 snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT"
67 snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`"
68 run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
71 # now load the error into the DMERROR_DEV
72 _dmerror_load_error_table
74 _run_btrfs_util_prog device delete $error_devid $SCRATCH_MNT
76 _run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
77 $BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | _filter_btrfs_filesystem_show
79 echo "=== device delete completed"