}
run_test 27ce "more stripes than OSTs with -o"
+test_27cf() {
+ local osp_proc="osp.$FSNAME-OST0000-osc-MDT000*.active"
+ local pid=0
+
+ test_mkdir -p $DIR/$tdir || error "failed to mkdir $DIR/$tdir"
+ do_facet $SINGLEMDS "$LCTL set_param -n $osp_proc=0"
+ stack_trap "do_facet $SINGLEMDS $LCTL set_param -n $osp_proc=1" EXIT
+ wait_update_facet $SINGLEMDS "$LCTL get_param -n $osp_proc | grep 1" ||
+ error "failed to set $osp_proc=0"
+
+ $LFS setstripe -o 0 $DIR/$tdir/$tfile &
+ pid=$!
+ sleep 1
+ do_facet $SINGLEMDS "$LCTL set_param -n $osp_proc=1"
+ wait_update_facet $SINGLEMDS "$LCTL get_param -n $osp_proc | grep 0" ||
+ error "failed to set $osp_proc=1"
+ wait $pid
+ [[ $pid -ne 0 ]] ||
+ error "should return error due to $osp_proc=0"
+}
+run_test 27cf "'setstripe -o' on inactive OSTs should return error"
+
test_27d() {
test_mkdir $DIR/$tdir
$LFS setstripe -c 0 -i -1 -S 0 $DIR/$tdir/$tfile ||
}
run_test 56ra "check lfs find -size -lazy works for data on OSTs"
+test_56rb() {
+ local dir=$DIR/$tdir
+ local tmp=$TMP/$tfile.log
+ local mdt_idx;
+
+ test_mkdir -p $dir || error "failed to mkdir $dir"
+ $LFS setstripe -c 1 -i 0 $dir/$tfile ||
+ error "failed to setstripe $dir/$tfile"
+ dd if=/dev/zero of=$dir/$tfile bs=1M count=1
+
+ stack_trap "rm -f $tmp" EXIT
+ $LFS find --size +100K --ost 0 $dir 2>&1 | tee $tmp
+ [ -z "$(cat $tmp | grep "obd_uuid: ")" ] ||
+ error "failed to find --size +100K --ost 0 $dir"
+ $LFS find --size +100K --mdt $mdt_idx $dir 2>&1 | tee $tmp
+ [ -z "$(cat $tmp | grep "obd_uuid: ")" ] ||
+ error "failed to find --size +100K --mdt $mdt_idx $dir"
+}
+run_test 56rb "check lfs find --size --ost/--mdt works"
+
test_56s() { # LU-611 #LU-9369
[[ $OSTCOUNT -lt 2 ]] && skip_env "need at least 2 OSTs"
[ $PARALLEL == "yes" ] && skip "skip parallel run"
local file=$DIR/$tfile
- local sz_MB=${FILESIZE_101d:-500}
+ local sz_MB=${FILESIZE_101d:-80}
local ra_MB=${READAHEAD_MB:-40}
local free_MB=$(($(df -P $DIR | tail -n 1 | awk '{ print $4 }') / 1024))
stack_trap "$LCTL set_param -n llite.*.max_read_ahead_mb $old_RA" EXIT
$LCTL get_param -n llite.*.max_read_ahead_mb
- echo Reading the test file $file with read-ahead disabled
- local raOFF=$(do_and_time "dd if=$file of=/dev/null bs=1M count=$sz_MB")
+ echo "Reading the test file $file with read-ahead disabled"
+ local sz_KB=$((sz_MB * 1024 / 4))
+ # 10485760 bytes transferred in 0.000938 secs (11179579337 bytes/sec)
+ # 104857600 bytes (105 MB) copied, 0.00876352 s, 12.0 GB/s
+ local raOFF=$(LANG=C dd if=$file of=/dev/null bs=4k count=$sz_KB |&
+ sed -e '/records/d' -e 's/.* \([0-9]*\.[0-9]*\) *s.*/\1/')
- echo Cancel LRU locks on lustre client to flush the client cache
+ echo "Cancel LRU locks on lustre client to flush the client cache"
cancel_lru_locks osc
echo Enable read-ahead with ${ra_MB}MB
$LCTL set_param -n llite.*.max_read_ahead_mb=$ra_MB
- echo Reading the test file $file with read-ahead enabled
- local raON=$(do_and_time "dd if=$file of=/dev/null bs=1M count=$sz_MB")
+ echo "Reading the test file $file with read-ahead enabled"
+ local raON=$(LANG=C dd if=$file of=/dev/null bs=4k count=$sz_KB |&
+ sed -e '/records/d' -e 's/.* \([0-9]*\.[0-9]*\) *s.*/\1/')
echo "read-ahead disabled time read $raOFF"
- echo "read-ahead enabled time read $raON"
+ echo "read-ahead enabled time read $raON"
rm -f $file
wait_delete_completed
- [ $raOFF -le 1 ] || [ $raON -lt $raOFF ] ||
+ # use awk for this check instead of bash because it handles decimals
+ awk "{ exit !($raOFF < 1.0 || $raOFF > $raON) }" <<<"ignore_me" ||
error "readahead ${raON}s > no-readahead ${raOFF}s ${sz_MB}M"
}
run_test 101d "file read with and without read-ahead enabled"
}
run_test 101i "allow current readahead to exceed reservation"
+test_101j() {
+ $LFS setstripe -i 0 -c 1 $DIR/$tfile ||
+ error "setstripe $DIR/$tfile failed"
+ local file_size=$((1048576 * 16))
+ local old_ra=$($LCTL get_param -n llite.*.max_read_ahead_mb | head -n 1)
+ stack_trap "$LCTL set_param -n llite.*.max_read_ahead_mb $old_ra" EXIT
+
+ echo Disable read-ahead
+ $LCTL set_param -n llite.*.max_read_ahead_mb=0
+
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=$(($file_size / 1048576))
+ for blk in $PAGE_SIZE 1048576 $file_size; do
+ cancel_lru_locks osc
+ echo "Reset readahead stats"
+ $LCTL set_param -n llite.*.read_ahead_stats=0
+ local count=$(($file_size / $blk))
+ dd if=$DIR/$tfile bs=$blk count=$count of=/dev/null
+ local miss=$($LCTL get_param -n llite.*.read_ahead_stats |
+ get_named_value 'failed to fast read' |
+ cut -d" " -f1 | calc_total)
+ $LCTL get_param -n llite.*.read_ahead_stats
+ [ $miss -eq $count ] || error "expected $count got $miss"
+ done
+
+ rm -f $p $DIR/$tfile
+}
+run_test 101j "A complete read block should be submitted when no RA"
+
setup_test102() {
test_mkdir $DIR/$tdir
chown $RUNAS_ID $DIR/$tdir
fi
if [ $facet_ver -ge $(version_code 2.5.54) ]; then
do_facet $facet "$LCTL list_param -R '*' | grep '=' |
- tr -d= | egrep -v 'force_lbug|changelog_mask' |
+ tr -d = | egrep -v 'force_lbug|changelog_mask' |
xargs badarea_io" ||
error_133 "$facet badarea_io failed"
else
}
run_test 162c "fid2path works with paths 100 or more directories deep"
+oalr_event_count() {
+ local event="${1}"
+ local trace="${2}"
+
+ awk -v name="${FSNAME}-OST0000" \
+ -v event="${event}" \
+ '$1 == "TRACE" && $2 == event && $3 == name' \
+ "${trace}" |
+ wc -l
+}
+
+oalr_expect_event_count() {
+ local event="${1}"
+ local trace="${2}"
+ local expect="${3}"
+ local count
+
+ count=$(oalr_event_count "${event}" "${trace}")
+ if ((count == expect)); then
+ return 0
+ fi
+
+ error_noexit "${event} event count was '${count}', expected ${expect}"
+ cat "${trace}" >&2
+ exit 1
+}
+
+cleanup_165() {
+ do_facet ost1 killall --quiet -KILL ofd_access_log_reader || true
+ stop ost1
+ start ost1 "$(ostdevname 1)" $OST_MOUNT_OPTS
+}
+
+setup_165() {
+ sync # Flush previous IOs so we can count log entries.
+ do_facet ost1 $LCTL set_param "obdfilter.${FSNAME}-OST0000.access_log_size=4096"
+ stack_trap cleanup_165 EXIT
+}
+
+test_165a() {
+ local trace="/tmp/${tfile}.trace"
+ local rc
+ local count
+
+ do_facet ost1 ofd_access_log_reader --debug=- --trace=- > "${trace}" &
+ setup_165
+ sleep 5
+
+ do_facet ost1 ofd_access_log_reader --list
+ stop ost1
+
+ do_facet ost1 killall -TERM ofd_access_log_reader
+ wait
+ rc=$?
+
+ if ((rc != 0)); then
+ error "ofd_access_log_reader exited with rc = '${rc}'"
+ fi
+
+ # Parse trace file for discovery events:
+ oalr_expect_event_count alr_log_add "${trace}" 1
+ oalr_expect_event_count alr_log_eof "${trace}" 1
+ oalr_expect_event_count alr_log_free "${trace}" 1
+}
+run_test 165a "ofd access log discovery"
+
+test_165b() {
+ local trace="/tmp/${tfile}.trace"
+ local file="${DIR}/${tfile}"
+ local pfid1
+ local pfid2
+ local -a entry
+ local rc
+ local count
+ local size
+ local flags
+
+ setup_165
+
+ lfs setstripe -c 1 -i 0 "${file}"
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_WRONLY:w1048576c || error "cannot create '${file}'"
+ do_facet ost1 ofd_access_log_reader --list
+
+ do_facet ost1 ofd_access_log_reader --debug=- --trace=- > "${trace}" &
+ sleep 5
+ do_facet ost1 killall -TERM ofd_access_log_reader
+ wait
+ rc=$?
+
+ if ((rc != 0)); then
+ error "ofd_access_log_reader exited with rc = '${rc}'"
+ fi
+
+ oalr_expect_event_count alr_log_entry "${trace}" 1
+
+ pfid1=$($LFS path2fid "${file}")
+
+ # 1 2 3 4 5 6 7 8 9 10
+ # TRACE alr_log_entry OST PFID BEGIN END TIME SIZE COUNT FLAGS
+ entry=( - $(awk -v pfid="${pfid}" '$1 == "TRACE" && $2 == "alr_log_entry"' "${trace}" ) )
+
+ echo "entry = '${entry[*]}'" >&2
+
+ pfid2=${entry[4]}
+ if [[ "${pfid1}" != "${pfid2}" ]]; then
+ error "entry '${entry[*]}' has invalid PFID '${pfid2}', expected ${pfid1}"
+ fi
+
+ size=${entry[8]}
+ if ((size != 1048576)); then
+ error "entry '${entry[*]}' has invalid io size '${size}', expected 1048576"
+ fi
+
+ flags=${entry[10]}
+ if [[ "${flags}" != "w" ]]; then
+ error "entry '${entry[*]}' has invalid io flags '${flags}', expected 'w'"
+ fi
+
+ do_facet ost1 ofd_access_log_reader --debug=- --trace=- > "${trace}" &
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_RDONLY:r524288c || error "cannot read '${file}'"
+ sleep 5
+ do_facet ost1 killall -TERM ofd_access_log_reader
+ wait
+ rc=$?
+
+ if ((rc != 0)); then
+ error "ofd_access_log_reader exited with rc = '${rc}'"
+ fi
+
+ oalr_expect_event_count alr_log_entry "${trace}" 1
+
+ entry=( - $(awk -v pfid="${pfid}" '$1 == "TRACE" && $2 == "alr_log_entry"' "${trace}" ) )
+ echo "entry = '${entry[*]}'" >&2
+
+ pfid2=${entry[4]}
+ if [[ "${pfid1}" != "${pfid2}" ]]; then
+ error "entry '${entry[*]}' has invalid PFID '${pfid2}', expected ${pfid1}"
+ fi
+
+ size=${entry[8]}
+ if ((size != 524288)); then
+ error "entry '${entry[*]}' has invalid io size '${size}', 524288"
+ fi
+
+ flags=${entry[10]}
+ if [[ "${flags}" != "r" ]]; then
+ error "entry '${entry[*]}' has invalid io flags '${flags}', expected 'r'"
+ fi
+}
+run_test 165b "ofd access log entries are produced and consumed"
+
+test_165c() {
+ local file="${DIR}/${tdir}/${tfile}"
+ test_mkdir "${DIR}/${tdir}"
+
+ setup_165
+
+ lfs setstripe -c 1 -i 0 "${DIR}/${tdir}"
+
+ # 4096 / 64 = 64. Create twice as many entries.
+ for ((i = 0; i < 128; i++)); do
+ $MULTIOP "${file}-${i}" oO_CREAT:O_WRONLY:w512c || error "cannot create file"
+ done
+
+ sync
+ do_facet ost1 ofd_access_log_reader --list
+ unlinkmany "${file}-%d" 128
+}
+run_test 165c "full ofd access logs do not block IOs"
+
+oal_peek_entry_count() {
+ do_facet ost1 ofd_access_log_reader --list | awk '$1 == "_entry_count:" { print $2; }'
+}
+
+oal_expect_entry_count() {
+ local entry_count=$(oal_peek_entry_count)
+ local expect="$1"
+
+ if ((entry_count == expect)); then
+ return 0
+ fi
+
+ error_noexit "bad entry count, got ${entry_count}, expected ${expect}"
+ do_facet ost1 ofd_access_log_reader --list >&2
+ exit 1
+}
+
+test_165d() {
+ local trace="/tmp/${tfile}.trace"
+ local file="${DIR}/${tdir}/${tfile}"
+ local param="obdfilter.${FSNAME}-OST0000.access_log_mask"
+ local entry_count
+ test_mkdir "${DIR}/${tdir}"
+
+ setup_165
+ lfs setstripe -c 1 -i 0 "${file}"
+
+ do_facet ost1 lctl set_param "${param}=rw"
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_WRONLY:w1048576c || error "cannot create '${file}'"
+ oal_expect_entry_count 1
+
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_RDONLY:r1048576c || error "cannot read '${file}'"
+ oal_expect_entry_count 2
+
+ do_facet ost1 lctl set_param "${param}=r"
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_WRONLY:w1048576c || error "cannot create '${file}'"
+ oal_expect_entry_count 2
+
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_RDONLY:r1048576c || error "cannot read '${file}'"
+ oal_expect_entry_count 3
+
+ do_facet ost1 lctl set_param "${param}=w"
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_WRONLY:w1048576c || error "cannot create '${file}'"
+ oal_expect_entry_count 4
+
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_RDONLY:r1048576c || error "cannot read '${file}'"
+ oal_expect_entry_count 4
+
+ do_facet ost1 lctl set_param "${param}=0"
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_WRONLY:w1048576c || error "cannot create '${file}'"
+ oal_expect_entry_count 4
+
+ $MULTIOP "${file}" oO_CREAT:O_DIRECT:O_RDONLY:r1048576c || error "cannot read '${file}'"
+ oal_expect_entry_count 4
+}
+run_test 165d "ofd_access_log mask works"
+
test_169() {
# do directio so as not to populate the page cache
log "creating a 10 Mb file"
}
run_test 230m "xattrs not changed after dir migration"
+test_230n() {
+ [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
+ [[ $MDS1_VERSION -ge $(version_code 2.13.53) ]] ||
+ skip "Need MDS version at least 2.13.53"
+
+ $LFS mkdir -i 0 $DIR/$tdir || error "mkdir $tdir failed"
+ cat /etc/hosts > $DIR/$tdir/$tfile
+ $LFS mirror extend -N1 $DIR/$tdir/$tfile || error "Mirroring failed"
+ $LFS migrate -m 1 $DIR/$tdir || error "Migration failed"
+
+ cmp /etc/hosts $DIR/$tdir/$tfile ||
+ error "File data mismatch after migration"
+}
+run_test 230n "Dir migration with mirrored file"
+
test_231a()
{
# For simplicity this test assumes that max_pages_per_rpc
}
run_test 270f "DoM: maximum DoM stripe size checks"
+test_270g() {
+ [ $MDS1_VERSION -ge $(version_code 2.13.52) ] ||
+ skip "Need MDS version at least 2.13.52"
+ local dom=$DIR/$tdir/$tfile
+
+ $LFS mkdir -i 0 -c 1 $DIR/$tdir
+ local lodname=${FSNAME}-MDT0000-mdtlov
+
+ local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ save_lustre_params mds1 "lod.${lodname}.dom_stripesize_max_kb" > $save
+ save_lustre_params mds1 "lod.${lodname}.dom_threshold_free_mb" >> $save
+ stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
+
+ local dom_limit=1024
+ local dom_threshold="50%"
+
+ $LFS setstripe -d $DIR/$tdir
+ $LFS setstripe -E ${dom_limit}K -L mdt $DIR/$tdir ||
+ error "Can't set directory default striping"
+
+ do_facet mds1 $LCTL set_param -n \
+ lod.${lodname}.dom_stripesize_max_kb=$dom_limit
+ # set 0 threshold and create DOM file to change tunable stripesize
+ do_facet mds1 $LCTL set_param -n lod.${lodname}.dom_threshold_free_mb=0
+ $LFS setstripe -E ${dom_limit}K -L mdt -E -1 $dom ||
+ error "Failed to create $dom file"
+ # now tunable dom_cur_stripesize should reach maximum
+ local dom_current=$(do_facet mds1 $LCTL get_param -n \
+ lod.${lodname}.dom_stripesize_cur_kb)
+ [[ $dom_current == $dom_limit ]] ||
+ error "Current DOM stripesize is not maximum"
+ rm $dom
+
+ # set threshold for further tests
+ do_facet mds1 $LCTL set_param -n \
+ lod.${lodname}.dom_threshold_free_mb=$dom_threshold
+ echo "DOM threshold is $dom_threshold free space"
+ local dom_def
+ local dom_set
+ # Spoof bfree to exceed threshold
+ #define OBD_FAIL_MDS_STATFS_SPOOF 0x168
+ do_facet mds1 $LCTL set_param -n fail_loc=0x0168
+ for spfree in 40 20 0 15 30 55; do
+ do_facet mds1 $LCTL set_param -n fail_val=$spfree
+ $LFS setstripe -E ${dom_limit}K -L mdt -E -1 $dom ||
+ error "Failed to create $dom file"
+ dom_def=$(do_facet mds1 $LCTL get_param -n \
+ lod.${lodname}.dom_stripesize_cur_kb)
+ echo "Free space: ${spfree}%, default DOM stripe: ${dom_def}K"
+ [[ $dom_def != $dom_current ]] ||
+ error "Default stripe size was not changed"
+ if [[ $spfree > 0 ]] ; then
+ dom_set=$($LFS getstripe -S $dom)
+ [[ $dom_set == $((dom_def * 1024)) ]] ||
+ error "DOM component size is still old"
+ else
+ [[ $($LFS getstripe -L $dom) != "mdt" ]] ||
+ error "DoM component is set with no free space"
+ fi
+ rm $dom
+ dom_current=$dom_def
+ done
+}
+run_test 270g "DoM: default DoM stripe size depends on free space"
+
test_271a() {
[ $MDS1_VERSION -lt $(version_code 2.10.55) ] &&
skip "Need MDS version at least 2.10.55"
do_facet $SINGLEMDS zfs set quota=$(((usedkb+freekb)*1024)) $fsset
trap cleanup_805 EXIT
mkdir $DIR/$tdir
- $LFS setstripe -E 1M -L mdt $DIR/$tdir || error "DoM not working"
+ $LFS setstripe -E 1M -c2 -E 4M -c2 -E -1 -c2 $DIR/$tdir ||
+ error "Can't set PFL layout"
createmany -m $DIR/$tdir/f- 1000000 && error "ENOSPC wasn't met"
rm -rf $DIR/$tdir || error "not able to remove"
do_facet $SINGLEMDS zfs set quota=$old $fsset
error "truncate $tdir/trunc failed"
local bs=1048576
- dd if=/dev/zero of=$DIR/$tdir/single_dd bs=$bs count=1 ||
+ dd if=/dev/zero of=$DIR/$tdir/single_dd bs=$bs count=1 conv=fsync ||
error "write $tfile failed"
# multi-client wirtes
wait ${pids[$i]}
done
- sleep 5
+ do_rpc_nodes "$CLIENTS" cancel_lru_locks osc
+ do_nodes "$CLIENTS" "sync ; sleep 5 ; sync"
$LSOM_SYNC -u $cl_user -m $FSNAME-MDT0000 $MOUNT
check_lsom_data $DIR/$tdir/trunc
check_lsom_data $DIR/$tdir/single_dd