init_logging
ALWAYS_EXCEPT="$SANITY_FLR_EXCEPT "
-# Bug number for skipped test: LU-11381
-ALWAYS_EXCEPT+=" 201 "
+# Bug number for skipped test: LU-14818 LU-11381
+ALWAYS_EXCEPT+=" 6 201 "
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
# skip all tests for PPC until we can get sanity-pfl to pass
[[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return
+ stack_trap "rm -f $tf $tf2"
+
$LFS setstripe -E EOF -o 0 $tf
$LFS setstripe -E EOF -o 1 $tf2
test_22() {
local tf=$DIR/$tfile
+ stack_trap "rm -f $tf"
+
$LFS setstripe -E EOF -o 0 $tf
dd if=/dev/zero of=$tf bs=1M count=$((RANDOM % 20 + 1))
[[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return
rm -f $DIR/$tfile $DIR/$tfile-2
+ stack_trap "rm -f $DIR/$tfile"
+
$LFS setstripe -E EOF -o 0 $DIR/$tfile
dd if=/dev/urandom of=$DIR/$tfile bs=1M count=$((RANDOM % 10 + 2))
test_36() {
local tf=$DIR/$tfile
+ stack_trap "rm -f $tf $tf-2 $tf-3"
+
create_file_36 $tf $tf-2 $tf-3
[ $($LFS getstripe -N $tf) -gt 1 ] || error "wrong mirror count"
local tf3=$DIR/$tfile-3
local tf4=$DIR/$tfile-4
+ stack_trap "rm -f $tf $tf2 $tf3 $tf4"
+
create_files_37 $((RANDOM + 15 * 1048576)) $tf $tf2 $tf3
rm -f $tf4
cp $tf $tf4
local tf=$DIR/$tfile
local ref=$DIR/${tfile}-ref
+ stack_trap "rm -f $tf $ref"
+
$LFS setstripe -E 1M -S 1M -c 1 -E 4M -c 2 -E eof -c -1 $tf ||
error "creating $tf failed"
$LFS setstripe -E 2M -S 1M -c 1 -E 6M -c 2 -E 8M -c -1 -E eof -c -1 \
[ -z "$stale_mirror" ] && error "stale mirror doesn't exist"
[ -z "$valid_mirror" ] && error "valid mirror doesn't exist"
- mirror_io resync $tf || error "resync failed"
+ $LFS mirror resync $tf || error "resync failed"
verify_flr_state $tf "ro"
mirror_cksum=$($LFS mirror read -N $stale_mirror $tf | md5sum)
verify_flr_state $tf "sp"
# from sync_pending to read_only
- mirror_io resync $tf || error "resync failed"
+ $LFS mirror resync $tf || error "resync failed"
verify_flr_state $tf "ro"
}
run_test 38 "resync"
test_41() {
local tf=$DIR/$tfile
+ stack_trap "rm -f $tf $tf-1"
+
rm -f $tf $tf-1
echo " **create two FLR files $tf $tf-1"
$LFS mirror create -N -E 2M -S 1M -E 4M -E -1 \
local mirror_cmd="$LFS mirror verify"
local i
+ stack_trap "rm -rf $td"
+
# create parent directory
mkdir $td || error "mkdir $td failed"
test_mkdir $DIR/$tdir
rm -f $tf
+ stack_trap "rm -rf $tf"
# create 3 mirrors FLR file, the first 2 mirrors are preferred
$LFS setstripe -N -Eeof --flags=prefer -N -Eeof --flags=prefer \
local tf=$DIR/$tdir/$tfile
local tf1=$DIR/$tdir-1/$tfile-1
+ stack_trap "rm -rf $tf $tf1"
+
$LFS setdirstripe -i 0 -c 1 $DIR/$tdir ||
error "create directory failed"
$LFS setdirstripe -i 1 -c 1 $DIR/$tdir-1 ||
}
run_test 50b "mirror rsync handles sparseness"
+test_50c() {
+ local tf=$DIR/$tdir/$tfile
+
+ test_mkdir $DIR/$tdir
+
+ $LFS setstripe -N2 -c-1 $tf || error "create FLR $tf failed"
+ verify_flr_state $tf "ro"
+
+ if [[ "$FSTYPE" == "ldiskfs" ]]; then
+ # ZFS does not support fallocate for now
+ fallocate -p -o 1MiB -l 1MiB $tf ||
+ error "punch hole in $tf failed"
+ verify_flr_state $tf "wp"
+ fi
+
+ dd if=/dev/zero of=$tf bs=4096 count=4 || error "write $tf failed"
+ $LFS mirror resync $tf || error "mirror resync $tf failed"
+ verify_flr_state $tf "ro"
+
+ $MULTIOP $tf OSMWUc || error "$MULTIOP $tf failed"
+ verify_flr_state $tf "wp"
+}
+run_test 50c "punch_hole/mmap_write stale other mirrors"
+
test_60a() {
$LCTL get_param osc.*.import | grep -q 'connect_flags:.*seek' ||
skip "OST does not support SEEK_HOLE"
}
run_test 60a "mirror extend sets correct size on sparse file"
+get_flr_layout_gen() {
+ getfattr -n lustre.lov --only-values $tf 2>/dev/null |
+ od -tx4 | awk '/000000/ { print "0x"$4; exit; }'
+}
+
+check_layout_gen() {
+ local tf=$1
+
+ local v1=$(get_flr_layout_gen $tf)
+ local v2=$($LFS getstripe -v $tf | awk '/lcm_layout_gen/ { print $2 }')
+
+ [[ $v1 -eq $v2 ]] ||
+ error "$tf in-memory layout gen $v1 != $v2 after $2"
+}
+
+test_60b() {
+ local tf=$DIR/$tdir/$tfile
+
+ test_mkdir $DIR/$tdir
+
+ $LFS setstripe -Eeof $tf || error "setstripe $tf failed"
+
+ for ((i = 0; i < 20; i++)); do
+ $LFS mirror extend -N $tf ||
+ error "extending mirror for $tf failed"
+ check_layout_gen $tf "extend"
+
+ $LFS mirror split -d --mirror-id=$((i+1)) $tf ||
+ error "split $tf failed"
+ check_layout_gen $tf "split"
+ done
+}
+run_test 60b "mirror merge/split cancel client's in-memory layout gen"
+
test_70() {
local tf=$DIR/$tdir/$tfile
rm -f $lock_file
# resync and verify mirrors
- mirror_io resync $tf
+ $LFS mirror resync $tf || error "final resync failed"
get_mirror_ids $tf
local csum=$($LFS mirror read -N ${mirror_array[0]} $tf | md5sum)
[ $now -lt $((ts + delay)) ] && sleep $((ts + delay - now))
- mirror_io resync $file
+ $LFS mirror resync $file
echo "$file resync done"
done