Whamcloud - gitweb
LU-13138 tests: measure 'dd' time more accurately
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 29d5033..860e95f 100755 (executable)
@@ -31,8 +31,8 @@ GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
 export PARALLEL=${PARALLEL:-"no"}
 
 TRACE=${TRACE:-""}
-LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
+LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 
@@ -75,7 +75,7 @@ if (( $LINUX_VERSION_CODE >= $(version_code 4.18.0) &&
        ALWAYS_EXCEPT+=" 411"
 fi
 
-#                                  5          12          (min)"
+#                                  5          12     8   12  (min)"
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="27m 64b 68 71 115 135 136 300o"
 
 if [ "$mds1_FSTYPE" = "zfs" ]; then
@@ -1635,6 +1635,28 @@ test_27ce() {
 }
 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 ||
@@ -3749,6 +3771,46 @@ test_33g() {
 }
 run_test 33g "nonroot user create already existing root created file"
 
+test_33h() {
+       [ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
+       [ $MDS1_VERSION -lt $(version_code 2.13.50) ] &&
+               skip "Need MDS version at least 2.13.50"
+
+       test_mkdir -c $MDSCOUNT -H crush $DIR/$tdir ||
+               error "mkdir $tdir failed"
+       touch $DIR/$tdir/$tfile || error "touch $tfile failed"
+
+       local index=$($LFS getstripe -m $DIR/$tdir/$tfile)
+       local index2
+
+       for fname in $DIR/$tdir/$tfile.bak \
+                    $DIR/$tdir/$tfile.SAV \
+                    $DIR/$tdir/$tfile.orig \
+                    $DIR/$tdir/$tfile~; do
+               touch $fname  || error "touch $fname failed"
+               index2=$($LFS getstripe -m $fname)
+               [ $index -eq $index2 ] ||
+                       error "$fname MDT index mismatch $index != $index2"
+       done
+
+       local failed=0
+       for i in {1..50}; do
+               for fname in $(mktemp -u $DIR/$tdir/.$tfile.XXXXXX) \
+                            $(mktemp $DIR/$tdir/$tfile.XXXXXXXX); do
+                       touch $fname  || error "touch $fname failed"
+                       index2=$($LFS getstripe -m $fname)
+                       if [[ $index != $index2 ]]; then
+                               failed=$((failed + 1))
+                               echo "$fname MDT index mismatch $index != $index2"
+                       fi
+               done
+       done
+       echo "$failed MDT index mismatches"
+       (( failed < 4 )) || error "MDT index mismatch $failed times"
+
+}
+run_test 33h "temp file is located on the same MDT as target"
+
 TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
 test_34a() {
        rm -f $DIR/f34
@@ -4468,6 +4530,49 @@ test_39p() {
 }
 run_test 39p "remote directory cached attributes updated after create ========"
 
+test_39r() {
+       [ $OST1_VERSION -ge $(version_code 2.13.52) ] ||
+               skip "no atime update on old OST"
+       if [ "$ost1_FSTYPE" != ldiskfs ]; then
+               skip_env "ldiskfs only test"
+       fi
+
+       local saved_adiff
+       saved_adiff=$(do_facet ost1 \
+               lctl get_param -n obdfilter.*OST0000.atime_diff)
+       stack_trap "do_facet ost1 \
+               lctl set_param obdfilter.*.atime_diff=$saved_adiff"
+
+       do_facet ost1 "lctl set_param obdfilter.*.atime_diff=5"
+
+       $LFS setstripe -i 0 $DIR/$tfile
+       dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
+               error "can't write initial file"
+       cancel_lru_locks osc
+
+       # exceed atime_diff and access file
+       sleep 6
+       dd if=$DIR/$tfile of=/dev/null || error "can't udpate atime"
+
+       local atime_cli=$(stat -c %X $DIR/$tfile)
+       echo "client atime: $atime_cli"
+       # allow atime update to be written to device
+       do_facet ost1 "$LCTL set_param -n osd*.*OST*.force_sync 1"
+       sleep 5
+
+       local ostdev=$(ostdevname 1)
+       local fid=($(lfs getstripe -y $DIR/$tfile |
+                       awk '/l_fid:/ { print $2 }' | tr ':' ' '))
+       local objpath="O/0/d$((${fid[1]} % 32))/$((${fid[1]}))"
+       local cmd="debugfs -c -R \\\"stat $objpath\\\" $ostdev"
+
+       echo "OST atime: $(do_facet ost1 "$cmd" |& grep atime)"
+       local atime_ost=$(do_facet ost1 "$cmd" |&
+                         awk -F'[: ]' '/atime:/ { print $4 }')
+       (( atime_cli == atime_ost )) ||
+               error "atime on client $atime_cli != ost $atime_ost"
+}
+run_test 39r "lazy atime update on OST"
 
 test_39q() { # LU-8041
        local testdir=$DIR/$tdir
@@ -6089,6 +6194,26 @@ test_56ra() {
 }
 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"
 
@@ -6438,7 +6563,9 @@ test_56wb() {
        echo "done."
 
        echo -n "Removing test file from pool '$pool'..."
-       $LFS migrate $file1 &> /dev/null ||
+       # "lfs migrate $file" won't remove the file from the pool
+       # until some striping information is changed.
+       $LFS migrate -c 1 $file1 &> /dev/null ||
                error "cannot remove from pool"
        [ "$($LFS getstripe -p $file1)" ] &&
                error "pool still set"
@@ -6460,19 +6587,23 @@ run_test 56wb "check lfs_migrate pool support"
 
 test_56wc() {
        local file1="$DIR/$tdir/file1"
+       local parent_ssize
+       local parent_scount
+       local cur_ssize
+       local cur_scount
+       local orig_ssize
 
        echo -n "Creating test dir..."
        test_mkdir $DIR/$tdir &> /dev/null || error "cannot create dir"
-       local def_stripe_size=$($LFS getstripe -S $DIR/$tdir 2>/dev/null)
        $LFS setstripe -S 1M -c 1 "$DIR/$tdir" &> /dev/null ||
-               error "cannot set stripe"
+               error "cannot set stripe by '-S 1M -c 1'"
        echo "done"
 
        echo -n "Setting initial stripe for test file..."
        $LFS setstripe -S 512K -c 1 "$file1" &> /dev/null ||
                error "cannot set stripe"
-       [ $($LFS getstripe -S "$file1") -eq 524288 ] ||
-               error "stripe size not set"
+       cur_ssize=$($LFS getstripe -S "$file1")
+       [ $cur_ssize -eq 524288 ] || error "setstripe -S $cur_ssize != 524288"
        echo "done."
 
        # File currently set to -S 512K -c 1
@@ -6489,8 +6620,8 @@ test_56wc() {
        echo -n "Verifying -S option is passed through to lfs migrate..."
        $LFS_MIGRATE -y -S 1M "$file1" &> /dev/null ||
                error "migration failed"
-       [ $($LFS getstripe -S "$file1") -eq 1048576 ] ||
-               error "file was not restriped"
+       cur_ssize=$($LFS getstripe -S "$file1")
+       [ $cur_ssize -eq 1048576 ] || error "migrate -S $cur_ssize != 1048576"
        echo "done."
 
        # File currently set to -S 1M -c 1
@@ -6501,8 +6632,9 @@ test_56wc() {
                error "long option without argument not supported"
        $LFS_MIGRATE -y --stripe-size 512K "$file1" &> /dev/null ||
                error "long option with argument not supported"
-       [ $($LFS getstripe -S "$file1") -eq 524288 ] ||
-               error "file not restriped with --stripe-size option"
+       cur_ssize=$($LFS getstripe -S "$file1")
+       [ $cur_ssize -eq 524288 ] ||
+               error "migrate --stripe-size $cur_ssize != 524288"
        echo "done."
 
        # File currently set to -S 512K -c 1
@@ -6511,8 +6643,8 @@ test_56wc() {
                echo -n "Verifying explicit stripe count can be set..."
                $LFS_MIGRATE -y -c 2 "$file1" &> /dev/null ||
                        error "migrate failed"
-               [ $($LFS getstripe -c "$file1") -eq 2 ] ||
-                       error "file not restriped to explicit count"
+               cur_scount=$($LFS getstripe -c "$file1")
+               [ $cur_scount -eq 2 ] || error "migrate -c $cur_scount != 2"
                echo "done."
        fi
 
@@ -6521,17 +6653,21 @@ test_56wc() {
        # Ensure parent striping is used if -R is set, and no stripe
        # count or size is specified
        echo -n "Setting stripe for parent directory..."
-       $LFS setstripe -S 1M -c 1 "$DIR/$tdir" &> /dev/null ||
-               error "cannot set stripe"
+       $LFS setstripe -S 2M -c 1 "$DIR/$tdir" &> /dev/null ||
+               error "cannot set stripe '-S 2M -c 1'"
        echo "done."
 
        echo -n "Verifying restripe option uses parent stripe settings..."
+       parent_ssize=$($LFS getstripe -S $DIR/$tdir 2>/dev/null)
+       parent_scount=$($LFS getstripe -c $DIR/$tdir 2>/dev/null)
        $LFS_MIGRATE -y -R "$file1" &> /dev/null ||
                error "migrate failed"
-       [ $($LFS getstripe -S "$file1") -eq $def_stripe_size ] ||
-               error "file not restriped to parent settings"
-       [ $($LFS getstripe -c "$file1") -eq 1 ] ||
-               error "file not restriped to parent settings"
+       cur_ssize=$($LFS getstripe -S "$file1")
+       [ $cur_ssize -eq $parent_ssize ] ||
+               error "migrate -R stripe_size $cur_ssize != $parent_ssize"
+       cur_scount=$($LFS getstripe -c "$file1")
+       [ $cur_scount -eq $parent_scount ] ||
+               error "migrate -R stripe_count $cur_scount != $parent_scount"
        echo "done."
 
        # File currently set to -S 1M -c 1
@@ -6539,13 +6675,14 @@ test_56wc() {
        # Ensure striping is preserved if -R is not set, and no stripe
        # count or size is specified
        echo -n "Verifying striping size preserved when not specified..."
-       local orig_stripe_size=$($LFS getstripe -S "$file1" 2>/dev/null)
+       orig_ssize=$($LFS getstripe -S "$file1" 2>/dev/null)
        $LFS setstripe -S 2M -c 1 "$DIR/$tdir" &> /dev/null ||
                error "cannot set stripe on parent directory"
        $LFS_MIGRATE -y "$file1" &> /dev/null ||
                error "migrate failed"
-       [ $($LFS getstripe -S "$file1") -eq $orig_stripe_size ] ||
-               error "file was restriped"
+       cur_ssize=$($LFS getstripe -S "$file1")
+       [ $cur_ssize -eq $orig_ssize ] ||
+               error "migrate by default $cur_ssize != $orig_ssize"
        echo "done."
 
        # Ensure file name properly detected when final option has no argument
@@ -6833,6 +6970,75 @@ test_56xc() {
 }
 run_test 56xc "lfs migration autostripe"
 
+test_56xd() {
+       [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
+
+       local dir=$DIR/$tdir
+       local f_mgrt=$dir/$tfile.mgrt
+       local f_yaml=$dir/$tfile.yaml
+       local f_copy=$dir/$tfile.copy
+       local layout_yaml="-E 1M -S 512K -c 1 -E -1 -S 1M -c 2 -i 0"
+       local layout_copy="-c 2 -S 2M -i 1"
+       local yamlfile=$dir/yamlfile
+       local layout_before;
+       local layout_after;
+
+       test_mkdir "$dir" || error "cannot create dir $dir"
+       $LFS setstripe $layout_yaml $f_yaml ||
+               error "cannot setstripe $f_yaml with layout $layout_yaml"
+       $LFS getstripe --yaml $f_yaml > $yamlfile
+       $LFS setstripe $layout_copy $f_copy ||
+               error "cannot setstripe $f_copy with layout $layout_copy"
+       touch $f_mgrt
+       dd if=/dev/zero of=$f_mgrt bs=1M count=4
+
+       # 1. test option --yaml
+       $LFS_MIGRATE -y --yaml $yamlfile $f_mgrt ||
+               error "cannot migrate $f_mgrt with --yaml $yamlfile"
+       layout_before=$(get_layout_param $f_yaml)
+       layout_after=$(get_layout_param $f_mgrt)
+       [ "$layout_after" == "$layout_before" ] ||
+               error "lfs_migrate --yaml: $layout_after != $layout_before"
+
+       # 2. test option --copy
+       $LFS_MIGRATE -y --copy $f_copy $f_mgrt ||
+               error "cannot migrate $f_mgrt with --copy $f_copy"
+       layout_before=$(get_layout_param $f_copy)
+       layout_after=$(get_layout_param $f_mgrt)
+       [ "$layout_after" == "$layout_before" ] ||
+               error "lfs_migrate --copy: $layout_after != $layout_before"
+}
+run_test 56xd "check lfs_migrate --yaml and --copy support"
+
+test_56xe() {
+       [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
+
+       local dir=$DIR/$tdir
+       local f_comp=$dir/$tfile
+       local layout="-E 1M -S 512K -c 1 -E -1 -S 1M -c 2 -i 0"
+       local layout_before=""
+       local layout_after=""
+
+       test_mkdir "$dir" || error "cannot create dir $dir"
+       $LFS setstripe $layout $f_comp ||
+               error "cannot setstripe $f_comp with layout $layout"
+       layout_before=$(get_layout_param $f_comp)
+       dd if=/dev/zero of=$f_comp bs=1M count=4
+
+       # 1. migrate a comp layout file by lfs_migrate
+       $LFS_MIGRATE -y $f_comp || error "cannot migrate $f_comp by lfs_migrate"
+       layout_after=$(get_layout_param $f_comp)
+       [ "$layout_before" == "$layout_after" ] ||
+               error "lfs_migrate: $layout_before != $layout_after"
+
+       # 2. migrate a comp layout file by lfs migrate
+       $LFS migrate $f_comp || error "cannot migrate $f_comp by lfs migrate"
+       layout_after=$(get_layout_param $f_comp)
+       [ "$layout_before" == "$layout_after" ] ||
+               error "lfs migrate: $layout_before != $layout_after"
+}
+run_test 56xe "migrate a composite layout file"
+
 test_56y() {
        [ $MDS1_VERSION -lt $(version_code 2.4.53) ] &&
                skip "No HSM $(lustre_build_version $SINGLEMDS) MDS < 2.4.53"
@@ -7492,8 +7698,8 @@ run_test 63b "async write errors should be returned to fsync ==="
 test_64a () {
        [ $PARALLEL == "yes" ] && skip "skip parallel run"
 
-       df $DIR
-       lctl get_param -n osc.*[oO][sS][cC][_-]*.cur* | grep "[0-9]"
+       lfs df $DIR
+       lctl get_param osc.*[oO][sS][cC][_-]*.cur* | grep "=[1-9]"
 }
 run_test 64a "verify filter grant calculations (in kernel) ====="
 
@@ -8156,28 +8362,27 @@ num_inodes() {
 test_76() { # Now for bug 20433, added originally in bug 1443
        [ $PARALLEL == "yes" ] && skip "skip parallel run"
 
-       local CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
-
        cancel_lru_locks osc
-       BEFORE_INODES=$(num_inodes)
-       echo "before inodes: $BEFORE_INODES"
-       local COUNT=1000
-       [ "$SLOW" = "no" ] && COUNT=100
-       for i in $(seq $COUNT); do
+       local cpus=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
+       local before=$(num_inodes)
+       local count=$((512 * cpus))
+       [ "$SLOW" = "no" ] && count=$((64 * cpus))
+
+       echo "before inodes: $before"
+       for i in $(seq $count); do
                touch $DIR/$tfile
                rm -f $DIR/$tfile
        done
        cancel_lru_locks osc
-       AFTER_INODES=$(num_inodes)
-       echo "after inodes: $AFTER_INODES"
-       local wait=0
-       while [[ $((AFTER_INODES-1*${CPUS:-1})) -gt $BEFORE_INODES ]]; do
-               sleep 2
-               AFTER_INODES=$(num_inodes)
-               wait=$((wait+2))
-               echo "wait $wait seconds inodes: $AFTER_INODES"
-               if [ $wait -gt 30 ]; then
-                       error "inode slab grew from $BEFORE_INODES to $AFTER_INODES"
+       local after=$(num_inodes)
+       echo "after inodes: $after"
+       while (( after > before + 8 * ${cpus:-1} )); do
+               sleep 1
+               after=$(num_inodes)
+               wait=$((wait + 1))
+               (( wait % 5 == 0 )) && echo "wait $wait seconds inodes: $after"
+               if (( wait > 30 )); then
+                       error "inode slab grew from $before to $after"
                fi
        done
 }
@@ -8936,7 +9141,7 @@ test_101d() {
        [ $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))
@@ -8956,24 +9161,30 @@ test_101d() {
        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"
@@ -9153,6 +9364,58 @@ test_101h() {
 }
 run_test 101h "Readahead should cover current read window"
 
+test_101i() {
+       dd if=/dev/zero of=$DIR/$tfile bs=1M count=10 ||
+               error "dd 10M file failed"
+
+       local max_per_file_mb=$($LCTL get_param -n \
+               llite.*.max_read_ahead_per_file_mb 2>/dev/null)
+       cancel_lru_locks osc
+       stack_trap "$LCTL set_param llite.*.max_read_ahead_per_file_mb=$max_per_file_mb"
+       $LCTL set_param llite.*.max_read_ahead_per_file_mb=1 ||
+               error "set max_read_ahead_per_file_mb to 1 failed"
+
+       echo "Reset readahead stats"
+       $LCTL set_param llite.*.read_ahead_stats=0
+
+       dd if=$DIR/$tfile of=/dev/null bs=2M
+
+       $LCTL get_param llite.*.read_ahead_stats
+       local miss=$($LCTL get_param -n llite.*.read_ahead_stats |
+                    awk '/misses/ { print $2 }')
+       [ $miss -eq 5 ] || error "expected misses 5 but got $miss"
+       rm -f $DIR/$tfile
+}
+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
@@ -12501,7 +12764,7 @@ test_133g() {
                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
@@ -12659,7 +12922,7 @@ test_136() {
        local fname
 
        mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
-       $SETSTRIPE -c 1 -i 0 $DIR/$tdir || error "failed to set striping"
+       $LFS setstripe -c 1 -i 0 $DIR/$tdir || error "failed to set striping"
        #set only one record at plain llog
 #define OBD_FAIL_CATALOG_FULL_CHECK                0x131a
        do_facet $SINGLEMDS $LCTL set_param fail_loc=0x131a fail_val=1
@@ -13872,7 +14135,9 @@ test_160f() {
        local i
 
        # generate some changelog records to accumulate on each MDT
-       test_mkdir -c $MDSCOUNT $DIR/$tdir || error "test_mkdir $tdir failed"
+       # use fnv1a because created files should be evenly distributed
+       test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+               error "test_mkdir $tdir failed"
        log "$(date +%s): creating first files"
        createmany -m $DIR/$tdir/$tfile $((MDSCOUNT * 2)) ||
                error "create $DIR/$tdir/$tfile failed"
@@ -13998,7 +14263,9 @@ test_160g() {
        local i
 
        # generate some changelog records to accumulate on each MDT
-       test_mkdir -c $MDSCOUNT $DIR/$tdir || error "mkdir $tdir failed"
+       # use fnv1a because created files should be evenly distributed
+       test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+               error "mkdir $tdir failed"
        createmany -m $DIR/$tdir/$tfile $((MDSCOUNT * 2)) ||
                error "create $DIR/$tdir/$tfile failed"
 
@@ -14112,7 +14379,9 @@ test_160h() {
        local i
 
        # generate some changelog records to accumulate on each MDT
-       test_mkdir -c $MDSCOUNT $DIR/$tdir || error "test_mkdir $tdir failed"
+       # use fnv1a because created files should be evenly distributed
+       test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+               error "test_mkdir $tdir failed"
        createmany -m $DIR/$tdir/$tfile $((MDSCOUNT * 2)) ||
                error "create $DIR/$tdir/$tfile failed"
 
@@ -14261,7 +14530,9 @@ test_160i() {
        changelog_register || error "first changelog_register failed"
 
        # generate some changelog records to accumulate on each MDT
-       test_mkdir -c $MDSCOUNT $DIR/$tdir || error "mkdir $tdir failed"
+       # use fnv1a because created files should be evenly distributed
+       test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+               error "mkdir $tdir failed"
        createmany -m $DIR/$tdir/$tfile $((MDSCOUNT * 2)) ||
                error "create $DIR/$tdir/$tfile failed"
 
@@ -14326,7 +14597,9 @@ test_160j() {
        stack_trap "changelog_deregister" EXIT
 
        # generate some changelog
-       test_mkdir -c $MDSCOUNT $DIR/$tdir || error "mkdir $tdir failed"
+       # use fnv1a because created files should be evenly distributed
+       test_mkdir -c $MDSCOUNT -H fnv_1a_64 $DIR/$tdir ||
+               error "mkdir $tdir failed"
        createmany -m $DIR/$tdir/${tfile}bis $((MDSCOUNT * 2)) ||
                error "create $DIR/$tdir/${tfile}bis failed"
 
@@ -14349,7 +14622,6 @@ test_160j() {
                error "User $cl_user not found in changelog_users"
 
        printf 'clear:'$cl_user':0' >&3
-
 }
 run_test 160j "client can be umounted  while its chanangelog is being used"
 
@@ -14708,6 +14980,233 @@ test_162c() {
 }
 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"
@@ -16602,6 +17101,27 @@ test_230b() {
        ln -s $migrate_dir/$tfile $migrate_dir/${tfile}_ln
        ln -s $other_dir/$tfile $migrate_dir/${tfile}_ln_other
 
+       local len
+       local lnktgt
+
+       # inline symlink
+       for len in 58 59 60; do
+               lnktgt=$(str_repeat 'l' $len)
+               touch $migrate_dir/$lnktgt
+               ln -s $lnktgt $migrate_dir/${len}char_ln
+       done
+
+       # PATH_MAX
+       for len in 4094 4095; do
+               lnktgt=$(str_repeat 'l' $len)
+               ln -s $lnktgt $migrate_dir/${len}char_ln
+       done
+
+       # NAME_MAX
+       for len in 254 255; do
+               touch $migrate_dir/$(str_repeat 'l' $len)
+       done
+
        $LFS migrate -m $MDTIDX $migrate_dir ||
                error "fails on migrating remote dir to MDT1"
 
@@ -16609,7 +17129,8 @@ test_230b() {
        for ((i = 0; i < 10; i++)); do
                for file in $(find $migrate_dir/dir_${i}); do
                        mdt_index=$($LFS getstripe -m $file)
-                       [ $mdt_index == $MDTIDX ] ||
+                       # broken symlink getstripe will fail
+                       [ $mdt_index -ne $MDTIDX ] && stat -L $file &&
                                error "$file is not on MDT${MDTIDX}"
                done
        done
@@ -16673,7 +17194,7 @@ test_230b() {
        echo "migrate back to MDT0, checking.."
        for file in $(find $migrate_dir); do
                mdt_index=$($LFS getstripe -m $file)
-               [ $mdt_index == $MDTIDX ] ||
+               [ $mdt_index -ne $MDTIDX ] && stat -L $file &&
                        error "$file is not on MDT${MDTIDX}"
        done
 
@@ -16827,7 +17348,7 @@ test_230d() {
        old_count=$((MDSCOUNT - old_index))
        new_index=$((RANDOM % MDSCOUNT))
        new_count=$((MDSCOUNT - new_index))
-       new_hash="all_char"
+       new_hash=1 # for all_char
 
        [ $old_count -gt 1 ] && old_count=$((old_count - RANDOM % old_count))
        [ $new_count -gt 1 ] && new_count=$((new_count - RANDOM % new_count))
@@ -17151,6 +17672,21 @@ test_230m() {
 }
 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
@@ -18801,6 +19337,71 @@ test_270f() {
 }
 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"
@@ -19386,6 +19987,25 @@ test_278() {
 }
 run_test 278 "Race starting MDS between MDTs stop/start"
 
+test_280() {
+       [ $MGS_VERSION -lt $(version_code 2.13.52) ] &&
+               skip "Need MGS version at least 2.13.52"
+       [ $PARALLEL == "yes" ] && skip "skip parallel run"
+       combined_mgs_mds || skip "needs combined MGS/MDT"
+
+       umount_client $MOUNT
+#define OBD_FAIL_MDS_LLOG_UMOUNT_RACE   0x15e
+       do_facet mgs $LCTL set_param fail_loc=0x8000015e fail_val=0
+
+       mount_client $MOUNT &
+       sleep 1
+       stop mgs || error "stop mgs failed"
+       #for a race mgs would crash
+       start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "start mgs failed"
+       mount_client $MOUNT || error "mount client failed"
+}
+run_test 280 "Race between MGS umount and client llog processing"
+
 cleanup_test_300() {
        trap 0
        umask $SAVE_UMASK
@@ -19539,12 +20159,22 @@ test_300d() {
        #local striped directory
        $LFS setdirstripe -i 0 -c 2 -H all_char $DIR/$tdir/striped_dir ||
                error "set striped dir error"
+        #look at the directories for debug purposes
+       ls -l $DIR/$tdir
+       $LFS getdirstripe $DIR/$tdir
+       ls -l $DIR/$tdir/striped_dir
+       $LFS getdirstripe $DIR/$tdir/striped_dir
        createmany -o $DIR/$tdir/striped_dir/f 10 ||
                error "create 10 files failed"
 
        #remote striped directory
        $LFS setdirstripe -i 1 -c 2 $DIR/$tdir/remote_striped_dir ||
                error "set striped dir error"
+        #look at the directories for debug purposes
+       ls -l $DIR/$tdir
+       $LFS getdirstripe $DIR/$tdir
+       ls -l $DIR/$tdir/remote_striped_dir
+       $LFS getdirstripe $DIR/$tdir/remote_striped_dir
        createmany -o $DIR/$tdir/remote_striped_dir/f 10 ||
                error "create 10 files failed"
 
@@ -20393,7 +21023,7 @@ test_316() {
        chown nobody $DIR/$tdir/d
        touch $DIR/$tdir/d/file
 
-       $LFS mv -M1 $DIR/$tdir/d || error "lfs mv failed"
+       $LFS mv -m1 $DIR/$tdir/d || error "lfs mv failed"
 }
 run_test 316 "lfs mv"
 
@@ -20475,9 +21105,8 @@ test_318() {
                           llite.*.max_read_ahead_async_active 2>/dev/null)
        [ $max_active -ne 256 ] && error "expected 256 but got $max_active"
 
-       # currently reset to 0 is unsupported, leave it 512 for now.
-       $LCTL set_param llite.*.max_read_ahead_async_active=0 &&
-               error "set max_read_ahead_async_active should fail"
+       $LCTL set_param llite.*.max_read_ahead_async_active=0 ||
+               error "set max_read_ahead_async_active should succeed"
 
        $LCTL set_param llite.*.max_read_ahead_async_active=512
        max_active=$($LCTL get_param -n \
@@ -20720,6 +21349,10 @@ test_400a() { # LU-1606, was conf-sanity test_74
        local prefix=/usr/include/lustre
        local prog
 
+       # Oleg removes c files in his test rig so test if any c files exist
+       [ -z "$(ls -A $LUSTRE_TESTS_API_DIR)" ] && \
+               skip_env "Needed c test files are missing"
+
        if ! [[ -d $prefix ]]; then
                # Assume we're running in tree and fixup the include path.
                extra_flags+=" -I$LUSTRE/../lnet/include/uapi -I$LUSTRE/include/uapi -I$LUSTRE/include"
@@ -20727,7 +21360,7 @@ test_400a() { # LU-1606, was conf-sanity test_74
        fi
 
        for prog in $LUSTRE_TESTS_API_DIR/*.c; do
-               $CC -Wall -Werror $extra_flags -o $out $prog -llustreapi ||
+               $CC -Wall -Werror -std=c99 $extra_flags -o $out $prog -llustreapi ||
                        error "client api broken"
        done
        rm -f $out
@@ -20759,7 +21392,7 @@ test_400b() { # LU-1606, LU-5011
                        continue # lustre_ioctl.h is internal header
                fi
 
-               $CC -Wall -Werror -include $header -c -x c /dev/null -o $out ||
+               $CC -Wall -Werror -std=c99 -include $header -c -x c /dev/null -o $out ||
                        error "cannot compile '$header'"
        done
        rm -f $out
@@ -22410,7 +23043,8 @@ test_805() {
        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
@@ -22562,7 +23196,7 @@ test_807() {
                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
@@ -22583,7 +23217,8 @@ test_807() {
                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
@@ -22683,22 +23318,6 @@ test_810() {
 }
 run_test 810 "partial page writes on ZFS (LU-11663)"
 
-test_811() {
-       [ $MDS1_VERSION -lt $(version_code 2.11.56) ] &&
-               skip "Need MDS version at least 2.11.56"
-
-       #define OBD_FAIL_MDS_ORPHAN_DELETE      0x165
-       do_facet mds1 $LCTL set_param fail_loc=0x165
-       $MULTIOP $DIR/$tfile Ouc || error "multiop failed"
-
-       stop mds1
-       start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
-
-       wait_update_facet mds1 "pgrep orph_.*-MDD | wc -l" "0" ||
-               error "MDD orphan cleanup thread not quit"
-}
-run_test 811 "orphan name stub can be cleaned up in startup"
-
 test_812a() {
        [ $OST1_VERSION -lt $(version_code 2.12.51) ] &&
                skip "OST < 2.12.51 doesn't support this fail_loc"
@@ -23093,6 +23712,18 @@ test_901() {
 }
 run_test 901 "don't leak a mgc lock on client umount"
 
+# LU-13377
+test_902() {
+       [ $CLIENT_VERSION -lt $(version_code 2.13.52) ] &&
+               skip "client does not have LU-13377 fix"
+       #define OBD_FAIL_LLITE_SHORT_COMMIT 0x1415
+       $LCTL set_param fail_loc=0x1415
+       dd if=/dev/zero of=$DIR/$tfile bs=1M count=1
+       cancel_lru_locks osc
+       rm -f $DIR/$tfile
+}
+run_test 902 "test short write doesn't hang lustre"
+
 complete $SECONDS
 [ -f $EXT2_DEV ] && rm $EXT2_DEV || true
 check_and_cleanup_lustre