Whamcloud - gitweb
LU-5030 tests: remove /proc paths from tests
[fs/lustre-release.git] / lustre / tests / sanity.sh
old mode 100644 (file)
new mode 100755 (executable)
index ab8b62d..ac56464
@@ -16,6 +16,24 @@ ALWAYS_EXCEPT="                42a  42b  42c  42d  45   51d   68b   $SANITY_EXCE
 # bug number for skipped tests: LU-2036
 ALWAYS_EXCEPT="                 76     $ALWAYS_EXCEPT"
 
+is_sles11()                                            # LU-4341
+{
+       if [ -r /etc/SuSE-release ]
+       then
+               local vers=$(grep VERSION /etc/SuSE-release | awk '{print $3}')
+               local patchlev=$(grep PATCHLEVEL /etc/SuSE-release |
+                       awk '{ print $3 }')
+               if [ $vers -eq 11 ] && [ $patchlev -ge 3 ]; then
+                       return 0
+               fi
+       fi
+       return 1
+}
+
+if is_sles11; then                                     # LU-4341
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 170"
+fi
+
 SRCDIR=$(cd $(dirname $0); echo $PWD)
 export PATH=$PATH:/sbin
 
@@ -38,7 +56,6 @@ SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
 MEMHOG=${MEMHOG:-memhog}
 DIRECTIO=${DIRECTIO:-directio}
 ACCEPTOR_PORT=${ACCEPTOR_PORT:-988}
-UMOUNT=${UMOUNT:-"umount -d"}
 STRIPES_PER_OBJ=-1
 CHECK_GRANT=${CHECK_GRANT:-"yes"}
 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
@@ -58,7 +75,7 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
 init_logging
 
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24D 27m 64b 68 71 77f 78 115 124b"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24D 27m 64b 68 71 77f 78 115 124b 300o"
 
 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
        # bug number for skipped test: LU-4536 LU-1957 LU-2805
@@ -94,11 +111,6 @@ assert_DIR
 
 MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
        awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
-LOVNAME=$($LCTL get_param -n llite.*.lov.common_name | tail -n 1)
-OSTCOUNT=$($LCTL get_param -n lov.$LOVNAME.numobd)
-STRIPECOUNT=$($LCTL get_param -n lov.$LOVNAME.stripecount)
-STRIPESIZE=$($LCTL get_param -n lov.$LOVNAME.stripesize)
-ORIGFREE=$($LCTL get_param -n lov.$LOVNAME.kbytesavail)
 MAXFREE=${MAXFREE:-$((200000 * $OSTCOUNT))}
 
 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
@@ -539,11 +551,7 @@ run_test 17l "Ensure lgetxattr's returned xattr size is consistent ========"
 test_17m() {
        local short_sym="0123456789"
        local WDIR=$DIR/${tdir}m
-       local mds_index
-       local devname
-       local cmd
        local i
-       local rc=0
 
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
        [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.0) ] &&
@@ -576,49 +584,42 @@ test_17m() {
        echo "recreate the 512 symlink files with a shorter string"
        for ((i = 0; i < 512; ++i)); do
                # rewrite the symlink file with a shorter string
-               ln -sf ${long_sym} $WDIR/long-$i
-               ln -sf ${short_sym} $WDIR/short-$i
+               ln -sf ${long_sym} $WDIR/long-$i || error "long_sym failed"
+               ln -sf ${short_sym} $WDIR/short-$i || error "short_sym failed"
        done
 
-       mds_index=$($LFS getstripe -M $WDIR)
-       mds_index=$((mds_index+1))
-       devname=$(mdsdevname $mds_index)
-       cmd="$E2FSCK -fnvd $devname"
+       local mds_index=$(($($LFS getstripe -M $WDIR) + 1))
+       local devname=$(mdsdevname $mds_index)
 
-       echo "stop and checking mds${mds_index}: $cmd"
+       echo "stop and checking mds${mds_index}:"
        # e2fsck should not return error
        stop mds${mds_index}
-       do_facet mds${mds_index} $cmd || rc=$?
+       run_e2fsck $(facet_active_host mds${mds_index}) $devname -n
+       rc=$?
 
        start mds${mds_index} $devname $MDS_MOUNT_OPTS || error "start failed"
        df $MOUNT > /dev/null 2>&1
-       [ $rc -ne 0 ] && error "e2fsck should not report error upon "\
-               "short/long symlink MDT: rc=$rc"
-       return $rc
+       [ $rc -eq 0 ] ||
+               error "e2fsck detected error for short/long symlink: rc=$rc"
 }
 run_test 17m "run e2fsck against MDT which contains short/long symlink"
 
 check_fs_consistency_17n() {
        local mdt_index
-       local devname
-       local cmd
        local rc=0
 
        # create/unlink in 17n only change 2 MDTs(MDT1/MDT2),
        # so it only check MDT1/MDT2 instead of all of MDTs.
-       for mdt_index in $(seq 1 2); do
-               devname=$(mdsdevname $mdt_index)
-               cmd="$E2FSCK -fnvd $devname"
-
-               echo "stop and checking mds${mdt_index}: $cmd"
+       for mdt_index in 1 2; do
+               local devname=$(mdsdevname $mdt_index)
                # e2fsck should not return error
                stop mds${mdt_index}
-               do_facet mds${mdt_index} $cmd || rc=$?
+               run_e2fsck $(facet_active_host mds$mdt_index) $devname -n ||
+                       rc=$((rc + $?))
 
                start mds${mdt_index} $devname $MDS_MOUNT_OPTS ||
-                       error "mount mds${mdt_index} failed"
+                       error "mount mds$mdt_index failed"
                df $MOUNT > /dev/null 2>&1
-               [ $rc -ne 0 ] && break
        done
        return $rc
 }
@@ -1425,6 +1426,9 @@ run_test 27l "check setstripe permissions (should return error)"
 test_27m() {
        [[ $OSTCOUNT -lt 2 ]] && skip_env "$OSTCOUNT < 2 OSTs -- skipping" &&
                return
+
+       ORIGFREE=$($LCTL get_param -n lov.$FSNAME-clilov-*.kbytesavail |
+                  head -n1)
        if [[ $ORIGFREE -gt $MAXFREE ]]; then
                skip "$ORIGFREE > $MAXFREE skipping out-of-space test on OST0"
                return
@@ -1844,7 +1848,7 @@ check_seq_oid()
                log "want: stripe:$stripe_nr ost:$obdidx oid:$oid/$hex seq:$seq"
 
                seq=$(echo $seq | sed -e "s/^0x//g")
-               if [ $seq == 0 ]; then
+               if [ $seq == 0 ] || [ $(facet_fstype ost$ost) == zfs ]; then
                        oid_hex=$(echo $oid)
                else
                        oid_hex=$(echo $hex | sed -e "s/^0x//g")
@@ -1868,6 +1872,7 @@ check_seq_oid()
                                $(facet_mntpt ost$ost)/$obj_file)
                        unmount_fstype ost$ost
                        start ost$ost $dev $OST_MOUNT_OPTS
