[ "$exp_val" == "$imp_val" ] ||
error "export flags '$exp_val' != import flags '$imp_val'"
- # Compare the value of client version
+ # Compare client versions. Only compare top-3 fields for compatibility
exp_client_version=$(awk '/target_version:/ { print $2 }' $temp_exp)
- exp_val=$(version_code $exp_client_version)
- imp_val=$CLIENT_VERSION
+ exp_val=$(version_code $(cut -d. -f1,2,3 <<<$exp_client_version))
+ imp_val=$(version_code $(lustre_build_version client | cut -d. -f1,2,3))
[ "$exp_val" == "$imp_val" ] ||
- error "export client version '$exp_val' != '$imp_val'"
+ error "exp version '$exp_client_version'($exp_val) != " \
+ "'$(lustre_build_version client)'($imp_val)"
}
run_test 0d "check export proc ============================="
local TF="$TMP/$tfile"
+ stack_trap "rm -f $DIR/$tfile; wait_delete_completed"
dd if=/dev/urandom of=$TF bs=6096 count=1 || error "dd failed"
cp $TF $DIR/$tfile
cancel_lru_locks $OSC
echo "12345" >>$DIR/$tfile
cancel_lru_locks $OSC
cmp $TF $DIR/$tfile || error "$TF $DIR/$tfile differ (append2)"
-
- rm -f $TF
- true
}
run_test 150a "truncate/append tests"
test_150b() {
- [ "$ost1_FSTYPE" != ldiskfs ] && skip "non-ldiskfs backend"
- [ $OST1_VERSION -lt $(version_code 2.13.50) ] &&
- skip "Need OST version at least 2.13.53"
+ check_for_fallocate
+
touch $DIR/$tfile
+ stack_trap "rm -f $DIR/$tfile; wait_delete_completed"
check_fallocate $DIR/$tfile || error "fallocate failed"
}
run_test 150b "Verify fallocate (prealloc) functionality"
-test_150c() {
- local bytes
- local want
+test_150bb() {
+ check_for_fallocate
+
+ touch $DIR/$tfile
+ stack_trap "rm -f $DIR/$tfile; wait_delete_completed"
+ dd if=/dev/urandom of=$DIR/$tfile bs=1M count=20 || error "dd failed"
+ > $DIR/$tfile
+ fallocate -l $((1048576 * 20)) $DIR/$tfile || error "fallocate failed"
+ # precomputed md5sum for 20MB of zeroes
+ local expect="8f4e33f3dc3e414ff94e5fb6905cba8c"
+ local sum=($(md5sum $DIR/$tfile))
+
+ [[ "${sum[0]}" == "$expect" ]] || error "fallocate unwritten is not zero"
- [ "$ost1_FSTYPE" != ldiskfs ] && skip "non-ldiskfs backend"
- [ $OST1_VERSION -lt $(version_code 2.13.50) ] &&
- skip "Need OST version at least 2.13.53"
+ do_nodes $(comma_list $(osts_nodes)) \
+ "$LCTL set_param osd-ldiskfs.*.fallocate_zero_blocks=1" ||
+ error "set osd-ldiskfs.*.fallocate_zero_blocks=1"
+
+ > $DIR/$tfile
+ fallocate -l $((1048576 * 20)) $DIR/$tfile || error "fallocate failed"
+ sum=($(md5sum $DIR/$tfile))
+
+ [[ "${sum[0]}" == "$expect" ]] || error "fallocate zero is not zero"
+}
+run_test 150bb "Verify fallocate modes both zero space"
+
+test_150c() {
+ check_for_fallocate
+ stack_trap "rm -f $DIR/$tfile; wait_delete_completed"
$LFS setstripe -c $OSTCOUNT -S1M $DIR/$tfile || error "setstripe failed"
fallocate -l ${OSTCOUNT}m $DIR/$tfile || error "fallocate failed"
sync; sync_all_data
sync; sync_all_data
cancel_lru_locks $OSC
sleep 5
- bytes=$(($(stat -c '%b * %B' $DIR/$tfile)))
- want=$((1024 * 1048576))
+ local bytes=$(($(stat -c '%b * %B' $DIR/$tfile)))
+ local want=$((1024 * 1048576))
# Must allocate all requested space, not more than 5% extra
(( $bytes >= $want && $bytes < $want * 105 / 100 )) ||
run_test 150c "Verify fallocate Size and Blocks"
test_150d() {
- local bytes
- local want
-
- [ "$ost1_FSTYPE" != ldiskfs ] && skip "non-ldiskfs backend"
- [ $OST1_VERSION -lt $(version_code 2.13.50) ] &&
- skip "Need OST version at least 2.13.53"
+ check_for_fallocate
+ stack_trap "rm -f $DIR/$tfile; wait_delete_completed"
$LFS setstripe -c $OSTCOUNT -S1M $DIR/$tdir || error "setstripe failed"
fallocate -o 1G -l ${OSTCOUNT}m $DIR/$tdir || error "fallocate failed"
sync; sync_all_data
cancel_lru_locks $OSC
sleep 5
- bytes=$(($(stat -c '%b * %B' $DIR/$tdir)))
- want=$((OSTCOUNT * 1048576))
+ local bytes=$(($(stat -c '%b * %B' $DIR/$tdir)))
+ local want=$((OSTCOUNT * 1048576))
# Must allocate all requested space, not more than 5% extra
(( $bytes >= $want && $bytes < $want * 105 / 100 )) ||
run_test 150d "Verify fallocate Size and Blocks - Non zero start"
test_150e() {
- [ "$ost1_FSTYPE" != ldiskfs ] && skip "non-ldiskfs backend"
- [ $OST1_VERSION -ge $(version_code 2.13.55) ] ||
- skip "Need OST version at least 2.13.55"
+ check_for_fallocate
echo "df before:"
$LFS df
+ stack_trap "rm -f $DIR/$tfile; wait_delete_completed"
$LFS setstripe -c${OSTCOUNT} $DIR/$tfile ||
error "$LFS setstripe -c${OSTCOUNT} $DIR/$tfile failed"
min_size_ost=$($LFS df | awk "/$FSNAME-OST/ { print \$4 }" |
sort -un | head -1)
- # Get 90% of the available space
- local space=$(((min_size_ost * 90)/100 * OSTCOUNT))
+ # Get 100MB per OST of the available space to reduce run time
+ # else 60% of the available space if we are running SLOW tests
+ if [ $SLOW == "no" ]; then
+ local space=$((1024 * 100 * OSTCOUNT))
+ else
+ local space=$(((min_size_ost * 60)/100 * OSTCOUNT))
+ fi
fallocate -l${space}k $DIR/$tfile ||
error "fallocate ${space}k $DIR/$tfile failed"
echo "df after unlink:"
$LFS df
}
-run_test 150e "Verify 90% of available OST space consumed by fallocate"
+run_test 150e "Verify 60% of available OST space consumed by fallocate"
#LU-2902 roc_hit was not able to read all values from lproc
function roc_hit_init() {
}
run_test 430c "lseek: external tools check"
+test_431() { # LU-14187
+ local file=$DIR/$tdir/$tfile
+
+ mkdir -p $DIR/$tdir
+ $LFS setstripe -c 1 -i 0 $file || error "lfs setstripe failed"
+ dd if=/dev/urandom of=$file bs=4k count=1
+ dd if=/dev/urandom of=$file bs=4k count=1 seek=10 conv=notrunc
+ dd if=/dev/urandom of=$file bs=4k count=1 seek=12 conv=notrunc
+ #define OBD_FAIL_OST_RESTART_IO 0x251
+ do_facet ost1 "$LCTL set_param fail_loc=0x251"
+ $LFS setstripe -c 1 -i 0 $file.0 || error "lfs setstripe failed"
+ cp $file $file.0
+ cancel_lru_locks
+ sync_all_data
+ echo 3 > /proc/sys/vm/drop_caches
+ diff $file $file.0 || error "data diff"
+}
+run_test 431 "Restart transaction for IO"
+
prep_801() {
[[ $MDS1_VERSION -lt $(version_code 2.9.55) ]] ||
[[ $OST1_VERSION -lt $(version_code 2.9.55) ]] &&