run_test 33c "keep reading among unhealthy mirrors"
test_34a() {
- [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
+ (( $OSTCOUNT >= 4 )) || skip "need >= 4 OSTs"
- rm -f $DIR/$tfile $DIR/$tfile-2 $DIR/$tfile-ref
+ stack_trap "rm -f $DIR/$tfile $DIR/$tfile-2 $DIR/$tfile-ref"
# reference file
$LFS setstripe -o 0 $DIR/$tfile-ref
run_test 34a "read mirrored file with multiple stripes"
test_34b() {
- [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
+ (( $OSTCOUNT >= 4 )) || skip "need >= 4 OSTs"
- rm -f $DIR/$tfile $DIR/$tfile-2 $DIR/$tfile-ref
+ stack_trap "rm -f $DIR/$tfile $DIR/$tfile-2 $DIR/$tfile-ref"
# reference file
$LFS setstripe -o 0 $DIR/$tfile-ref
# create 2 mirrors using different OSTs
$LFS setstripe -N -c1 -i0 --flags=prefer -N -c1 -i1 $tf ||
error "create mirrored file"
+ stack_trap "rm -f $tf"
# write it in the background
dd if=/dev/zero of=$tf bs=1M count=600 &
stack_trap "rm -f $tf $tf2 $tf3 $tf4"
create_files_37 $((RANDOM + 15 * 1048576)) $tf $tf2 $tf3
- rm -f $tf4
cp $tf $tf4
# assume the mirror id will be 1, 2, and 3
local tf=$DIR/$tfile
local flags
- rm -f $tf
+ stack_trap "rm -f $tf"
+
## mirror 0 ost (0, 1)
## mirror 1 ost (1, 2)
## mirror 2 ost (2, 0)
# Disable xattr caching so we can repeatedly check SOM with lfs getsom
$LCTL set_param llite.*.xattr_cache=0
stack_trap "$LCTL set_param llite.*.xattr_cache=1"
+ stack_trap "rm -rf $tf"
dd if=/dev/zero of=$tf bs=1M count=10 || error "dd write $tfile failed"
sync
local osts
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $file"
# test case 1:
rm -f $file
local tf=$DIR/$tfile
- rm -f $tf
+ stack_trap "rm -f $tf"
+
echo " ** create 2 mirrors FLR file $tf"
$LFS mirror create -N -E2M -Eeof --flags prefer \
-N -E1M -Eeof $tf ||
$LFS setstripe -N -E eof -c1 -o1 -N -E eof -c1 -o0 $file ||
error "setstripe on $file"
+ stack_trap "rm -f $file"
dd if=/dev/zero of=$file bs=1M count=1 || error "dd failed for $file"
$LFS mirror resync $file
# that file is still sparse
(( blocks < 1000 )) ||
error "Mirrored file consumes $blocks blocks"
-
- rm $file
}
run_test 50a "mirror extend/copy preserves sparseness"
local blocks
mkdir -p $DIR/$tdir
+ stack_trap "rm -f $file"
echo " ** create mirrored file $file"
$LFS mirror create -N -E1M -c1 -S1M -E eof \
# not, so whole file should still use far fewer blocks in total
(( blocks < 3000 )) ||
error "Mirrored file consumes $blocks blocks"
- rm $file
}
run_test 50b "mirror rsync handles sparseness"
if ((new_size != old_size)); then
error "new_size ($new_size) is not equal to old_size ($old_size)"
fi
-
- rm $file
}
run_test 60a "mirror extend sets correct size on sparse file"
local tf=$DIR/$tdir/$tfile
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $tf"
while true; do
rm -f $tf
kill -9 $c_pid &> /dev/null
kill -9 $s_pid &> /dev/null
- rm -f $tf
true
}
run_test 70 "mirror create and split race"
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $tf"
$LFS setstripe -N -E1M -c-1 -Eeof -c-1 $tf ||
error "setstripe $tf failed"
run_test 200 "stress test"
cleanup_test_201() {
- trap 0
do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $CL_USER
umount_client $MOUNT2
MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
- trap cleanup_test_201 EXIT
+ stack_trap cleanup_test_201 EXIT
CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
changelog_register -n)
$LFS mirror resync $file
echo "$file resync done"
done
-
- cleanup_test_201
}
run_test 201 "FLR data mover"
local found=""
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $comp_file"
# first mirror is 0-10M, then 10M-(-1), second mirror is 1M followed
# by extension space to -1
[ $found -eq 1 ] || error "resync: Third comp start incorrect"
sel_layout_sanity $comp_file 5
-
- rm -f $comp_file
}
run_test 204a "FLR write/stale/resync tests with self-extending mirror"
local found=""
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $comp_file"
# first mirror is 1M followed by extension space to -1, second mirror
# is 0-10M, then 10M-(-1),
[ $found -eq 1 ] || error "resync: Second mirror comp flags incorrect"
sel_layout_sanity $comp_file 5
-
- rm -f $comp_file
}
run_test 204b "FLR write/stale/resync tests with self-extending primary"
local ost_name=$(ostname_from_index $ost_idx1)
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $comp_file"
# first mirror is is 0-10M, then 10M-(-1), second mirror is 0-1M, then
# extension space from 1M to 1G, then normal space to -1
[ $found -eq 1 ] || error "resync: Second mirror comp incorrect"
sel_layout_sanity $comp_file 4
-
- rm -f $comp_file
}
run_test 204c "FLR write/stale/resync test with component removal"
wait_delete_completed
wait_mds_ost_sync
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $comp_file"
# first mirror is 64M followed by extension space to -1, second mirror
# is 0-10M, then 10M-(-1)
[ $found -eq 1 ] || error "resync: repeat comp incorrect"
sel_layout_sanity $comp_file 5
-
- rm -f $comp_file
}
run_test 204d "FLR write/stale/resync sel test with repeated comp"
wait_mds_ost_sync
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $comp_file"
# first mirror is is 0-100M, then 100M-(-1), second mirror is extension
# space to -1 (-z 64M, so first comp is 0-64M)
[ $found -eq 1 ] || error "resync: repeated comp incorrect"
sel_layout_sanity $comp_file 5
-
- rm -f $comp_file
}
run_test 204e "FLR write/stale/resync sel test with repeated comp"
wait_delete_completed
wait_mds_ost_sync
test_mkdir $DIR/$tdir
+ stack_trap "rm -f $comp_file"
pool_add $TESTNAME || error "Pool creation failed"
pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
[ $found -eq 1 ] || error "resync: First mirror comp incorrect"
sel_layout_sanity $comp_file 4
-
- rm -f $comp_file
}
run_test 204f "FLR write/stale/resync sel w/forced extension"