+                       clients_up
                fi
 
                [ -z "$ff" ] && error "$obj_file: no filter_fid info"
@@ -2348,7 +2353,7 @@ run_test 31p "remove of open striped directory"
 
 cleanup_test32_mount() {
        trap 0
-       $UMOUNT -d $DIR/$tdir/ext2-mountpoint
+       $UMOUNT $DIR/$tdir/ext2-mountpoint
 }
 
 test_32a() {
@@ -2555,7 +2560,7 @@ run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/$tfile"
 
 cleanup_testdir_mount() {
        trap 0
-       $UMOUNT -d $DIR/$tdir
+       $UMOUNT $DIR/$tdir
 }
 
 test_32q() {
@@ -2698,8 +2703,7 @@ test_33d() {
                                        error "create" || true
        $RUNAS $OPENFILE -f O_RDWR:O_CREAT -m 0444 $remote_dir/f33 &&
                                    error "open RDWR" || true
-       $RUNAS $OPENFILE -f 1286739555 $remote_dir/f33 &&
-                                   error "create" || true
+       $RUNAS $OPENFILE -f 1286739555 $remote_dir/f33 || true
 }
 run_test 33d "openfile with 444 modes and malformed flags under remote dir"
 
@@ -4297,7 +4301,7 @@ cleanup_54c() {
        loopdev="$DIR/loop54c"
 
        trap 0
-       $UMOUNT -d $DIR/$tdir || rc=$?
+       $UMOUNT $DIR/$tdir || rc=$?
        losetup -d $loopdev || true
        losetup -d $LOOPDEV || true
        rm -rf $loopdev $DIR/$tfile $DIR/$tdir
@@ -4842,7 +4846,9 @@ test_56w() {
     local file_size=$((stripe_size * OSTCOUNT))
     local file_num=$((NUMDIRS * NUMFILES + NUMFILES))
     local required_space=$((file_num * file_size))
-    local free_space=$($LCTL get_param -n lov.$LOVNAME.kbytesavail)
+
+    local free_space=$($LCTL get_param -n lov.$FSNAME-clilov-*.kbytesavail |
+                       head -n1)
     [[ $free_space -le $((required_space / 1024)) ]] &&
         skip_env "need at least $required_space bytes free space," \
                  "have $free_space kbytes" && return
@@ -5126,11 +5132,89 @@ test_60a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        remote_mgs_nodsh && skip "remote MGS with nodsh" && return
        do_facet mgs "! which run-llog.sh &> /dev/null" &&
-               skip_env "missing subtest run-llog.sh" && return
+               do_facet mgs "! ls run-llog.sh &> /dev/null" &&
+                       skip_env "missing subtest run-llog.sh" && return
+
        log "$TEST60_HEAD - from kernel mode"
+       do_facet mgs "$LCTL set_param debug=warning; $LCTL dk > /dev/null"
        do_facet mgs sh run-llog.sh
+       do_facet mgs $LCTL dk > $TMP/$tfile
+
+       # LU-6388: test llog_reader
+       local llog_reader=$(do_facet mgs "which llog_reader 2> /dev/null")
+       llog_reader=${llog_reader:-$LUSTRE/utils/llog_reader}
+       [ -z $(do_facet mgs ls -d $llog_reader 2> /dev/null) ] &&
+                       skip_env "missing llog_reader" && return
+       local fstype=$(facet_fstype mgs)
+       [ $fstype != ldiskfs -a $fstype != zfs ] &&
+               skip_env "Only for ldiskfs or zfs type mgs" && return
+
+       local mntpt=$(facet_mntpt mgs)
+       local mgsdev=$(mgsdevname 1)
+       local fid_list
+       local fid
+       local rec_list
+       local rec
+       local rec_type
+       local obj_file
+       local path
+       local seq
+       local oid
+       local pass=true
+
+       #get fid and record list
+       fid_list=($(awk '/9_sub.*record/ { print $NF }' /$TMP/$tfile |
+               tail -n 4))
+       rec_list=($(awk '/9_sub.*record/ { print $((NF-3)) }' /$TMP/$tfile |
+               tail -n 4))
+       #remount mgs as ldiskfs or zfs type
+       stop mgs || error "stop mgs failed"
+       mount_fstype mgs || error "remount mgs failed"
+       for ((i = 0; i < ${#fid_list[@]}; i++)); do
+               fid=${fid_list[i]}
+               rec=${rec_list[i]}
+               seq=$(echo $fid | awk -F ':' '{ print $1 }' | sed -e "s/^0x//g")
+               oid=$(echo $fid | awk -F ':' '{ print $2 }' | sed -e "s/^0x//g")
+               oid=$((16#$oid))
+
+               case $fstype in
+                       ldiskfs )
+                               obj_file=$mntpt/O/$seq/d$((oid%32))/$oid ;;
+                       zfs )
+                               obj_file=$mntpt/oi.$(($((16#$seq))&127))/$fid ;;
+               esac
+               echo "obj_file is $obj_file"
+               do_facet mgs $llog_reader $obj_file
+
+               rec_type=$(do_facet mgs $llog_reader $obj_file | grep "type=" |
+                       awk '{ print $3 }' | sed -e "s/^type=//g")
+               if [ $rec_type != $rec ]; then
+                       echo "FAILED test_60a wrong record type $rec_type," \
+                             "should be $rec"
+                       pass=false
+                       break
+               fi
+
+               #check obj path if record type is LLOG_LOGID_MAGIC
+               if [ "$rec" == "1064553b" ]; then
+                       path=$(do_facet mgs $llog_reader $obj_file |
+                               grep "path=" | awk '{ print $NF }' |
+                               sed -e "s/^path=//g")
+                       if [ $obj_file != $mntpt/$path ]; then
+                               echo "FAILED test_60a wrong obj path" \
+                                     "$montpt/$path, should be $obj_file"
+                               pass=false
+                               break
+                       fi
+               fi
+       done
+       rm -f $TMP/$tfile
+       #restart mgs before "error", otherwise it will block the next test
+       stop mgs || error "stop mgs failed"
+       start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "start mgs failed"
+       $pass || error "test failed, see FAILED test_60a messages for specifics"
 }
-run_test 60a "llog sanity tests run from kernel module =========="
+run_test 60a "llog_test run from kernel module and test llog_reader =========="
 
 test_60b() { # bug 6411
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
@@ -5183,6 +5267,15 @@ test_60d() {
 }
 run_test 60d "test printk console message masking"
 
+test_60e() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       touch $DIR/$tfile
+#define OBD_FAIL_MDS_LLOG_CREATE_FAILED2  0x15b
+       do_facet mds1 lctl set_param fail_loc=0x15b
+       rm $DIR/$tfile
+}
+run_test 60e "no space while new llog is being created"
+
 test_61() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        f="$DIR/f61"
@@ -5278,28 +5371,35 @@ run_test 65a "directory with no stripe info ===================="
 test_65b() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        test_mkdir -p $DIR/$tdir
+       local STRIPESIZE=$($GETSTRIPE -S $DIR/$tdir)
+
        $SETSTRIPE -S $((STRIPESIZE * 2)) -i 0 -c 1 $DIR/$tdir ||
                                                error "setstripe"
        touch $DIR/$tdir/f2
        $LVERIFY $DIR/$tdir $DIR/$tdir/f2 || error "lverify failed"
 }
-run_test 65b "directory setstripe -S $((STRIPESIZE * 2)) -i 0 -c 1"
+run_test 65b "directory setstripe -S stripe_size*2 -i 0 -c 1"
 
 test_65c() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        if [[ $OSTCOUNT -gt 1 ]]; then
                test_mkdir -p $DIR/$tdir
+               local STRIPESIZE=$($GETSTRIPE -S $DIR/$tdir)
+
                $SETSTRIPE -S $(($STRIPESIZE * 4)) -i 1 \
                        -c $(($OSTCOUNT - 1)) $DIR/$tdir || error "setstripe"
                touch $DIR/$tdir/f3
                $LVERIFY $DIR/$tdir $DIR/$tdir/f3 || error "lverify failed"
        fi
 }
-run_test 65c "directory setstripe -S $((STRIPESIZE*4)) -i 1 -c $((OSTCOUNT-1))"
+run_test 65c "directory setstripe -S stripe_size*4 -i 1 -c $((OSTCOUNT-1))"
 
 test_65d() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        test_mkdir -p $DIR/$tdir
+       local STRIPECOUNT=$($GETSTRIPE -c $DIR/$tdir)
+       local STRIPESIZE=$($GETSTRIPE -S $DIR/$tdir)
+
        if [[ $STRIPECOUNT -le 0 ]]; then
                sc=1
        elif [[ $STRIPECOUNT -gt 2000 ]]; then
@@ -5313,7 +5413,7 @@ test_65d() {
        $LVERIFY $DIR/$tdir $DIR/$tdir/f4 $DIR/$tdir/f5 ||
                error "lverify failed"
 }
-run_test 65d "directory setstripe -S $STRIPESIZE -c stripe_count"
+run_test 65d "directory setstripe -S stripe_size -c stripe_count"
 
 test_65e() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
@@ -5337,6 +5437,8 @@ run_test 65f "dir setstripe permission (should return error) ==="
 test_65g() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
         test_mkdir -p $DIR/$tdir
+       local STRIPESIZE=$($GETSTRIPE -S $DIR/$tdir)
+
         $SETSTRIPE -S $((STRIPESIZE * 2)) -i 0 -c 1 $DIR/$tdir ||
                                                        error "setstripe"
         $SETSTRIPE -d $DIR/$tdir || error "setstripe"
@@ -5348,6 +5450,8 @@ run_test 65g "directory setstripe -d ==========================="
 test_65h() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
         test_mkdir -p $DIR/$tdir
+       local STRIPESIZE=$($GETSTRIPE -S $DIR/$tdir)
+
         $SETSTRIPE -S $((STRIPESIZE * 2)) -i 0 -c 1 $DIR/$tdir ||
                                                        error "setstripe"
         test_mkdir -p $DIR/$tdir/dd1
@@ -5546,7 +5650,7 @@ test_68b() {  # was test_68
 run_test 68b "support swapping to Lustre ========================"
 
 # bug5265, obdfilter oa2dentry return -ENOENT
-# #define OBD_FAIL_OST_ENOENT 0x217
+# #define OBD_FAIL_SRV_ENOENT 0x217
 test_69() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        remote_ost_nodsh && skip "remote OST with nodsh" && return
@@ -6108,7 +6212,7 @@ test_99b() {
        # some versions of cvs import exit(1) when asked to import links or
        # files they can't read.  ignore those files.
        TOIGNORE=$(find . -type l -printf '-I %f\n' -o \
-                       ! -perm +4 -printf '-I %f\n')
+                       ! -perm /4 -printf '-I %f\n')
        $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" $TOIGNORE \
                d99reposname vtag rtag
 }
@@ -6699,7 +6803,7 @@ grow_xattr() {
        local xsize=${1:-1024}  # in bytes
        local file=$DIR/$tfile
 
-       [ -z $(lctl get_param -n mdc.*.connect_flags | grep xattr) ] &&
+       [ -z "$(lctl get_param -n mdc.*.connect_flags | grep xattr)" ] &&
                skip "must have user_xattr" && return 0
        [ -z "$(which setfattr 2>/dev/null)" ] &&
                skip_env "could not find setfattr" && return 0
@@ -7494,7 +7598,7 @@ test_118b()
 
        reset_async
 
-       #define OBD_FAIL_OST_ENOENT 0x217
+       #define OBD_FAIL_SRV_ENOENT 0x217
        set_nodes_failloc "$(osts_nodes)" 0x217
        $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
        RC=$?
@@ -8595,7 +8699,18 @@ set_dir_limits () {
                do_facet $facet "test -e $LDPROC/$canondev/max_dir_size" ||
                                                LDPROC=/sys/fs/ldiskfs
                do_facet $facet "echo $1 >$LDPROC/$canondev/max_dir_size"
+               do_facet $facet "test -e $LDPROC/$canondev/warning_dir_size" ||
+                                               LDPROC=/sys/fs/ldiskfs
+               do_facet $facet "echo $2 >$LDPROC/$canondev/warning_dir_size"
+       done
+}
+
+check_mds_dmesg() {
+       local facets=$(get_facets MDS)
+       for facet in ${facets//,/ }; do
+               do_facet $facet "dmesg | tail -3 | grep -q $1" && return 0
        done
+       return 1
 }
 
 test_129() {
@@ -8607,6 +8722,7 @@ test_129() {
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
        ENOSPC=28
        EFBIG=27
+       has_warning=0
 
        rm -rf $DIR/$tdir
        test_mkdir -p $DIR/$tdir
@@ -8614,8 +8730,8 @@ test_129() {
        # block size of mds1
        local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
        local MDSBLOCKSIZE=$($LCTL get_param -n mdc.*MDT0000*.blocksize)
-       local MAX=$((MDSBLOCKSIZE * 3))
-       set_dir_limits $MAX
+       local MAX=$((MDSBLOCKSIZE * 5))
+       set_dir_limits $MAX $MAX
        local I=$(stat -c%s "$DIR/$tdir")
        local J=0
        local STRIPE_COUNT=1
@@ -8624,15 +8740,25 @@ test_129() {
        while [[ $I -le $MAX ]]; do
                $MULTIOP $DIR/$tdir/$J Oc
                rc=$?
+               if [ $has_warning -eq 0 ]; then
+                       check_mds_dmesg '"is approaching"' &&
+                               has_warning=1
+               fi
                #check two errors ENOSPC for new version of ext4 max_dir_size patch
                #mainline kernel commit df981d03eeff7971ac7e6ff37000bfa702327ef1
                #and EFBIG for previous versions
                if [ $rc -eq $EFBIG -o $rc -eq $ENOSPC ]; then
-                       set_dir_limits 0
+                       set_dir_limits 0 0
                        echo "return code $rc received as expected"
                        multiop $DIR/$tdir/$J Oc ||
                                error_exit "multiop failed w/o dir size limit"
 
+                       check_mds_dmesg '"has reached"' ||
+                               error_exit "has reached message should be output"
+
+                       [ $has_warning ] ||
+                               error_exit "warning message should be output"
+
                        I=$(stat -c%s "$DIR/$tdir")
 
                        if [ $(lustre_version_code $SINGLEMDS) -lt \
@@ -8644,7 +8770,7 @@ test_129() {
                        fi
                        error_exit "current dir size $I, previous limit $MAX"
                elif [ $rc -ne 0 ]; then
-                       set_dir_limits 0
+                       set_dir_limits 0 0
                        error_exit "return code $rc received instead of expected " \
                                   "$EFBIG or $ENOSPC, files in dir $I"
                fi
@@ -8652,7 +8778,7 @@ test_129() {
                I=$(stat -c%s "$DIR/$tdir")
        done
 
-       set_dir_limits 0
+       set_dir_limits 0 0
        error "exceeded dir size limit $MAX($MDSCOUNT) : $I bytes"
 }
 run_test 129 "test directory size limit ========================"
@@ -9297,31 +9423,24 @@ test_133e() {
 }
 run_test 133e "Verifying OST {read,write}_bytes nid stats ================="
 
-test_133f() {
-       local proc_dirs
-
-       local dirs="/proc/fs/lustre/ /proc/sys/lnet/ /proc/sys/lustre/ \
-/sys/fs/lustre/ /sys/fs/lnet/"
-       local dir
-       for dir in $dirs; do
-               if [ -d $dir ]; then
-                       proc_dirs="$proc_dirs $dir"
-               fi
-       done
-
-       local facet
+proc_dirs=""
+for dir in /proc/fs/lustre/ /proc/sys/lnet/ /proc/sys/lustre/ \
+          /sys/fs/lustre/ /sys/fs/lnet/ /sys/kernel/debug/lustre/; do
+       [[ -d $dir ]] && proc_dirs+=" $dir"
+done
 
+test_133f() {
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
        remote_ost_nodsh && skip "remote OST with nodsh" && return
        # First without trusting modes.
        find $proc_dirs -exec cat '{}' \; &> /dev/null
 
        # Second verifying readability.
-       find $proc_dirs \
-               -type f \
-               -exec cat '{}' \; &> /dev/null ||
-                       error "proc file read failed"
+       $LCTL get_param -R &> /dev/null || error "proc file read failed"
 
+       # eventually, this can also be replaced with "lctl get_param -R",
+       # but not until that option is always available on the server
+       local facet
        for facet in $SINGLEMDS ost1; do
                do_facet $facet find $proc_dirs \
                        ! -name req_history \
@@ -9337,20 +9456,7 @@ test_133f() {
 run_test 133f "Check for LBUGs/Oopses/unreadable files in /proc"
 
 test_133g() {
-       local proc_dirs
-
-       local dirs="/proc/fs/lustre/ /proc/sys/lnet/ /proc/sys/lustre/ \
-/sys/fs/lustre/ /sys/fs/lnet/"
-       local dir
-       for dir in $dirs; do
-               if [ -d $dir ]; then
-                       proc_dirs="$proc_dirs $dir"
-               fi
-       done
-
-       local facet
-
-       # Second verifying readability.
+       # Second verifying writability.
        find $proc_dirs \
                -type f \
                -not -name force_lbug \
@@ -9364,6 +9470,7 @@ test_133g() {
        [ $(lustre_version_code ost1) -le $(version_code 2.5.54) ] &&
                skip "Too old lustre on ost1" && return
 
+       local facet
        for facet in $SINGLEMDS ost1; do
                do_facet $facet find $proc_dirs \
                        -type f \
@@ -9414,7 +9521,7 @@ test_134a() {
        rm $DIR/$tdir/m
        unlinkmany $DIR/$tdir/f $nr
 }
-run_test 134a "Server reclaims locks when reaching low watermark"
+run_test 134a "Server reclaims locks when reaching lock_reclaim_threshold"
 
 test_134b() {
        [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.54) ]] &&
@@ -9423,9 +9530,10 @@ test_134b() {
        mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
        cancel_lru_locks mdc
 
-       local low_wm=$(do_facet mds1 $LCTL get_param -n ldlm.watermark_mb_low)
+       local low_wm=$(do_facet mds1 $LCTL get_param -n \
+                       ldlm.lock_reclaim_threshold_mb)
        # disable reclaim temporarily
-       do_facet mds1 $LCTL set_param ldlm.watermark_mb_low=0
+       do_facet mds1 $LCTL set_param ldlm.lock_reclaim_threshold_mb=0
 
        #define OBD_FAIL_LDLM_WATERMARK_HIGH     0x328
        do_facet mds1 $LCTL set_param fail_loc=0x328
@@ -9442,17 +9550,18 @@ test_134b() {
        if ! ps -p $create_pid  > /dev/null 2>&1; then
                do_facet mds1 $LCTL set_param fail_loc=0
                do_facet mds1 $LCTL set_param fail_val=0
-               do_facet mds1 $LCTL set_param ldlm.watermark_mb_low=$low_wm
+               do_facet mds1 $LCTL set_param \
+                       ldlm.lock_reclaim_threshold_mb=${low_wm}m
                error "createmany finished incorrectly!"
        fi
        do_facet mds1 $LCTL set_param fail_loc=0
        do_facet mds1 $LCTL set_param fail_val=0
-       do_facet mds1 $LCTL set_param ldlm.watermark_mb_low=$low_wm
+       do_facet mds1 $LCTL set_param ldlm.lock_reclaim_threshold_mb=${low_wm}m
        wait $create_pid || return 1
 
        unlinkmany $DIR/$tdir/f $nr
 }
-run_test 134b "Server rejects lock request when reaching high watermark"
+run_test 134b "Server rejects lock request when reaching lock_limit_mb"
 
 test_140() { #bug-17379
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
@@ -10492,6 +10601,36 @@ test_160c() {
 }
 run_test 160c "verify that changelog log catch the truncate event"
 
+test_160d() {
+       remote_mds_nodsh && skip "remote MDS with nodsh" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       local server_version=$(lustre_version_code mds1)
+       local CL_MASK_PARAM="mdd.$MDT0.changelog_mask"
+
+       [[ $server_version -ge $(version_code 2.7.60) ]] ||
+               { skip "Need MDS version at least 2.7.60+"; return; }
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+
+       # Registration step
+       local USER=$(do_facet mds1 $LCTL --device $MDT0 \
+               changelog_register -n)
+
+       mkdir -p $DIR/$tdir/migrate_dir
+       $LFS changelog_clear $MDT0 $USER 0
+
+       $LFS migrate -m 1 $DIR/$tdir/migrate_dir || error "migrate fails"
+       $LFS changelog $MDT0
+       MIGRATES=$($LFS changelog $MDT0 | tail -5 | grep -c "MIGRT")
+       $LFS changelog_clear $MDT0 $USER 0
+       [ $MIGRATES -eq 1 ] ||
+               error "MIGRATE changelog mask count $MIGRATES != 1"
+
+       # Deregistration step
+       do_facet mds1 $LCTL --device $MDT0 changelog_deregister $USER
+}
+run_test 160d "verify that changelog log catch the migrate event"
+
 test_161a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        test_mkdir -p -c1 $DIR/$tdir
@@ -10696,7 +10835,7 @@ check_path() {
     echo "fid $fid resolves to path $path (expected $expected)"
 }
 
-test_162() {
+test_162a() { # was test_162
        # Make changes to filesystem
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        test_mkdir -p -c1 $DIR/$tdir/d2
@@ -10744,7 +10883,7 @@ test_162() {
 
        return 0
 }
-run_test 162 "path lookup sanity"
+run_test 162a "path lookup sanity"
 
 test_162b() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
@@ -11527,7 +11666,12 @@ elif [ -n "$LOADL_STEPID" ]; then # LoadLeveller
 elif [ -n "$JOB_ID" ]; then # Sun Grid Engine
        JOBENV=JOB_ID
 else
-       JOBENV=FAKE_JOBID
+       $LCTL list_param jobid_name > /dev/null 2>&1
+       if [ $? -eq 0 ]; then
+               JOBENV=nodelocal
+       else
+               JOBENV=FAKE_JOBID
+       fi
 fi
 
 verify_jobstats() {
@@ -11548,6 +11692,13 @@ verify_jobstats() {
                FAKE_JOBID=id.$testnum.$(basename ${cmd[0]}).$RANDOM
 
        JOBVAL=${!JOBENV}
+
+       [ "$JOBENV" = "nodelocal" ] && {
+               FAKE_JOBID=id.$testnum.$(basename ${cmd[0]}).$RANDOM
+               $LCTL set_param jobid_name=$FAKE_JOBID
+               JOBVAL=$FAKE_JOBID
+       }
+
        log "Test: ${cmd[*]}"
        log "Using JobID environment variable $JOBENV=$JOBVAL"
 
@@ -11646,7 +11797,7 @@ test_205() { # Job stats
        cmd="mv -f $DIR/$tfile $DIR/$tdir.rename"
        verify_jobstats "$cmd" "$SINGLEMDS"
        # jobstats expiry - sleep until old stats should be expired
-       local left=$((interval_new - (SECONDS - start)))
+       local left=$((interval_new + 2 - (SECONDS - start)))
        [ $left -ge 0 ] && echo "sleep $left for expiry" && sleep $((left + 1))
        cmd="mkdir $DIR/$tdir.expire"
        verify_jobstats "$cmd" "$SINGLEMDS"
@@ -12609,7 +12760,7 @@ test_230b() {
        ln -s $other_dir/$tfile $migrate_dir/${tfile}_ln_other
 
        $LFS migrate -m $MDTIDX $migrate_dir ||
-               error "migrate remote dir error"
+               error "fails on migrating remote dir to MDT1"
 
        echo "migratate to MDT1, then checking.."
        for ((i = 0; i < 10; i++)); do
@@ -12672,8 +12823,9 @@ test_230b() {
 
        #migrate back to MDT0
        MDTIDX=0
+
        $LFS migrate -m $MDTIDX $migrate_dir ||
-               error "migrate remote dir error"
+               error "fails on migrating remote dir to MDT0"
 
        echo "migrate back to MDT0, checking.."
        for file in $(find $migrate_dir); do
@@ -12752,6 +12904,12 @@ test_230c() {
        local t=$(ls $migrate_dir | wc -l)
        $LFS migrate --mdt-index $MDTIDX $migrate_dir &&
                error "migrate should fail after 5 entries"
+
+       mkdir $migrate_dir/dir &&
+               error "mkdir succeeds under migrating directory"
+       touch $migrate_dir/file &&
+               error "touch file succeeds under migrating directory"
+
        local u=$(ls $migrate_dir | wc -l)
        [ "$u" == "$t" ] || error "$u != $t during migration"
 
@@ -12808,6 +12966,138 @@ test_230d() {
 }
 run_test 230d "check migrate big directory"
 
+test_230e() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       local i
+       local j
+       local a_fid
+       local b_fid
+
+       mkdir -p $DIR/$tdir
+       mkdir $DIR/$tdir/migrate_dir
+       mkdir $DIR/$tdir/other_dir
+       touch $DIR/$tdir/migrate_dir/a
+       ln $DIR/$tdir/migrate_dir/a $DIR/$tdir/other_dir/b
+       ls $DIR/$tdir/other_dir
+
+       $LFS migrate -m 1 $DIR/$tdir/migrate_dir ||
+               error "migrate dir fails"
+
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir)
+       [ $mdt_index == 1 ] || error "migrate_dir is not on MDT1"
+
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir/a)
+       [ $mdt_index == 0 ] || error "a is not on MDT0"
+
+       $LFS migrate -m 1 $DIR/$tdir/other_dir ||
+               error "migrate dir fails"
+
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/other_dir)
+       [ $mdt_index == 1 ] || error "other_dir is not on MDT1"
+
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir/a)
+       [ $mdt_index == 1 ] || error "a is not on MDT1"
+
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/other_dir/b)
+       [ $mdt_index == 1 ] || error "b is not on MDT1"
+
+       a_fid=$($LFS path2fid $DIR/$tdir/migrate_dir/a)
+       b_fid=$($LFS path2fid $DIR/$tdir/other_dir/b)
+
+       [ "$a_fid" = "$b_fid" ] || error "different fid after migration"
+
+       rm -rf $DIR/$tdir || error "rm dir failed after migration"
+}
+run_test 230e "migrate mulitple local link files"
+
+test_230f() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       local a_fid
+       local ln_fid
+
+       mkdir -p $DIR/$tdir
+       mkdir $DIR/$tdir/migrate_dir
+       $LFS mkdir -i1 $DIR/$tdir/other_dir
+       touch $DIR/$tdir/migrate_dir/a
+       ln $DIR/$tdir/migrate_dir/a $DIR/$tdir/other_dir/ln1
+       ln $DIR/$tdir/migrate_dir/a $DIR/$tdir/other_dir/ln2
+       ls $DIR/$tdir/other_dir
+
+       # a should be migrated to MDT1, since no other links on MDT0
+       $LFS migrate -m 1 $DIR/$tdir/migrate_dir ||
+               error "migrate dir fails"
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir)
+       [ $mdt_index == 1 ] || error "migrate_dir is not on MDT1"
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir/a)
+       [ $mdt_index == 1 ] || error "a is not on MDT1"
+
+       # a should stay on MDT1, because it is a mulitple link file
+       $LFS migrate -m 0 $DIR/$tdir/migrate_dir ||
+               error "migrate dir fails"
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir/a)
+       [ $mdt_index == 1 ] || error "a is not on MDT1"
+
+       $LFS migrate -m 1 $DIR/$tdir/migrate_dir ||
+               error "migrate dir fails"
+
+       a_fid=$($LFS path2fid $DIR/$tdir/migrate_dir/a)
+       ln_fid=$($LFS path2fid $DIR/$tdir/other_dir/ln1)
+       [ "$a_fid" = "$ln_fid" ] || error "different fid after migrate to MDT1"
+
+       rm -rf $DIR/$tdir/other_dir/ln1 || error "unlink ln1 fails"
+       rm -rf $DIR/$tdir/other_dir/ln2 || error "unlink ln2 fails"
+
+       # a should be migrated to MDT0, since no other links on MDT1
+       $LFS migrate -m 0 $DIR/$tdir/migrate_dir ||
+               error "migrate dir fails"
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir/a)
+       [ $mdt_index == 0 ] || error "a is not on MDT0"
+
+       rm -rf $DIR/$tdir || error "rm dir failed after migration"
+}
+run_test 230f "migrate mulitple remote link files"
+
+test_230g() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       mkdir -p $DIR/$tdir/migrate_dir
+
+       $LFS migrate -m 1000 $DIR/$tdir/migrate_dir &&
+               error "migrating dir to non-exist MDT succeeds"
+       true
+}
+run_test 230g "migrate dir to non-exist MDT"
+
+test_230h() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
+               skip "Need MDS version at least 2.7.64" && return
+       local mdt_index
+
+       mkdir -p $DIR/$tdir/migrate_dir
+
+       $LFS migrate -m1 $DIR &&
+               error "migrating mountpoint1 should fail"
+
+       $LFS migrate -m1 $DIR/$tdir/.. &&
+               error "migrating mountpoint2 should fail"
+
+       $LFS migrate -m1 $DIR/$tdir/migrate_dir/.. ||
+               error "migrating $tdir fail"
+
+       mdt_index=$($LFS getstripe -M $DIR/$tdir)
+       [ $mdt_index == 1 ] || error "$mdt_index != 1 after migration"
+
+       mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir)
+       [ $mdt_index == 1 ] || error "$mdt_index != 1 after migration"
+
+}
+run_test 230h "migrate .. and root"
+
 test_231a()
 {
        # For simplicity this test assumes that max_pages_per_rpc
@@ -12819,16 +13109,20 @@ test_231a()
 
        # clear the OSC stats
        $LCTL set_param osc.*.stats=0 &>/dev/null
+       stop_writeback
 
        # Client writes $bulk_size - there must be 1 rpc for $max_pages.
        dd if=/dev/zero of=$DIR/$tdir/$tfile bs=$bulk_size count=1 \
                oflag=direct &>/dev/null || error "dd failed"
 
+       sync; sleep 1; sync # just to be safe
        local nrpcs=$($LCTL get_param osc.*.stats |awk '/ost_write/ {print $2}')
        if [ x$nrpcs != "x1" ]; then
-               error "found $nrpc ost_write RPCs, not 1 as expected"
+               $LCTL get_param osc.*.stats
+               error "found $nrpcs ost_write RPCs, not 1 as expected"
        fi
 
+       start_writeback
        # Drop the OSC cache, otherwise we will read from it
        cancel_lru_locks osc
 
@@ -12841,7 +13135,8 @@ test_231a()
 
        nrpcs=$($LCTL get_param osc.*.stats | awk '/ost_read/ { print $2 }')
        if [ x$nrpcs != "x1" ]; then
-               error "found $nrpc ost_read RPCs, not 1 as expected"
+               $LCTL get_param osc.*.stats
+               error "found $nrpcs ost_read RPCs, not 1 as expected"
        fi
 }
 run_test 231a "checking that reading/writing of BRW RPC size results in one RPC"
@@ -13021,6 +13316,28 @@ test_239() {
 }
 run_test 239 "osp_sync test"
 
+test_239a() { #LU-5297
+       touch $DIR/$tfile
+       #define OBD_FAIL_OSP_CHECK_INVALID_REC     0x2100
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0x2100
+       chgrp $RUNAS_GID $DIR/$tfile
+       wait_delete_completed
+}
+run_test 239a "process invalid osp sync record correctly"
+
+test_239b() { #LU-5297
+       touch $DIR/$tfile1
+       #define OBD_FAIL_OSP_CHECK_ENOMEM     0x2101
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0x2101
+       chgrp $RUNAS_GID $DIR/$tfile1
+       wait_delete_completed
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0
+       touch $DIR/$tfile2
+       chgrp $RUNAS_GID $DIR/$tfile2
+       wait_delete_completed
+}
+run_test 239b "process osp sync record with ENOMEM error correctly"
+
 test_240() {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
 
@@ -13044,7 +13361,7 @@ run_test 240 "race between ldlm enqueue and the connection RPC (no ASSERT)"
 test_241_bio() {
        for LOOP in $(seq $1); do
                dd if=$DIR/$tfile of=/dev/null bs=40960 count=1 2>/dev/null
-               cancel_lru_locks osc
+               cancel_lru_locks osc || true
        done
 }
 
@@ -13106,6 +13423,44 @@ test_244()
 }
 run_test 244 "sendfile with group lock tests"
 
+test_245() {
+       local flagname="multi_mod_rpcs"
+       local connect_data_name="max_mod_rpcs"
+       local out
+
+       # check if multiple modify RPCs flag is set
+       out=$($LCTL get_param mdc.$FSNAME-MDT0000-*.import |
+               grep "connect_flags:")
+       echo "$out"
+
+       echo "$out" | grep -qw $flagname
+       if [ $? -ne 0 ]; then
+               echo "connect flag $flagname is not set"
+               return
+       fi
+
+       # check if multiple modify RPCs data is set
+       out=$($LCTL get_param mdc.$FSNAME-MDT0000-*.import)
+       echo "$out"
+
+       echo "$out" | grep -qw $connect_data_name ||
+               error "import should have connect data $connect_data_name"
+}
+run_test 245 "check mdc connection flag/data: multiple modify RPCs"
+
+test_246() { # LU-7371
+       [ $(lustre_version_code ost1) -lt $(version_code 2.7.62) ] &&
+               skip "Need OST version >= 2.7.62" && return 0
+       do_facet ost1 $LCTL set_param fail_val=4095
+#define OBD_FAIL_OST_READ_SIZE         0x234
+       do_facet ost1 $LCTL set_param fail_loc=0x234
+       $LFS setstripe $DIR/$tfile -i 0 -c 1
+       dd if=/dev/zero of=$DIR/$tfile bs=4095 count=1 > /dev/null 2>&1
+       cancel_lru_locks $FSNAME-OST0000
+       dd if=$DIR/$tfile of=/dev/null bs=1048576 || error "Read failed"
+}
+run_test 246 "Read file of size 4095 should return right length"
+
 test_250() {
        [ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR/$tfile) + 1)))" = "zfs" ] \
         && skip "no 16TB file size limit on ZFS" && return
@@ -13137,6 +13492,58 @@ test_251() {
 }
 run_test 251 "Handling short read and write correctly"
 
+test_252() {
+       local tgt
+       local dev
+       local out
+       local uuid
+       local num
+       local gen
+
+       if [ "$(facet_fstype ost1)" != "ldiskfs" -o \
+            "$(facet_fstype mds1)" != "ldiskfs" ]; then
+               skip "can only run lr_reader on ldiskfs target"
+               return
+       fi
+
+       # check lr_reader on OST0000
+       tgt=ost1
+       dev=$(facet_device $tgt)
+       out=$(do_facet $tgt $LR_READER $dev)
+       [ $? -eq 0 ] || error "$LR_READER failed on target $tgt device $dev"
+       echo "$out"
+       uuid=$(echo "$out" | grep -i uuid | awk '{ print $2 }')
+       [ "$uuid" == "$(ostuuid_from_index 0)" ] ||
+               error "Invalid uuid returned by $LR_READER on target $tgt"
+       echo -e "uuid returned by $LR_READER is '$uuid'\n"
+
+       # check lr_reader -c on MDT0000
+       tgt=mds1
+       dev=$(facet_device $tgt)
+       if ! do_facet $tgt $LR_READER -h | grep -q OPTIONS; then
+               echo "$LR_READER does not support additional options"
+               return 0
+       fi
+       out=$(do_facet $tgt $LR_READER -c $dev)
+       [ $? -eq 0 ] || error "$LR_READER failed on target $tgt device $dev"
+       echo "$out"
+       num=$(echo "$out" | grep -c "mdtlov")
+       [ "$num" -eq $((MDSCOUNT - 1)) ] ||
+               error "Invalid number of mdtlov clients returned by $LR_READER"
+       echo -e "Number of mdtlov clients returned by $LR_READER is '$num'\n"
+
+       # check lr_reader -cr on MDT0000
+       out=$(do_facet $tgt $LR_READER -cr $dev)
+       [ $? -eq 0 ] || error "$LR_READER failed on target $tgt device $dev"
+       echo "$out"
+       echo "$out" | grep -q "^reply_data:$" ||
+               error "$LR_READER should have returned 'reply_data' section"
+       num=$(echo "$out" | grep -c "client_generation")
+       echo -e "Number of reply data returned by $LR_READER is '$num'\n"
+}
+run_test 252 "check lr_reader tool"
+
+
 cleanup_test_300() {
        trap 0
        umask $SAVE_UMASK
@@ -13299,6 +13706,8 @@ test_300d() {
 run_test 300d "check default stripe under striped directory"
 
 test_300e() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local stripe_count
@@ -13343,6 +13752,8 @@ test_300e() {
 run_test 300e "check rename under striped directory"
 
 test_300f() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local stripe_count
@@ -13410,6 +13821,7 @@ test_300_check_default_striped_dir()
        for dir in $(find $DIR/$tdir/$dirname/*); do
                stripe_count=$($LFS getdirstripe -c $dir)
                [ $stripe_count -eq $default_count ] ||
+               [ $stripe_count -eq 0 -o $default_count -eq 1 ] ||
                error "stripe count $default_count != $stripe_count for $dir"
 
                stripe_index=$($LFS getdirstripe -i $dir)
@@ -13429,6 +13841,8 @@ test_300_check_default_striped_dir()
 }
 
 test_300g() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local dir
        local stripe_count
@@ -13460,6 +13874,8 @@ test_300g() {
 run_test 300g "check default striped directory for normal directory"
 
 test_300h() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local dir
        local stripe_count
@@ -13488,6 +13904,8 @@ test_300h() {
 run_test 300h "check default striped directory for striped directory"
 
 test_300i() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local stripe_count
@@ -13554,9 +13972,9 @@ test_300j() {
 run_test 300j "test large update record"
 
 test_300k() {
-       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
                skip "Need MDS version at least 2.7.55" && return
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local stripe_count
        local file
@@ -13579,6 +13997,8 @@ test_300k() {
 run_test 300k "test large striped directory"
 
 test_300l() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        local stripe_index
@@ -13599,6 +14019,143 @@ test_300l() {
 }
 run_test 300l "non-root user to create dir under striped dir with stale layout"
 
+test_300m() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -ge 2 ] && skip "Only for single MDT" && return
+
+       mkdir -p $DIR/$tdir/striped_dir
+       $LFS setdirstripe -D -c 1 $DIR/$tdir/striped_dir ||
+               error "set default stripes dir error"
+
+       mkdir $DIR/$tdir/striped_dir/a || error "mkdir a fails"
+
+       stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir/a)
+       [ $stripe_count -eq 0 ] ||
+                       error "expect 0 get $stripe_count for a"
+
+       $LFS setdirstripe -D -c 2 $DIR/$tdir/striped_dir ||
+               error "set default stripes dir error"
+
+       mkdir $DIR/$tdir/striped_dir/b || error "mkdir b fails"
+
+       stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir/b)
+       [ $stripe_count -eq 0 ] ||
+                       error "expect 0 get $stripe_count for b"
+
+       $LFS setdirstripe -D -c1 -i2 $DIR/$tdir/striped_dir ||
+               error "set default stripes dir error"
+
+       mkdir $DIR/$tdir/striped_dir/c &&
+               error "default stripe_index is invalid, mkdir c should fails"
+
+       rm -rf $DIR/$tdir || error "rmdir fails"
+}
+run_test 300m "setstriped directory on single MDT FS"
+
+cleanup_300n() {
+       local list=$(comma_list $(mdts_nodes))
+
+       trap 0
+       do_nodes $list $LCTL set_param -n mdt.*.enable_remote_dir_gid=0
+}
+
+test_300n() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       local stripe_index
+       local list=$(comma_list $(mdts_nodes))
+
+       trap cleanup_300n RETURN EXIT
+       mkdir -p $DIR/$tdir
+       chmod 777 $DIR/$tdir
+       $RUNAS $LFS setdirstripe -i0 -c$MDSCOUNT \
+                               $DIR/$tdir/striped_dir > /dev/null 2>&1 &&
+               error "create striped dir succeeds with gid=0"
+
+       do_nodes $list $LCTL set_param -n mdt.*.enable_remote_dir_gid=-1
+       $RUNAS $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir ||
+               error "create striped dir fails with gid=-1"
+
+       do_nodes $list $LCTL set_param -n mdt.*.enable_remote_dir_gid=0
+       $RUNAS $LFS setdirstripe -i 1 -c$MDSCOUNT -D \
+                               $DIR/$tdir/striped_dir > /dev/null 2>&1 &&
+               error "set default striped dir succeeds with gid=0"
+
+
+       do_nodes $list $LCTL set_param -n mdt.*.enable_remote_dir_gid=-1
+       $RUNAS $LFS setdirstripe -i 1 -c$MDSCOUNT -D $DIR/$tdir/striped_dir ||
+               error "set default striped dir fails with gid=-1"
+
+
+       do_nodes $list $LCTL set_param -n mdt.*.enable_remote_dir_gid=0
+       $RUNAS mkdir $DIR/$tdir/striped_dir/test_dir ||
+                                       error "create test_dir fails"
+       $RUNAS mkdir $DIR/$tdir/striped_dir/test_dir1 ||
+                                       error "create test_dir1 fails"
+       $RUNAS mkdir $DIR/$tdir/striped_dir/test_dir2 ||
+                                       error "create test_dir2 fails"
+       cleanup_300n
+}
+run_test 300n "non-root user to create dir under striped dir with default EA"
+
+test_300o() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
+               skip "Need MDS version at least 2.7.55" && return
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       local numfree1
+       local numfree2
+
+       mkdir -p $DIR/$tdir
+
+       numfree1=$(lctl get_param -n mdc.*MDT0000*.filesfree)
+       numfree2=$(lctl get_param -n mdc.*MDT0001*.filesfree)
+       if [ $numfree1 -lt 66000 -o $numfree2 -lt 66000 ]; then
+               skip "not enough free inodes $numfree1 $numfree2"
+               return
+       fi
+
+       numfree1=$(lctl get_param -n mdc.*MDT0000-mdc-*.kbytesfree)
+       numfree2=$(lctl get_param -n mdc.*MDT0001-mdc-*.kbytesfree)
+       if [ $numfree1 -lt 300000 -o $numfree2 -lt 300000 ]; then
+               skip "not enough free space $numfree1 $numfree2"
+               return
+       fi
+
+       $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
+               error "setdirstripe fails"
+
+       createmany -d $DIR/$tdir/striped_dir/d 131000 ||
+               error "create dirs fails"
+
+       $LCTL set_param ldlm.namespaces.*mdc-*.lru_size=0
+       ls $DIR/$tdir/striped_dir > /dev/null ||
+               error "ls striped dir fails"
+       unlinkmany -d $DIR/$tdir/striped_dir/d 131000 ||
+               error "unlink big striped dir fails"
+}
+run_test 300o "unlink big sub stripe(> 65000 subdirs)"
+
+test_300p() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       mkdir -p $DIR/$tdir
+
+       #define OBD_FAIL_OUT_ENOSPC     0x1704
+       do_facet mds2 lctl set_param fail_loc=0x80001704
+       $LFS setdirstripe -c2 $DIR/$tdir/bad_striped_dir > /dev/null 2>&1 &&
+                       error "create striped directory should fail"
+
+       [ -e $DIR/$tdir/bad_striped_dir ] && error "striped dir exists"
+       true
+}
+run_test 300p "create striped directory without space"
+
 prepare_remote_file() {
        mkdir $DIR/$tdir/src_dir ||
                error "create remote source failed"
@@ -13730,6 +14287,26 @@ test_400b() { # LU-1606, LU-5011
 }
 run_test 400b "packaged headers can be compiled"
 
+test_401() { #LU-7437
+       #count the number of parameters by "list_param -R"
+       local params=$($LCTL list_param -R '*' 2>/dev/null | wc -l)
+       #count the number of parameters by listing proc files
+       local procs=$(find -L $proc_dirs -mindepth 1 2>/dev/null | wc -l)
+
+       [ $params -eq $procs ] ||
+               error "found $params parameters vs. $procs proc files"
+}
+run_test 401 "Verify if 'lctl list_param -R' can list parameters recursively"
+
+test_402() {
+       $LFS setdirstripe -i 0 $DIR/$tdir || error "setdirstripe -i 0 failed"
+#define OBD_FAIL_MDS_FLD_LOOKUP 0x15c
+       do_facet mds1 "lctl set_param fail_loc=0x8000015c"
+       touch $DIR/$tdir/$tfile && error "touch should fail with ENOENT" ||
+               echo "Touch failed - OK"
+}
+run_test 402 "Return ENOENT to lod_generate_and_set_lovea"
+
 #
 # tests that do cleanup/setup should be run at the end
 #