rm -f $F77_TMP
unset F77_TMP
+cleanup_test_78() {
+ trap 0
+ rm -f $DIR/$tfile
+}
+
test_78() { # bug 10901
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
remote_ost || { skip_env "local OST" && return; }
[[ $SMALLESTOST -lt 10240 ]] &&
skip "too small OSTSIZE, useless to run large O_DIRECT test" && return 0
+ trap cleanup_test_78 EXIT
+
[[ $F78SIZE -gt $((SMALLESTOST * $OSTCOUNT / 1024 - 80)) ]] &&
F78SIZE=$((SMALLESTOST * $OSTCOUNT / 1024 - 80))
$DIRECTIO rdwr $DIR/$tfile 0 $FSIZE 1048576||error "rdwr failed"
done
- rm -f $DIR/$tfile
+ cleanup_test_78
}
run_test 78 "handle large O_DIRECT writes correctly ============"
run_acl_subtest misc || error "misc test failed"
echo "performing permissions..."
run_acl_subtest permissions || error "permissions failed"
+ # LU-1482 mdd: Setting xattr are properly checked with and without ACLs
+ if [ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.8.55) -o \
+ \( $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6) -a \
+ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.5.29) \) ]
+ then
+ echo "performing permissions xattr..."
+ run_acl_subtest permissions_xattr ||
+ error "permissions_xattr failed"
+ fi
echo "performing setfacl..."
run_acl_subtest setfacl || error "setfacl test failed"
true
}
+save_writethrough() {
+ local facets=$(get_facets OST)
+
+ save_lustre_params $facets "obdfilter.*.writethrough_cache_enable" > $1
+ save_lustre_params $facets "osd-*.*.writethrough_cache_enable" >> $1
+}
+
test_155a() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+
set_cache read on
set_cache writethrough on
test_155_small_load
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 155a "Verify small file correctness: read cache:on write_cache:on"
test_155b() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+
set_cache read on
set_cache writethrough off
test_155_small_load
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 155b "Verify small file correctness: read cache:on write_cache:off"
test_155c() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+
set_cache read off
set_cache writethrough on
test_155_small_load
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 155c "Verify small file correctness: read cache:off write_cache:on"
test_155d() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+
set_cache read off
set_cache writethrough off
test_155_small_load
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 155d "Verify small file correctness: read cache:off write_cache:off"
test_155e() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+
set_cache read on
set_cache writethrough on
test_155_big_load
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 155e "Verify big file correctness: read cache:on write_cache:on"
test_155f() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+
set_cache read on
set_cache writethrough off
test_155_big_load
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 155f "Verify big file correctness: read cache:on write_cache:off"
test_155g() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+
set_cache read off
set_cache writethrough on
test_155_big_load
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 155g "Verify big file correctness: read cache:off write_cache:on"
test_155h() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+
set_cache read off
set_cache writethrough off
test_155_big_load
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 155h "Verify big file correctness: read cache:off write_cache:off"
local BEFORE
local AFTER
local file="$DIR/$tfile"
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
[ "$(facet_fstype ost1)" = "zfs" -a \
$(lustre_version_code ost1 -lt $(version_code 2.6.93)) ] &&
skip "LU-1956/LU-2261: stats not implemented on OSD ZFS" &&
return
+ save_writethrough $p
roc_hit_init
log "Turn on read and write cache"
fi
rm -f $file
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 156 "Verification of tunables"
test_224c() { # LU-6441
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_writethrough $p
+ set_cache writethrough on
+
local pages_per_rpc=$($LCTL get_param \
osc.*.max_pages_per_rpc)
local at_max=$($LCTL get_param -n at_max)
error "conf_param timeout=5 failed"
#define OBD_FAIL_PTLRPC_CLIENT_BULK_CB3 0x520
- $LCTL set_param fail_loc=0x520
+ do_facet ost1 $LCTL set_param fail_loc=0x520
+ $LFS setstripe -c 1 -i 0 $DIR/$tfile
dd if=/dev/zero of=$DIR/$tfile bs=8MB count=1
sync
- $LCTL set_param fail_loc=0
+ do_facet ost1 $LCTL set_param fail_loc=0
set_conf_param_and_check client "$test_at" "$param_at" $at_max ||
error "conf_param at_max=$at_max failed"
$timeout || error "conf_param timeout=$timeout failed"
$LCTL set_param -n $pages_per_rpc
+ restore_lustre_params < $p
+ rm -f $p
}
run_test 224c "Don't hang if one of md lost during large bulk RPC"
run_test 247e "mount .. as fileset"
test_248() {
- local my_error=error
-
local fast_read_sav=$($LCTL get_param -n llite.*.fast_read 2>/dev/null)
[ -z "$fast_read_sav" ] && skip "no fast read support" && return
- # This test case is time sensitive and Maloo uses KVM to run autotest.
- # Therefore the complete time of I/O task is unreliable and depends on
- # the workload on the host machine when the task is running.
- local virt=$(running_in_vm)
- [ -n "$virt" ] && echo "running in VM '$virt', ignore error" &&
- my_error="error_ignore env=$virt"
-
# create a large file for fast read verification
dd if=/dev/zero of=$DIR/$tfile bs=1M count=128 > /dev/null 2>&1
# verify that fast read is 4 times faster for cache read
[ $(bc <<< "4 * $t_fast < $t_slow") -eq 1 ] ||
- $my_error "fast read was not 4 times faster: $t_fast vs $t_slow"
+ error_not_in_vm "fast read was not 4 times faster: " \
+ "$t_fast vs $t_slow"
echo "Test 2: verify the performance between big and small read"
$LCTL set_param -n llite.*.fast_read=1
# verify that big IO is not 4 times faster than small IO
[ $(bc <<< "4 * $t_1k >= $t_1m") -eq 1 ] ||
- $my_error "bigger IO is way too fast: $t_1k vs $t_1m"
+ error_not_in_vm "bigger IO is way too fast: $t_1k vs $t_1m"
$LCTL set_param -n llite.*.fast_read=$fast_read_sav
rm -f $DIR/$tfile
local repeat=10
local average_cache=0
local average_ladvise=0
+
for ((i = 1; i <= $repeat; i++)); do
echo "Iter $i/$repeat: reading without willread hint"
cancel_lru_locks osc
local lowest_speedup=$((average_cache / 2))
[ $average_ladvise -gt $lowest_speedup ] ||
- error "Speedup with willread is less than $lowest_speedup%,"\
- "got $average_ladvise%"
+ error_not_in_vm "Speedup with willread is less than " \
+ "$lowest_speedup%, got $average_ladvise%"
echo "Speedup with willread ladvise: $average_ladvise%"
echo "Speedup with cache: $average_cache%"
}
}
run_test 256 "Check llog delete for empty and not full state"
+test_257() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.55) ]] &&
+ skip "Need MDS version at least 2.8.55" && return
+
+ test_mkdir -p $DIR/$tdir
+
+ setfattr -n trusted.name1 -v value1 $DIR/$tdir ||
+ error "setfattr -n trusted.name1=value1 $DIR/$tdir failed"
+ stat $DIR/$tdir
+
+#define OBD_FAIL_MDS_XATTR_REP 0x161
+ local mdtidx=$($LFS getstripe -M $DIR/$tdir)
+ local facet=mds$((mdtidx + 1))
+ set_nodes_failloc $(facet_active_host $facet) 0x80000161
+ getfattr -n trusted.name1 $DIR/$tdir 2> /dev/null
+
+ stop $facet || error "stop MDS failed"
+ start $facet $(mdsdevname $((mdtidx + 1))) $MDS_MOUNT_OPTS ||
+ error "start MDS fail"
+}
+run_test 257 "xattr locks are not lost"
+
test_260() {
#define OBD_FAIL_MDC_CLOSE 0x806
$LCTL set_param fail_loc=0x80000806
local new_iused
for i in $(seq 120); do
new_iused=$($LFS df -i | grep OST0000 | awk '{ print $3 }')
- [ $new_iused -lt $((old_iused - 900)) ] && break
+ [ $((old_iused - new_iused)) -gt 800 ] && break
sleep 1
done
echo "waited $i sec, old Iused $old_iused, new Iused $new_iused"
- [ $new_iused -lt $((old_iused - 900)) ] ||
+ [ $((old_iused - new_iused)) -gt 800 ] ||
error "objs not destroyed after unlink"
}
run_test 311 "disable OSP precreate, and unlink should destroy objs"
+zfs_oid_to_objid()
+{
+ local ost=$1
+ local objid=$2
+
+ local vdevdir=$(dirname $(facet_vdevice $ost))
+ local cmd="$ZDB -e -p $vdevdir -dddd $(facet_device $ost)"
+ local zfs_zapid=$(do_facet $ost $cmd |
+ grep -w "/O/0/d$((objid%32))" -C 5 |
+ awk '/Object/{getline; print $1}')
+ local zfs_objid=$(do_facet $ost $cmd $zfs_zapid |
+ awk "/$objid = /"'{printf $3}')
+
+ echo $zfs_objid
+}
+
+zfs_object_blksz() {
+ local ost=$1
+ local objid=$2
+
+ local vdevdir=$(dirname $(facet_vdevice $ost))
+ local cmd="$ZDB -e -p $vdevdir -dddd $(facet_device $ost)"
+ local blksz=$(do_facet $ost $cmd $objid |
+ awk '/dblk/{getline; printf $4}')
+
+ case "${blksz: -1}" in
+ k|K) blksz=$((${blksz:0:$((${#blksz} - 1))}*1024)) ;;
+ m|M) blksz=$((${blksz:0:$((${#blksz} - 1))}*1024*1024)) ;;
+ *) ;;
+ esac
+
+ echo $blksz
+}
+
+test_312() { # LU-4856
+ [ $(facet_fstype ost1) = "zfs" ] ||
+ { skip "the test only applies to zfs" && return; }
+
+ local max_blksz=$(do_facet ost1 \
+ $ZFS get -p recordsize $(facet_device ost1) |
+ awk '!/VALUE/{print $3}')
+
+ # to make life a little bit easier
+ $LFS mkdir -c 1 -i 0 $DIR/$tdir
+ $LFS setstripe -c 1 -i 0 $DIR/$tdir
+
+ local tf=$DIR/$tdir/$tfile
+ touch $tf
+ local oid=$($LFS getstripe $tf | awk '/obdidx/{getline; print $2}')
+
+ # Get ZFS object id
+ local zfs_objid=$(zfs_oid_to_objid ost1 $oid)
+
+ # block size change by sequential over write
+ local blksz
+ for ((bs=4096; bs <= max_blksz; bs <<= 2)); do
+ dd if=/dev/zero of=$tf bs=$bs count=1 oflag=sync conv=notrunc
+
+ blksz=$(zfs_object_blksz ost1 $zfs_objid)
+ [ $blksz -eq $bs ] || error "blksz error: $blksz, expected: $bs"
+ done
+ rm -f $tf
+
+ # block size change by sequential append write
+ dd if=/dev/zero of=$tf bs=4K count=1 oflag=sync conv=notrunc
+ oid=$($LFS getstripe $tf | awk '/obdidx/{getline; print $2}')
+ zfs_objid=$(zfs_oid_to_objid ost1 $oid)
+
+ for ((count = 1; count < $((max_blksz / 4096)); count *= 2)); do
+ dd if=/dev/zero of=$tf bs=4K count=$count seek=$count \
+ oflag=sync conv=notrunc
+
+ blksz=$(zfs_object_blksz ost1 $zfs_objid)
+ blksz=$((blksz / 8192)) # in 2*4K unit
+ [ $blksz -eq $count ] ||
+ error "blksz error(in 8k): $blksz, expected: $count"
+ done
+ rm -f $tf
+
+ # random write
+ touch $tf
+ oid=$($LFS getstripe $tf | awk '/obdidx/{getline; print $2}')
+ zfs_objid=$(zfs_oid_to_objid ost1 $oid)
+
+ dd if=/dev/zero of=$tf bs=8K count=1 oflag=sync conv=notrunc
+ blksz=$(zfs_object_blksz ost1 $zfs_objid)
+ [ $blksz -eq 8192 ] || error "blksz error: $blksz, expected: 8k"
+
+ dd if=/dev/zero of=$tf bs=64K count=1 oflag=sync conv=notrunc seek=128
+ blksz=$(zfs_object_blksz ost1 $zfs_objid)
+ [ $blksz -eq 65536 ] || error "blksz error: $blksz, expected: 64k"
+
+ dd if=/dev/zero of=$tf bs=1M count=1 oflag=sync conv=notrunc
+ blksz=$(zfs_object_blksz ost1 $zfs_objid)
+ [ $blksz -eq 65536 ] || error "rewrite error: $blksz, expected: 64k"
+}
+run_test 312 "make sure ZFS adjusts its block size by write pattern"
+
+test_399() { # LU-7655 for OST fake write
+ # turn off debug for performance testing
+ local saved_debug=$($LCTL get_param -n debug)
+ $LCTL set_param debug=0
+
+ $SETSTRIPE -c 1 -i 0 $DIR/$tfile
+
+ # get ost1 size - lustre-OST0000
+ local ost1_avail_size=$($LFS df | awk /${ost1_svc}/'{ print $4 }')
+ local blocks=$((ost1_avail_size/2/1024)) # half avail space by megabytes
+ [ $blocks -gt 1000 ] && blocks=1000 # 1G in maximum
+
+ local start_time=$(date +%s.%N)
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=$blocks oflag=sync ||
+ error "real dd writing error"
+ local duration=$(bc <<< "$(date +%s.%N) - $start_time")
+ rm -f $DIR/$tfile
+
+ # define OBD_FAIL_OST_FAKE_WRITE 0x238
+ do_facet ost1 $LCTL set_param fail_loc=0x238
+
+ local start_time=$(date +%s.%N)
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=$blocks oflag=sync ||
+ error "fake dd writing error"
+ local duration_fake=$(bc <<< "$(date +%s.%N) - $start_time")
+
+ # verify file size
+ cancel_lru_locks osc
+ $CHECKSTAT -t file -s $((blocks * 1024 * 1024)) $DIR/$tfile ||
+ error "$tfile size not $blocks MB"
+
+ do_facet ost1 $LCTL set_param fail_loc=0
+
+ echo "fake write $duration_fake vs. normal write $duration in seconds"
+ [ $(bc <<< "$duration_fake < $duration") -eq 1 ] ||
+ error_not_in_vm "fake write is slower"
+
+ $LCTL set_param -n debug="$saved_debug"
+ rm -f $DIR/$tfile
+}
+run_test 399 "fake write should not be slower than normal write"
+
test_400a() { # LU-1606, was conf-sanity test_74
local extra_flags=''
local out=$TMP/$tfile
}
run_test 406 "DNE support fs default striping"
+test_407() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+ [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.55) ]] &&
+ skip "Need MDS version at least 2.8.55" && return
+
+ $LFS mkdir -i 0 -c 1 $DIR/$tdir.0 ||
+ error "$LFS mkdir -i 0 -c 1 $tdir.0 failed"
+ $LFS mkdir -i 1 -c 1 $DIR/$tdir.1 ||
+ error "$LFS mkdir -i 1 -c 1 $tdir.1 failed"
+ touch $DIR/$tdir.0/$tfile.0 || error "touch $tdir.0/$tfile.0 failed"
+
+ #define OBD_FAIL_DT_TXN_STOP 0x2019
+ for idx in $(seq $MDSCOUNT); do
+ do_facet mds$idx "lctl set_param fail_loc=0x2019"
+ done
+ $LFS mkdir -c 2 $DIR/$tdir && error "$LFS mkdir -c 2 $tdir should fail"
+ mv $DIR/$tdir.0/$tfile.0 $DIR/$tdir.1/$tfile.1 &&
+ error "mv $tdir.0/$tfile.0 $tdir.1/$tfile.1 should fail"
+ true
+}
+run_test 407 "transaction fail should cause operation fail"
+
#
# tests that do cleanup/setup should be run at the end
#