Whamcloud - gitweb
LU-988 clio: use OSC object's m/a/ctime when build write RPC
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 1aeb8e8..36e2aa0 100644 (file)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
-# vim:autoindent:shiftwidth=4:tabstop=4:
 #
 # Run select tests by setting ONLY, or as arguments to the script.
 # Skip specific tests by setting EXCEPT.
@@ -18,12 +16,6 @@ CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
 #                                    buffer i/o errs             sock spc runas
 [ "$CPU" = "UML" ] && EXCEPT="$EXCEPT 27m 27n 27o 27p 27q 27r 31d 54a  64b 99a 99b 99c 99d 99e 99f 101a"
 
-case `uname -r` in
-2.4*) FSTYPE=${FSTYPE:-ext3} ;;
-2.6*) FSTYPE=${FSTYPE:-ldiskfs} ;;
-*) error "unsupported kernel" ;;
-esac
-
 SRCDIR=$(cd $(dirname $0); echo $PWD)
 export PATH=$PATH:/sbin
 
@@ -38,6 +30,7 @@ LCTL=${LCTL:-lctl}
 MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
+export MULTIOP=${MULTIOP:-multiop}
 READS=${READS:-"reads"}
 MUNLINK=${MUNLINK:-munlink}
 SOCKETSERVER=${SOCKETSERVER:-socketserver}
@@ -693,13 +686,13 @@ run_test 24k "touch .../R11a/f; mv .../R11a/f .../R11a/d ======="
 # bug 2429 - rename foo foo foo creates invalid file
 test_24l() {
        f="$DIR/f24l"
-       multiop $f OcNs || error
+       $MULTIOP $f OcNs || error
 }
 run_test 24l "Renaming a file to itself ========================"
 
 test_24m() {
        f="$DIR/f24m"
-       multiop $f OcLN ${f}2 ${f}2 || error "link ${f}2 ${f}2 failed"
+       $MULTIOP $f OcLN ${f}2 ${f}2 || error "link ${f}2 ${f}2 failed"
        # on ext3 this does not remove either the source or target files
        # though the "expected" operation would be to remove the source
        $CHECKSTAT -t file ${f} || error "${f} missing"
@@ -776,7 +769,7 @@ test_24t() {
 run_test 24t "mkdir .../R16a/b/c; rename .../R16a/b/c .../R16a ="
 
 test_24u() { # bug12192
-        multiop $DIR/$tfile C2w$((2048 * 1024))c || error
+        $MULTIOP $DIR/$tfile C2w$((2048 * 1024))c || error
         $CHECKSTAT -s $((2048 * 1024)) $DIR/$tfile || error "wrong file size"
 }
 run_test 24u "create stripe file"
@@ -1358,9 +1351,6 @@ check_seq_oid()
         # compare lmm_object_id and lu_fid->oid
         [ $lmm_oid = ${fid[2]} ] || { error "OID mismatch"; return 2; }
 
-        [ "$FSTYPE" != "ldiskfs" ] &&
-                skip "cannot check filter fid FSTYPE=$FSTYPE" && return 0
-
         # check the trusted.fid attribute of the OST objects of the file
         local have_obdidx=false
         local stripe_nr=0
@@ -1373,6 +1363,11 @@ check_seq_oid()
                 local ost=$((obdidx + 1))
                 local dev=$(ostdevname $ost)
 
+               if [ $(facet_fstype ost$ost) != ldiskfs ]; then
+                       echo "Currently only works with ldiskfs-based OSTs"
+                       continue
+               fi
+
                 log "want: stripe:$stripe_nr ost:$obdidx oid:$oid/$hex seq:$seq"
 
                 #don't unmount/remount the OSTs if we don't need to do that
@@ -1545,7 +1540,7 @@ run_test 31a "open-unlink file =================================="
 test_31b() {
        touch $DIR/f31 || error
        ln $DIR/f31 $DIR/f31b || error
-       multiop $DIR/f31b Ouc || error
+       $MULTIOP $DIR/f31b Ouc || error
        $CHECKSTAT -t file $DIR/f31 || error
 }
 run_test 31b "unlink file with multiple links while open ======="
@@ -1555,7 +1550,7 @@ test_31c() {
        ln $DIR/f31 $DIR/f31c || error
        multiop_bg_pause $DIR/f31 O_uc || return 1
        MULTIPID=$!
-       multiop $DIR/f31c Ouc
+       $MULTIOP $DIR/f31c Ouc
        kill -USR1 $MULTIPID
        wait $MULTIPID
 }
@@ -2061,6 +2056,25 @@ test_34g() {
 }
 run_test 34g "truncate long file ==============================="
 
+test_34h() {
+       local gid=10
+       local sz=1000
+
+       dd if=/dev/zero of=$DIR/$tfile bs=1M count=10 || error
+       $MULTIOP $DIR/$tfile OG${gid}T${sz}g${gid}c &
+       MULTIPID=$!
+       sleep 2
+
+       if [[ `ps h -o comm -p $MULTIPID` == "multiop" ]]; then
+               error "Multiop blocked on ftruncate, pid=$MULTIPID"
+               kill -9 $MULTIPID
+       fi
+       wait $MULTIPID
+       local nsz=`stat -c %s $DIR/$tfile`
+       [[ $nsz == $sz ]] || error "New size wrong $nsz != $sz"
+}
+run_test 34h "ftruncate file under grouplock should not block"
+
 test_35a() {
        cp /bin/sh $DIR/f35a
        chmod 444 $DIR/f35a
@@ -2408,10 +2422,14 @@ test_39i() {
 run_test 39i "write, rename, stat =============================="
 
 test_39j() {
+       start_full_debug_logging
        touch $DIR1/$tfile
        sleep 1
 
-       multiop_bg_pause $DIR1/$tfile oO_RDWR:w2097152_c || error "multiop failed"
+       #define OBD_FAIL_OSC_DELAY_SETTIME       0x412
+       lctl set_param fail_loc=0x80000412
+       multiop_bg_pause $DIR1/$tfile oO_RDWR:w2097152_c ||
+               error "multiop failed"
        local multipid=$!
        local mtime1=`stat -c %Y $DIR1/$tfile`
 
@@ -2422,12 +2440,15 @@ test_39j() {
 
        for (( i=0; i < 2; i++ )) ; do
                local mtime2=`stat -c %Y $DIR1/$tfile-1`
-               [ "$mtime1" = "$mtime2" ] || \
-                       error "mtime is lost on close: $mtime2, should be $mtime1"
+               [ "$mtime1" = "$mtime2" ] ||
+                       error "mtime is lost on close: $mtime2, " \
+                             "should be $mtime1"
 
                cancel_lru_locks osc
                if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
        done
+       lctl set_param fail_loc=0
+       stop_full_debug_logging
 }
 run_test 39j "write, rename, close, stat ======================="
 
@@ -2762,7 +2783,7 @@ run_test 42e "verify sub-RPC writes are not done synchronously"
 test_43() {
        mkdir -p $DIR/$tdir
        cp -p /bin/ls $DIR/$tdir/$tfile
-       multiop $DIR/$tdir/$tfile Ow_c &
+       $MULTIOP $DIR/$tdir/$tfile Ow_c &
        pid=$!
        # give multiop a chance to open
        sleep 1
@@ -2774,10 +2795,10 @@ run_test 43 "execution of file opened for write should return -ETXTBSY"
 
 test_43a() {
         mkdir -p $DIR/d43
-       cp -p `which multiop` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop
+       cp -p `which $MULTIOP` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop
         MULTIOP_PROG=$DIR/d43/multiop multiop_bg_pause $TMP/test43.junk O_c || return 1
         MULTIOP_PID=$!
-        multiop $DIR/d43/multiop Oc && error "expected error, got success"
+        $MULTIOP $DIR/d43/multiop Oc && error "expected error, got success"
         kill -USR1 $MULTIOP_PID || return 2
         wait $MULTIOP_PID || return 3
         rm $TMP/test43.junk
@@ -2786,7 +2807,7 @@ run_test 43a "open(RDWR) of file being executed should return -ETXTBSY"
 
 test_43b() {
         mkdir -p $DIR/d43
-       cp -p `which multiop` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop
+       cp -p `which $MULTIOP` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop
         MULTIOP_PROG=$DIR/d43/multiop multiop_bg_pause $TMP/test43.junk O_c || return 1
         MULTIOP_PID=$!
         $TRUNCATE $DIR/d43/multiop 0 && error "expected error, got success"
@@ -3011,6 +3032,30 @@ test_48e() { # bug 4134
 }
 run_test 48e "Access to recreated parent subdir (should return errors)"
 
+test_49() { # LU-1030
+       # get ost1 size - lustre-OST0000
+       ost1_size=$(do_facet ost1 lfs df |grep ${ost1_svc} |awk '{print $4}')
+       # write 800M at maximum
+       [ $ost1_size -gt 819200 ] && ost1_size=819200
+
+       lfs setstripe -c 1 -i 0 $DIR/$tfile
+       dd if=/dev/zero of=$DIR/$tfile bs=4k count=$((ost1_size >> 2)) &
+       local dd_pid=$!
+
+       # change max_pages_per_rpc while writing the file
+       local osc1_mppc=osc.$(get_osc_import_name client ost1).max_pages_per_rpc
+       local orig_mppc=`$LCTL get_param -n $osc1_mppc`
+       # loop until dd process exits
+       while ps ax -opid | grep -q $dd_pid; do
+               $LCTL set_param $osc1_mppc=$((RANDOM % 256 + 1))
+               sleep $((RANDOM % 5 + 1))
+       done
+       # restore original max_pages_per_rpc
+       $LCTL set_param $osc1_mppc=$orig_mppc
+       rm $DIR/$tfile || error "rm $DIR/$tfile failed"
+}
+run_test 49 "Change max_pages_per_rpc won't break osc extent"
+
 test_50() {
        # bug 1485
        mkdir $DIR/d50
@@ -3756,6 +3801,104 @@ test_56v() {
 }
 run_test 56v "check 'lfs find -mdt match with lfs getstripe -M' ======="
 
+# Get and check the actual stripe count of one file.
+# Usage: check_stripe_count <file> <expected_stripe_count>
+check_stripe_count() {
+    local file=$1
+    local expected=$2
+    local actual
+
+    [[ -z "$file" || -z "$expected" ]] &&
+        error "check_stripe_count: invalid argument!"
+
+    local cmd="$GETSTRIPE -c $file"
+    actual=$($cmd) || error "$cmd failed"
+    actual=${actual%% *}
+
+    if [[ $actual -ne $expected ]]; then
+        [[ $expected -eq -1 ]] ||
+            error "$cmd wrong: found $actual, expected $expected"
+        [[ $actual -eq $OSTCOUNT ]] ||
+            error "$cmd wrong: found $actual, expected $OSTCOUNT"
+    fi
+}
+
+test_56w() {
+    TDIR=$DIR/${tdir}w
+
+    rm -rf $TDIR || error "remove $TDIR failed"
+    setup_56 $NUMFILES $NUMDIRS "-c $OSTCOUNT"
+
+    local stripe_size
+    stripe_size=$($GETSTRIPE -S -d $TDIR) ||
+        error "$GETSTRIPE -S -d $TDIR failed"
+    stripe_size=${stripe_size%% *}
+
+    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)
+    [[ $free_space -le $((required_space / 1024)) ]] &&
+        skip_env "need at least $required_space bytes free space," \
+                 "have $free_space kbytes" && return
+
+    local dd_bs=65536
+    local dd_count=$((file_size / dd_bs))
+
+    # write data into the files
+    local i
+    local j
+    local file
+    for i in $(seq 1 $NUMFILES); do
+        file=$TDIR/file$i
+        yes | dd bs=$dd_bs count=$dd_count of=$file >/dev/null 2>&1 ||
+            error "write data into $file failed"
+    done
+    for i in $(seq 1 $NUMDIRS); do
+        for j in $(seq 1 $NUMFILES); do
+            file=$TDIR/dir$i/file$j
+            yes | dd bs=$dd_bs count=$dd_count of=$file \
+                >/dev/null 2>&1 ||
+                error "write data into $file failed"
+        done
+    done
+
+    local expected=-1
+    [[ $OSTCOUNT -gt 1 ]] && expected=$((OSTCOUNT - 1))
+
+    # lfs_migrate file
+    local cmd="$LFS_MIGRATE -y -c $expected $TDIR/file1"
+    echo "$cmd"
+    eval $cmd || error "$cmd failed"
+
+    check_stripe_count $TDIR/file1 $expected
+
+    # lfs_migrate dir
+    cmd="$LFS_MIGRATE -y -c $expected $TDIR/dir1"
+    echo "$cmd"
+    eval $cmd || error "$cmd failed"
+
+    for j in $(seq 1 $NUMFILES); do
+        check_stripe_count $TDIR/dir1/file$j $expected
+    done
+
+    # lfs_migrate works with lfs find
+    cmd="$LFIND -stripe_count $OSTCOUNT -type f $TDIR |
+         $LFS_MIGRATE -y -c $expected"
+    echo "$cmd"
+    eval $cmd || error "$cmd failed"
+
+    for i in $(seq 2 $NUMFILES); do
+        check_stripe_count $TDIR/file$i $expected
+    done
+    for i in $(seq 2 $NUMDIRS); do
+        for j in $(seq 1 $NUMFILES); do
+            check_stripe_count $TDIR/dir$i/file$j $expected
+        done
+    done
+}
+run_test 56w "check lfs_migrate -c stripe_count works"
+
 test_57a() {
        # note test will not do anything if MDS is not local
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
@@ -3903,7 +4046,7 @@ test_61() {
        f="$DIR/f61"
        dd if=/dev/zero of=$f bs=`page_size` count=1
        cancel_lru_locks osc
-       multiop $f OSMWUc || error
+       $MULTIOP $f OSMWUc || error
        sync
 }
 run_test 61 "mmap() writes don't make sync hang ================"
@@ -3949,7 +4092,7 @@ test_63b() {
 
        #define OBD_FAIL_OSC_BRW_PREP_REQ        0x406
        lctl set_param fail_loc=0x80000406
-       multiop $DIR/$tfile Owy && \
+       $MULTIOP $DIR/$tfile Owy && \
                error "sync didn't return ENOMEM"
        sync; sleep 2; sync     # do a real sync this time to flush page
        lctl get_param -n llite.*.dump_page_cache | grep locked && \
@@ -4319,11 +4462,11 @@ test_73() {
        pid1=$!
 
        lctl set_param fail_loc=0x80000129
-       multiop $DIR/d73-1/f73-2 Oc &
+       $MULTIOP $DIR/d73-1/f73-2 Oc &
        sleep 1
        lctl set_param fail_loc=0
 
-       multiop $DIR/d73-2/f73-3 Oc &
+       $MULTIOP $DIR/d73-2/f73-3 Oc &
        pid3=$!
 
        kill -USR1 $pid1
@@ -4578,7 +4721,7 @@ test_77i() { # bug 13805
        for VALUE in `lctl get_param osc.*osc-[^mM]*.checksum_type`; do
                PARAM=`echo ${VALUE[0]} | cut -d "=" -f1`
                algo=`lctl get_param -n $PARAM | sed 's/.*\[\(.*\)\].*/\1/g'`
-               [ "$algo" = "crc32" ] || error "algo set to $algo instead of crc32"
+               [ "$algo" = "adler" ] || error "algo set to $algo instead of adler"
        done
        remount_client $MOUNT
 }
@@ -4699,7 +4842,7 @@ test_81a() { # LU-456
 
         # write should trigger a retry and success
         $SETSTRIPE -i 0 -c 1 $DIR/$tfile
-        multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+        $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
         RC=$?
         if [ $RC -ne 0 ] ; then
                 error "write should success, but failed for $RC"
@@ -4715,7 +4858,7 @@ test_81b() { # LU-456
 
         # write should retry several times and return -ENOSPC finally
         $SETSTRIPE -i 0 -c 1 $DIR/$tfile
-        multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+        $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
         RC=$?
         ENOSPC=28
         if [ $RC -ne $ENOSPC ] ; then
@@ -4724,6 +4867,27 @@ test_81b() { # LU-456
 }
 run_test 81b "OST should return -ENOSPC when retry still fails ======="
 
+test_82() { # LU-1031
+       dd if=/dev/zero of=$DIR/$tfile bs=1M count=10
+       local gid1=14091995
+       local gid2=16022000
+
+       multiop_bg_pause $DIR/$tfile OG${gid1}_g${gid1}c || return 1
+       local MULTIPID1=$!
+       multiop_bg_pause $DIR/$tfile O_G${gid2}r10g${gid2}c || return 2
+       local MULTIPID2=$!
+       kill -USR1 $MULTIPID2
+       sleep 2
+       if [[ `ps h -o comm -p $MULTIPID2` == "" ]]; then
+               error "First grouplock does not block second one"
+       else
+               echo "Second grouplock blocks first one"
+       fi
+       kill -USR1 $MULTIPID1
+       wait $MULTIPID1
+       wait $MULTIPID2
+}
+run_test 82 "Basic grouplock test ==============================="
 
 test_99a() {
         [ -z "$(which cvs 2>/dev/null)" ] && skip_env "could not find cvs" && \
@@ -5140,8 +5304,7 @@ cleanup_test102() {
 test_102a() {
        local testfile=$DIR/xattr_testfile
 
-       rm -f $testfile
-        touch $testfile
+       touch $testfile
 
        [ "$UID" != 0 ] && skip_env "must run as root" && return
        [ -z "`lctl get_param -n mdc.*-mdc-*.connect_flags | grep xattr`" ] &&
@@ -5151,40 +5314,48 @@ test_102a() {
                skip_env "could not find setfattr" && return
 
        echo "set/get xattr..."
-        setfattr -n trusted.name1 -v value1 $testfile || error
-        [ "`getfattr -n trusted.name1 $testfile 2> /dev/null | \
-        grep "trusted.name1"`" == "trusted.name1=\"value1\"" ] || error
+       setfattr -n trusted.name1 -v value1 $testfile || error
+       getfattr -n trusted.name1 $testfile 2> /dev/null |
+         grep "trusted.name1=.value1" ||
+               error "$testfile missing trusted.name1=value1"
 
-        setfattr -n user.author1 -v author1 $testfile || error
-        [ "`getfattr -n user.author1 $testfile 2> /dev/null | \
-        grep "user.author1"`" == "user.author1=\"author1\"" ] || error
+       setfattr -n user.author1 -v author1 $testfile || error
+       getfattr -n user.author1 $testfile 2> /dev/null |
+         grep "user.author1=.author1" ||
+               error "$testfile missing trusted.author1=author1"
 
        echo "listxattr..."
-        setfattr -n trusted.name2 -v value2 $testfile || error
-        setfattr -n trusted.name3 -v value3 $testfile || error
-        [ `getfattr -d -m "^trusted" $testfile 2> /dev/null | \
-        grep "trusted.name" | wc -l` -eq 3 ] || error
-
-
-        setfattr -n user.author2 -v author2 $testfile || error
-        setfattr -n user.author3 -v author3 $testfile || error
-        [ `getfattr -d -m "^user" $testfile 2> /dev/null | \
-        grep "user" | wc -l` -eq 3 ] || error
+       setfattr -n trusted.name2 -v value2 $testfile ||
+               error "$testfile unable to set trusted.name2"
+       setfattr -n trusted.name3 -v value3 $testfile ||
+               error "$testfile unable to set trusted.name3"
+       [ $(getfattr -d -m "^trusted" $testfile 2> /dev/null |
+           grep "trusted.name" | wc -l) -eq 3 ] ||
+               error "$testfile missing 3 trusted.name xattrs"
+
+       setfattr -n user.author2 -v author2 $testfile ||
+               error "$testfile unable to set user.author2"
+       setfattr -n user.author3 -v author3 $testfile ||
+               error "$testfile unable to set user.author3"
+       [ $(getfattr -d -m "^user" $testfile 2> /dev/null |
+           grep "user.author" | wc -l) -eq 3 ] ||
+               error "$testfile missing 3 user.author xattrs"
 
        echo "remove xattr..."
-        setfattr -x trusted.name1 $testfile || error
-        getfattr -d -m trusted $testfile 2> /dev/null | \
-        grep "trusted.name1" && error || true
+       setfattr -x trusted.name1 $testfile ||
+               error "$testfile error deleting trusted.name1"
+       getfattr -d -m trusted $testfile 2> /dev/null | grep "trusted.name1" &&
+               error "$testfile did not delete trusted.name1 xattr"
 
-        setfattr -x user.author1 $testfile || error
-        getfattr -d -m user $testfile 2> /dev/null | \
-        grep "user.author1" && error || true
+       setfattr -x user.author1 $testfile ||
+               error "$testfile error deleting user.author1"
+       getfattr -d -m user $testfile 2> /dev/null | grep "user.author1" &&
+               error "$testfile did not delete trusted.name1 xattr"
 
        # b10667: setting lustre special xattr be silently discarded
        echo "set lustre special xattr ..."
-       setfattr -n "trusted.lov" -v "invalid value" $testfile || error
-
-       rm -f $testfile
+       setfattr -n "trusted.lov" -v "invalid value" $testfile ||
+               error "$testfile allowed setting trusted.lov"
 }
 run_test 102a "user xattr test =================================="
 
@@ -5244,59 +5415,34 @@ test_102c() {
 run_test 102c "non-root getfattr/setfattr for lustre.lov EAs ==========="
 
 compare_stripe_info1() {
-       local stripe_index_all_zero=1
+       local stripe_index_all_zero=true
 
-       for num in 1 2 3 4
-       do
-               for count in `seq 1 $STRIPE_COUNT`
-               do
-                       for offset in `seq 0 $[$STRIPE_COUNT - 1]`
-                       do
-                               local size=`expr $STRIPE_SIZE \* $num`
+       for num in 1 2 3 4; do
+               for count in $(seq 1 $STRIPE_COUNT); do
+                       for offset in $(seq 0 $[$STRIPE_COUNT - 1]); do
+                               local size=$((STRIPE_SIZE * num))
                                local file=file"$num-$offset-$count"
-                               get_stripe_info client $PWD/$file "$1"
-                               if [ $stripe_size -ne $size ]; then
-                                       error "$file: different stripe size $stripe_size, expected $size" && return
-                               fi
-                               if [ $stripe_count -ne $count ]; then
-                                       error "$file: different stripe count $stripe_count, expected $count" && return
-                               fi
-                               if [ $stripe_index -ne 0 ]; then
-                                      stripe_index_all_zero=0
-                               fi
+                               stripe_size=$(lfs getstripe -S $PWD/$file)
+                               [ $stripe_size -ne $size ] &&
+                                   error "$file: size $stripe_size != $size"
+                               stripe_count=$(lfs getstripe -c $PWD/$file)
+                               # allow fewer stripes to be created, ORI-601
+                               [ $stripe_count -lt $(((3 * count + 3) / 4)) ]&&
+                                   error "$file: count $stripe_count != $count"
+                               stripe_index=$(lfs getstripe -i $PWD/$file)
+                               [ $stripe_index -ne 0 ] &&
+                                       stripe_index_all_zero=false
                        done
                done
        done
-       [ $stripe_index_all_zero -eq 1 ] && error "all files are being extracted starting from OST index 0"
+       $stripe_index_all_zero &&
+               error "all files are being extracted starting from OST index 0"
        return 0
 }
 
-compare_stripe_info2() {
-       for num in 1 2 3 4
-       do
-               for count in `seq 1 $STRIPE_COUNT`
-               do
-                       for offset in `seq 0 $[$STRIPE_COUNT - 1]`
-                       do
-                               local size=`expr $STRIPE_SIZE \* $num`
-                               local file=file"$num-$offset-$count"
-                               get_stripe_info client $PWD/$file
-                               if [ $stripe_size -ne $size ]; then
-                                       error "$file: different stripe size $stripe_size, expected $size" && return
-                               fi
-                               if [ $stripe_count -ne $count ]; then
-                                       error "$file: different stripe count $stripe_count, expected $count" && return
-                               fi
-                               if [ $stripe_index -ne $offset ]; then
-                                       error "$file: different stripe offset $stripe_index, expected $offset" && return
-                               fi
-                       done
-               done
-       done
-}
-
 find_lustre_tar() {
-       [ -n "$(which tar 2>/dev/null)" ] && strings $(which tar) | grep -q lustre && echo tar
+       [ -n "$(which tar 2>/dev/null)" ] &&
+               strings $(which tar) | grep -q "lustre" && echo tar
 }
 
 test_102d() {
@@ -5426,6 +5572,22 @@ test_102k() {
 }
 run_test 102k "setfattr without parameter of value shouldn't cause a crash"
 
+test_102l() {
+       # LU-532 trusted. xattr is invisible to non-root
+       local testfile=$DIR/$tfile
+
+       touch $testfile
+
+       echo "listxattr as user..."
+       chown $RUNAS_ID $testfile
+       $RUNAS getfattr -d -m '.*' $testfile 2>&1 |
+           grep -q "trusted" &&
+               error "$testfile trusted xattrs are user visible"
+
+       return 0;
+}
+run_test 102l "listxattr filter test =================================="
+
 cleanup_test102
 
 run_acl_subtest()
@@ -5787,7 +5949,7 @@ test_118a() #bug 11710
 {
        reset_async
 
-       multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+       $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
        DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty)
         WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback)
 
@@ -5807,7 +5969,7 @@ test_118b()
 
        #define OBD_FAIL_OST_ENOENT 0x217
        set_nodes_failloc "$(osts_nodes)" 0x217
-       multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+       $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
        RC=$?
        set_nodes_failloc "$(osts_nodes)" 0
         DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty)
@@ -5828,7 +5990,7 @@ test_118b()
 
        # Due to the above error the OSC will issue all RPCs syncronously
        # until a subsequent RPC completes successfully without error.
-       multiop $DIR/$tfile Ow4096yc
+       $MULTIOP $DIR/$tfile Ow4096yc
        rm -f $DIR/$tfile
 
        return 0
@@ -5845,7 +6007,7 @@ test_118c()
        set_nodes_failloc "$(osts_nodes)" 0x216
 
        # multiop should block due to fsync until pages are written
-       multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
+       $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
        MULTIPID=$!
        sleep 1
 
@@ -5888,7 +6050,7 @@ test_118d()
        #define OBD_FAIL_OST_BRW_PAUSE_BULK
        set_nodes_failloc "$(osts_nodes)" 0x214
        # multiop should block due to fsync until pages are written
-       multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
+       $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
        MULTIPID=$!
        sleep 1
 
@@ -5925,7 +6087,7 @@ test_118f() {
         lctl set_param fail_loc=0x8000040a
 
        # Should simulate EINVAL error which is fatal
-        multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+        $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
         RC=$?
        if [[ $RC -eq 0 ]]; then
                error "Must return error due to dropped pages, rc=$RC"
@@ -5960,7 +6122,7 @@ test_118g() {
        lctl set_param fail_loc=0x406
 
        # simulate local -ENOMEM
-       multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+       $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
        RC=$?
 
        lctl set_param fail_loc=0
@@ -5996,7 +6158,7 @@ test_118h() {
        #define OBD_FAIL_OST_BRW_WRITE_BULK      0x20e
         set_nodes_failloc "$(osts_nodes)" 0x20e
        # Should simulate ENOMEM error which is recoverable and should be handled by timeout
-        multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+        $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
         RC=$?
 
         set_nodes_failloc "$(osts_nodes)" 0
@@ -6032,7 +6194,7 @@ test_118i() {
         set_nodes_failloc "$(osts_nodes)" 0x20e
 
        # Should simulate ENOMEM error which is recoverable and should be handled by timeout
-        multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
+        $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
        PID=$!
        sleep 5
        set_nodes_failloc "$(osts_nodes)" 0
@@ -6070,7 +6232,7 @@ test_118j() {
         set_nodes_failloc "$(osts_nodes)" 0x220
 
        # return -EIO from OST
-        multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+        $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
         RC=$?
         set_nodes_failloc "$(osts_nodes)" 0x0
        if [[ $RC -eq 0 ]]; then
@@ -6122,7 +6284,7 @@ test_118l()
 {
        # LU-646
        mkdir -p $DIR/$tdir
-       multiop $DIR/$tdir Dy || error "fsync dir failed"
+       $MULTIOP $DIR/$tdir Dy || error "fsync dir failed"
        rm -rf $DIR/$tdir
 }
 run_test 118l "fsync dir ========="
@@ -6152,7 +6314,7 @@ test_119b() # bug 11737
         $SETSTRIPE -c 2 $DIR/$tfile || error "setstripe failed"
         dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 seek=1 || error "dd failed"
         sync
-        multiop $DIR/$tfile oO_RDONLY:O_DIRECT:r$((2048 * 1024)) || \
+        $MULTIOP $DIR/$tfile oO_RDONLY:O_DIRECT:r$((2048 * 1024)) || \
                 error "direct read failed"
         rm -f $DIR/$tfile
 }
@@ -6777,7 +6939,10 @@ set_dir_limits () {
        done
 }
 test_129() {
-       [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return 0
+       if [ "$(facet_type_fstype MDS)" != ldiskfs ]; then
+               skip "Only applicable to ldiskfs-based MDTs"
+               return
+       fi
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
 
        EFBIG=27
@@ -6790,7 +6955,7 @@ test_129() {
        I=0
        J=0
        while [ ! $I -gt $((MAX * MDSCOUNT)) ]; do
-               multiop $DIR/$tdir/$J Oc
+               $MULTIOP $DIR/$tdir/$J Oc
                rc=$?
                if [ $rc -eq $EFBIG ]; then
                        set_dir_limits 0
@@ -7202,6 +7367,9 @@ check_stats() {
 test_133a() {
        remote_ost_nodsh && skip "remote OST with nodsh" && return
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
+       do_facet $SINGLEMDS $LCTL list_param mdt.*.rename_stats ||
+               { skip "MDS doesn't support rename stats"; return; }
        local testdir=$DIR/${tdir}/stats_testdir
        mkdir -p $DIR/${tdir}
 
@@ -7255,6 +7423,9 @@ test_133b() {
        # extra mdt stats verification.
        chmod 444 ${testdir}/${tfile} || error "chmod failed"
        check_stats $SINGLEMDS "setattr" 1
+       do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear
+       ls -l ${testdir}/${tfile} > /dev/null|| error "ls failed"
+       check_stats $SINGLEMDS "getattr" 1
        $LFS df || error "lfs failed"
        check_stats $SINGLEMDS "statfs" 1
 
@@ -7337,7 +7508,7 @@ size_in_KMGT() {
 
 get_rename_size() {
     local size=$1
-    local sample=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats | \
+    local sample=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats |
                    awk '/ '${size}'/ {print $4}' | sed -e "s/,//g")
     echo $sample
 }
@@ -7345,6 +7516,9 @@ get_rename_size() {
 test_133d() {
     remote_ost_nodsh && skip "remote OST with nodsh" && return
     remote_mds_nodsh && skip "remote MDS with nodsh" && return
+    do_facet $SINGLEMDS $LCTL list_param mdt.*.rename_stats ||
+        { skip "MDS doesn't support rename stats"; return; }
+
     local testdir1=$DIR/${tdir}/stats_testdir1
     local testdir2=$DIR/${tdir}/stats_testdir2
 
@@ -7354,9 +7528,9 @@ test_133d() {
     mkdir -p ${testdir2} || error "mkdir failed"
 
     createmany -o $testdir1/test 512 || error "createmany failed"
-    local testdir1_size=$(ls -l $DIR/${tdir} | \
+    local testdir1_size=$(ls -l $DIR/${tdir} |
                           awk '/stats_testdir1/ {print $5}')
-    local testdir2_size=$(ls -l $DIR/${tdir} | \
+    local testdir2_size=$(ls -l $DIR/${tdir} |
                           awk '/stats_testdir2/ {print $5}')
 
     testdir1_size=$(order_2 $testdir1_size)
@@ -7365,27 +7539,31 @@ test_133d() {
     testdir1_size=$(size_in_KMGT $testdir1_size)
     testdir2_size=$(size_in_KMGT $testdir2_size)
 
+    echo "source rename dir size: ${testdir1_size}"
+    echo "target rename dir size: ${testdir2_size}"
+
     # check samedir rename size
     mv ${testdir1}/test0 ${testdir1}/test_0
-    local samedir=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats | \
-                    grep 'same_dir')
+    local cmd="do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats"
+    eval $cmd || error "$cmd failed"
+    local samedir=$($cmd | grep 'same_dir')
     local same_sample=$(get_rename_size $testdir1_size)
     [ -z "$samedir" ] && error "samedir_rename_size count error"
-    [ $same_sample -eq 1 ] || error "samedir_rename_size count error"
+    [ "$same_sample" -eq 1 ] || error "samedir_rename_size error $same_sample"
     echo "Check same dir rename stats success"
 
-    # check crossdir rename size
     do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
+
+    # check crossdir rename size
     mv ${testdir1}/test_0 ${testdir2}/test_0
-    local crossdir=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats | \
-                     grep 'crossdir')
+    eval $cmd || error "$cmd failed"
+    local crossdir=$($cmd | grep 'crossdir')
     local src_sample=$(get_rename_size $testdir1_size)
     local tgt_sample=$(get_rename_size $testdir2_size)
     [ -z "$crossdir" ] && error "crossdir_rename_size count error"
-    [ $src_sample -eq 1 ] || error "crossdir_rename_size count error"
-    [ $tgt_sample -eq 1 ] || error "crossdir_rename_size count error"
+    [ "$src_sample" -eq 1 ] || error "crossdir_rename_size error $src_sample"
+    [ "$tgt_sample" -eq 1 ] || error "crossdir_rename_size error $tgt_sample"
     echo "Check cross dir rename stats success"
-
     rm -rf $DIR/${tdir}
 }
 run_test 133d "Verifying rename_stats ========================================"
@@ -7544,7 +7722,7 @@ test_152() {
 run_test 152 "test read/write with enomem ============================"
 
 test_153() {
-        multiop $DIR/$tfile Ow4096Ycu || error "multiop failed"
+        $MULTIOP $DIR/$tfile Ow4096Ycu || error "multiop failed"
 }
 run_test 153 "test if fdatasync does not crash ======================="
 
@@ -7555,12 +7733,68 @@ test_154() {
        rc=$?
        [ $rc -ne 0 ] && error "error: could not get fid for $DIR/$tfile."
 
-       echo "open fid $fid"
-       diff /etc/hosts $DIR/.lustre/fid/$fid || error "open by fid failed: did not find expected data in file."
+       ffid=$DIR/.lustre/fid/$fid
+
+       echo "stat fid $fid"
+       stat $ffid > /dev/null || error "stat $ffid failed."
+       echo "touch fid $fid"
+       touch $ffid || error "touch $ffid failed."
+       echo "write to fid $fid"
+       cat /etc/hosts > $ffid || error "write $ffid failed."
+       echo "read fid $fid"
+       diff /etc/hosts $ffid || error "read $ffid failed."
+       echo "append write to fid $fid"
+       cat /etc/hosts >> $ffid || error "append write $ffid failed."
+       echo "rename fid $fid"
+       mv $ffid $DIR/$tfile.1 && error "rename $ffid to $tfile.1 should fail."
+       touch $DIR/$tfile.1
+       mv $DIR/$tfile.1 $ffid && error "rename $tfile.1 to $ffid should fail."
+       rm -f $DIR/$tfile.1
+       echo "truncate fid $fid"
+       $TRUNCATE $ffid 777 || error "truncate $ffid failed."
+       echo "link fid $fid"
+       ln -f $ffid $DIR/tfile.lnk || error "link $ffid failed."
+       if [ -n $(lctl get_param -n mdc.*-mdc-*.connect_flags | grep acl) ]; then
+               echo "setfacl fid $fid"
+               setfacl -R -m u:bin:rwx $ffid || error "setfacl $ffid failed."
+               echo "getfacl fid $fid"
+               getfacl $ffid >/dev/null || error "getfacl $ffid failed."
+       fi
+       echo "unlink fid $fid"
+       unlink $DIR/.lustre/fid/$fid && error "unlink $ffid should fail."
+       echo "mknod fid $fid"
+       mknod $ffid c 1 3 && error "mknod $ffid should fail."
+
+       fid=[0xf00000400:0x1:0x0]
+       ffid=$DIR/.lustre/fid/$fid
+
+       echo "stat non-exist fid $fid"
+       stat $ffid > /dev/null && error "stat non-exist $ffid should fail."
+       echo "write to non-exist fid $fid"
+       cat /etc/hosts > $ffid && error "write non-exist $ffid should fail."
+       echo "link new fid $fid"
+       ln $DIR/$tfile $ffid && error "link $ffid should fail."
+
+       mkdir -p $DIR/$tdir
+       touch $DIR/$tdir/$tfile
+       fid=$($LFS path2fid $DIR/$tdir)
+       rc=$?
+       [ $rc -ne 0 ] && error "error: could not get fid for $DIR/$tfile."
 
-       echo "Opening a file by FID succeeded"
+       ffid=$DIR/.lustre/fid/$fid
+
+       echo "ls $fid"
+       ls $ffid > /dev/null || error "ls $ffid failed."
+       echo "touch $fid/$tfile.1"
+       touch $ffid/$tfile.1 || error "touch $ffid/$tfile.1 failed."
+
+       echo "touch $DIR/.lustre/fid/$tfile"
+       touch $DIR/.lustre/fid/$tfile && \
+               error "touch $DIR/.lustre/fid/$tfile should fail."
+
+       echo "Open-by-FID succeeded"
 }
-run_test 154 "Opening a file by FID"
+run_test 154 "Open-by-FID"
 
 test_155_small_load() {
     local temp=$TMP/$tfile
@@ -7835,6 +8069,8 @@ changelog_chmask()
 
 test_160() {
     remote_mds_nodsh && skip "remote MDS with nodsh" && return
+    [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.0) ] ||
+        { skip "Need MDS version at least 2.2.0"; return; }
     USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_register -n)
     echo "Registered as changelog user $USER"
     do_facet $SINGLEMDS $LCTL get_param -n mdd.$MDT0.changelog_users | \
@@ -8039,11 +8275,11 @@ run_test 163 "kernel <-> userspace comms"
 test_169() {
        # do directio so as not to populate the page cache
        log "creating a 10 Mb file"
-       multiop $DIR/$tfile oO_CREAT:O_DIRECT:O_RDWR:w$((10*1048576))c || error "multiop failed while creating a file"
+       $MULTIOP $DIR/$tfile oO_CREAT:O_DIRECT:O_RDWR:w$((10*1048576))c || error "multiop failed while creating a file"
        log "starting reads"
        dd if=$DIR/$tfile of=/dev/null bs=4096 &
        log "truncating the file"
-       multiop $DIR/$tfile oO_TRUNC:c || error "multiop failed while truncating the file"
+       $MULTIOP $DIR/$tfile oO_TRUNC:c || error "multiop failed while truncating the file"
        log "killing dd"
        kill %+ || true # reads might have finished
        echo "wait until dd is finished"
@@ -8229,6 +8465,32 @@ test_181() { # bug 22177
 }
 run_test 181 "Test open-unlinked dir ========================"
 
+test_182() {
+       # disable MDC RPC lock wouldn't crash client
+       local fcount=1000
+       local tcount=4
+
+       mkdir -p $DIR/$tdir || error "creating dir $DIR/$tdir"
+#define OBD_FAIL_MDC_RPCS_SEM          0x804
+       $LCTL set_param fail_loc=0x804
+
+       for (( i=0; i < $tcount; i++ )) ; do
+               mkdir $DIR/$tdir/$i
+               createmany -o $DIR/$tdir/$i/f- $fcount &
+       done
+       wait
+
+       for (( i=0; i < $tcount; i++ )) ; do
+               unlinkmany $DIR/$tdir/$i/f- $fcount &
+       done
+       wait
+
+       rm -rf $DIR/$tdir
+
+       $LCTL set_param fail_loc=0
+}
+run_test 182 "Disable MDC RPCs semaphore wouldn't crash client ================"
+
 # OST pools tests
 POOL=${POOL:-cea1}
 TGT_COUNT=$OSTCOUNT
@@ -8527,6 +8789,106 @@ test_204h() {
 }
 run_test 204h "Print raw stripe count and size ============="
 
+# Figure out which job scheduler is being used, if any,
+# or use a fake one
+if [ -n "$SLURM_JOB_ID" ]; then # SLURM
+       JOBENV=SLURM_JOB_ID
+elif [ -n "$LSB_JOBID" ]; then # Load Sharing Facility
+       JOBENV=LSB_JOBID
+elif [ -n "$PBS_JOBID" ]; then # PBS/Maui/Moab
+       JOBENV=PBS_JOBID
+elif [ -n "$LOADL_STEPID" ]; then # LoadLeveller
+       JOBENV=LOADL_STEP_ID
+elif [ -n "$JOB_ID" ]; then # Sun Grid Engine
+       JOBENV=JOB_ID
+else
+       JOBENV=FAKE_JOBID
+fi
+
+verify_jobstats() {
+       local cmd=$1
+       local target=$2
+
+       # clear old jobstats
+       do_facet $SINGLEMDS lctl set_param mdt.*.job_stats="clear"
+       do_facet ost0 lctl set_param obdfilter.*.job_stats="clear"
+
+       # use a new JobID for this test, or we might see an old one
+       [ "$JOBENV" = "FAKE_JOBID" ] && FAKE_JOBID=test_id.$testnum.$RANDOM
+
+       JOBVAL=${!JOBENV}
+       log "Test: $cmd"
+       log "Using JobID environment variable $JOBENV=$JOBVAL"
+
+       if [ $JOBENV = "FAKE_JOBID" ]; then
+               FAKE_JOBID=$JOBVAL $cmd
+       else
+               $cmd
+       fi
+
+       if [ "$target" = "mdt" -o "$target" = "both" ]; then
+               FACET="$SINGLEMDS" # will need to get MDS number for DNE
+               do_facet $FACET lctl get_param mdt.*.job_stats |
+                       grep $JOBVAL || error "No job stats found on MDT $FACET"
+       fi
+       if [ "$target" = "ost" -o "$target" = "both" ]; then
+               FACET=ost0
+               do_facet $FACET lctl get_param obdfilter.*.job_stats |
+                       grep $JOBVAL || error "No job stats found on OST $FACET"
+       fi
+}
+
+test_205() { # Job stats
+       local cmd
+       OLD_JOBENV=`$LCTL get_param -n jobid_var`
+       if [ $OLD_JOBENV != $JOBENV ]; then
+               do_facet mgs $LCTL conf_param $FSNAME.sys.jobid_var=$JOBENV
+               wait_update $HOSTNAME "$LCTL get_param -n jobid_var" \
+                       $JOBENV || return 1
+       fi
+
+       # mkdir
+       cmd="mkdir $DIR/$tfile"
+       verify_jobstats "$cmd" "mdt"
+       # rmdir
+       cmd="rm -fr $DIR/$tfile"
+       verify_jobstats "$cmd" "mdt"
+       # mknod
+       cmd="mknod $DIR/$tfile c 1 3"
+       verify_jobstats "$cmd" "mdt"
+       # unlink
+       cmd="rm -f $DIR/$tfile"
+       verify_jobstats "$cmd" "mdt"
+       # open & close
+       cmd="$SETSTRIPE -i 0 -c 1 $DIR/$tfile"
+       verify_jobstats "$cmd" "mdt"
+       # setattr
+       cmd="touch $DIR/$tfile"
+       verify_jobstats "$cmd" "both"
+       # write
+       cmd="dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 oflag=sync"
+       verify_jobstats "$cmd" "ost"
+       # read
+       cmd="dd if=$DIR/$tfile of=/dev/null bs=1M count=1 iflag=direct"
+       verify_jobstats "$cmd" "ost"
+       # truncate
+       cmd="$TRUNCATE $DIR/$tfile 0"
+       verify_jobstats "$cmd" "both"
+       # rename
+       cmd="mv -f $DIR/$tfile $DIR/jobstats_test_rename"
+       verify_jobstats "$cmd" "mdt"
+
+       # cleanup
+       rm -f $DIR/jobstats_test_rename
+
+       if [ $OLD_JOBENV != $JOBENV ]; then
+               do_facet mgs $LCTL conf_param $FSNAME.sys.jobid_var=$OLD_JOBENV
+               wait_update $HOSTNAME "$LCTL get_param -n jobid_var" \
+                       $OLD_JOBENV || return 1
+       fi
+}
+run_test 205 "Verify job stats"
+
 test_212() {
        size=`date +%s`
        size=$((size % 8192 + 1))
@@ -8606,12 +8968,12 @@ check_lnet_proc_entry() {
 }
 
 test_215() { # for bugs 18102, 21079, 21517
-       local N='(0|[1-9][0-9]*)'   # non-negative numeric
-       local P='[1-9][0-9]*'       # positive numeric
-       local I='(0|-?[1-9][0-9]*)' # any numeric (0 | >0 | <0)
-       local NET='[a-z][a-z0-9]*'  # LNET net like o2ib2
-       local ADDR='[0-9.]+'        # LNET addr like 10.0.0.1
-       local NID="$ADDR@$NET"      # LNET nid like 10.0.0.1@o2ib2
+       local N='(0|[1-9][0-9]*)'       # non-negative numeric
+       local P='[1-9][0-9]*'           # positive numeric
+       local I='(0|-?[1-9][0-9]*|NA)'  # any numeric (0 | >0 | <0) or NA if no value
+       local NET='[a-z][a-z0-9]*'      # LNET net like o2ib2
+       local ADDR='[0-9.]+'            # LNET addr like 10.0.0.1
+       local NID="$ADDR@$NET"          # LNET nid like 10.0.0.1@o2ib2
 
        local L1 # regexp for 1st line
        local L2 # regexp for 2nd line (optional)
@@ -8745,11 +9107,11 @@ run_test 217 "check lctl ping for hostnames with hiphen ('-')"
 test_218() {
        # do directio so as not to populate the page cache
        log "creating a 10 Mb file"
-       multiop $DIR/$tfile oO_CREAT:O_DIRECT:O_RDWR:w$((10*1048576))c || error "multiop failed while creating a file"
+       $MULTIOP $DIR/$tfile oO_CREAT:O_DIRECT:O_RDWR:w$((10*1048576))c || error "multiop failed while creating a file"
        log "starting reads"
        dd if=$DIR/$tfile of=/dev/null bs=4096 &
        log "truncating the file"
-       multiop $DIR/$tfile oO_TRUNC:c || error "multiop failed while truncating the file"
+       $MULTIOP $DIR/$tfile oO_TRUNC:c || error "multiop failed while truncating the file"
        log "killing dd"
        kill %+ || true # reads might have finished
        echo "wait until dd is finished"
@@ -8909,6 +9271,8 @@ test_225a () {
        if [ -z ${MDSSURVEY} ]; then
               skip_env "mds-survey not found" && return
        fi
+       [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] ||
+            { skip "Need MDS version at least 2.2.51"; return; }
 
        local mds=$(facet_host $SINGLEMDS)
        local target=$(do_nodes $mds 'lctl dl' | \
@@ -8931,6 +9295,8 @@ test_225b () {
        if [ -z ${MDSSURVEY} ]; then
               skip_env "mds-survey not found" && return
        fi
+       [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] ||
+            { skip "Need MDS version at least 2.2.51"; return; }
 
        if [ $($LCTL dl | grep -c osc) -eq 0 ]; then
               skip_env "Need to mount OST to test" && return
@@ -8953,6 +9319,59 @@ test_225b () {
 }
 run_test 225b "Metadata survey sanity with stripe_count = 1"
 
+mcreate_path2fid () {
+       local mode=$1
+       local major=$2
+       local minor=$3
+       local name=$4
+       local desc=$5
+       local path=$DIR/$tdir/$name
+       local fid
+       local rc
+       local fid_path
+
+       $MCREATE --mode=$1 --major=$2 --minor=$3 $path || \
+               error "error: cannot create $desc"
+
+       fid=$($LFS path2fid $path)
+       rc=$?
+       [ $rc -ne 0 ] && error "error: cannot get fid of a $desc"
+
+       fid_path=$($LFS fid2path $DIR $fid)
+       rc=$?
+       [ $rc -ne 0 ] && error "error: cannot get path of a $desc by fid"
+
+       [ "$path" == "$fid_path" ] || \
+               error "error: fid2path returned \`$fid_path', expected \`$path'"
+}
+
+test_226 () {
+       rm -rf $DIR/$tdir
+       mkdir -p $DIR/$tdir
+
+       mcreate_path2fid 0010666 0 0 fifo "FIFO"
+       mcreate_path2fid 0020666 1 3 null "character special file (null)"
+       mcreate_path2fid 0020666 1 255 none "character special file (no device)"
+       mcreate_path2fid 0040666 0 0 dir "directory"
+       mcreate_path2fid 0060666 7 0 loop0 "block special file (loop)"
+       mcreate_path2fid 0100666 0 0 file "regular file"
+       mcreate_path2fid 0120666 0 0 link "symbolic link"
+       mcreate_path2fid 0140666 0 0 sock "socket"
+}
+run_test 226 "call path2fid and fid2path on files of all type"
+
+# LU-1299 Executing or running ldd on a truncated executable does not
+# cause an out-of-memory condition.
+test_227() {
+       dd if=`which date` of=$MOUNT/date bs=1k count=1
+       chmod +x $MOUNT/date
+
+       $MOUNT/date > /dev/null
+       ldd $MOUNT/date > /dev/null
+       rm -f $MOUNT/date
+}
+run_test 227 "running truncated executable does not cause OOM"
+
 #
 # tests that do cleanup/setup should be run at the end
 #