Whamcloud - gitweb
b=3643
[fs/lustre-release.git] / lustre / tests / sanity.sh
index f4a7f22..2aea097 100644 (file)
@@ -7,9 +7,13 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 
-ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
+# bug number for skipped test: 2108
+RENAME_TESTS="24a 24b 24c 24d 24e 24f 24g 24h 24i 24j 24k 24l 24m 24n 24o 48a 48d"
+ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$RENAME_TESTS 58"}
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+case `uname -r` in
+2.6.*) ALWAYS_EXCEPT="$ALWAYS_EXCEPT 54c 55" # bug 3117
+esac
 
 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
 
@@ -17,11 +21,14 @@ SRCDIR=`dirname $0`
 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
 
 TMP=${TMP:-/tmp}
+FSTYPE=${FSTYPE:-ext3}
 
 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
 CREATETEST=${CREATETEST:-createtest}
-LFIND=${LFIND:-lfind}
-LSTRIPE=${LSTRIPE:-lstripe}
+LFS=${LFS:-lfs}
+LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
+LFIND=${LFIND:-"$LFS find"}
+LVERIFY=${LVERIFY:-ll_dirstripe_verify}
 LCTL=${LCTL:-lctl}
 MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
@@ -66,10 +73,30 @@ log() {
        lctl mark "$*" 2> /dev/null || true
 }
 
+trace() {
+       log "STARTING: $*"
+       strace -o $TMP/$1.strace -ttt $*
+       RC=$?
+       log "FINISHED: $*: rc $RC"
+       return 1
+}
+TRACE=${TRACE:-""}
+
+check_kernel_version() {
+       VERSION_FILE=/proc/fs/lustre/kernel_version
+       WANT_VER=$1
+       [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
+       GOT_VER=`cat $VERSION_FILE`
+       [ $GOT_VER -ge $WANT_VER ] && return 0
+       log "test needs at least kernel version $WANT_VER, running $GOT_VER"
+       return 1
+}
+
 run_one() {
        if ! mount | grep -q $DIR; then
                $START
        fi
+       echo -1 >/proc/sys/portals/debug        
        log "== test $1: $2"
        export TESTNAME=test_$1
        test_$1 || error "test_$1: exit with rc=$?"
@@ -155,7 +182,9 @@ DIR=${DIR:-$MOUNT}
 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
 
 LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
-STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
+OSTCOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
+STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/stripecount`
+STRIPESIZE=`cat /proc/fs/lustre/lov/$LOVNAME/stripesize`
 
 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
@@ -166,11 +195,7 @@ build_test_filter
 echo preparing for tests involving mounts
 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
 touch $EXT2_DEV
-mke2fs -F $EXT2_DEV 1000 > /dev/null
-
-EXT3_DEV=${EXT3_DEV:-/tmp/SANITY_EXT3_DEV.LOOP}
-touch $EXT3_DEV
-mkfs.ext3 -F $EXT3_DEV 10000 > /dev/null
+mke2fs -j -F $EXT2_DEV 8000 > /dev/null
 
 test_0() {
        touch $DIR/f
@@ -639,6 +664,12 @@ test_24n() {
 }
 run_test 24n "Statting the old file after renameing (Posix rename 2)"
 
+test_24o() {
+       check_kernel_version 37 || return 0
+       rename_many -s 3287 -v -n 10 $DIR
+}
+run_test 24o "rename of files during htree split ==============="
+
 test_25a() {
        echo '== symlink sanity ============================================='
        mkdir $DIR/d25
@@ -648,9 +679,7 @@ test_25a() {
 run_test 25a "create file in symlinked directory ==============="
 
 test_25b() {
-       if [ ! -d $DIR/d25 ]; then
-               run_one 25a
-       fi
+       [ ! -d $DIR/d25 ] && test_25a
        $CHECKSTAT -t file $DIR/s25/foo || error
 }
 run_test 25b "lookup file in symlinked directory ==============="
@@ -687,9 +716,7 @@ test_26d() {
 run_test 26d "create multiple component recursive symlink ======"
 
 test_26e() {
-       if [ ! -h $DIR/d26-3 ]; then
-               run_one 26d
-       fi
+       [ ! -h $DIR/d26-3 ] && test_26d
        rm $DIR/d26-3
 }
 run_test 26e "unlink multiple component recursive symlink ======"
@@ -697,7 +724,7 @@ run_test 26e "unlink multiple component recursive symlink ======"
 test_27a() {
        echo '== stripe sanity =============================================='
        mkdir $DIR/d27
-       $LSTRIPE $DIR/d27/f0 8192 0 1 || error
+       $LSTRIPE $DIR/d27/f0 65536 0 1 || error
        $CHECKSTAT -t file $DIR/d27/f0 || error
        pass
        log "== test_27b: write to one stripe file ========================="
@@ -706,11 +733,11 @@ test_27a() {
 run_test 27a "one stripe file =================================="
 
 test_27c() {
-       [ "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
+       [ "$OSTCOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
        if [ ! -d $DIR/d27 ]; then
                mkdir $DIR/d27
        fi
-       $LSTRIPE $DIR/d27/f01 8192 0 2 || error
+       $LSTRIPE $DIR/d27/f01 65536 0 2 || error
        [ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] ||
                error "two-stripe file doesn't have two stripes"
        pass
@@ -733,8 +760,8 @@ test_27e() {
        if [ ! -d $DIR/d27 ]; then
                mkdir $DIR/d27
        fi
-       $LSTRIPE $DIR/d27/f12 8192 0 2 || error
-       $LSTRIPE $DIR/d27/f12 8192 0 2 && error
+       $LSTRIPE $DIR/d27/f12 65536 0 2 || error
+       $LSTRIPE $DIR/d27/f12 65536 0 2 && error
        $CHECKSTAT -t file $DIR/d27/f12 || error
 }
 run_test 27e "lstripe existing file (should return error) ======"
@@ -768,10 +795,30 @@ test_27j() {
         if [ ! -d $DIR/d27 ]; then
                 mkdir $DIR/d27
         fi
-        $LSTRIPE $DIR/d27/f27j 8192 $STRIPECOUNT 1 && error || true
+        $LSTRIPE $DIR/d27/f27j 65536 $OSTCOUNT 1 && error || true
 }
 run_test 27j "lstripe with bad stripe offset (should return error)"
 
+test_27k() { # bug 2844
+       FILE=$DIR/d27/f27k
+       LL_MAX_BLKSIZE=$((4 * 1024 * 1024))
+       [ ! -d $DIR/d27 ] && mkdir -p $DIR/d27
+       $LSTRIPE $FILE 67108864 -1 0 || error "lstripe failed"
+       BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'`
+       [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE"
+       dd if=/dev/zero of=$FILE bs=4k count=1
+       BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'`
+       [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE"
+}
+run_test 27k "limit i_blksize for broken user apps ============="
+
+test_27l() {
+       mcreate $DIR/f27l || error "creating file"
+       $RUNAS $LSTRIPE $DIR/f27l 65536 -1 1 && \
+               error "lstripe should have failed" || true
+}
+run_test 27l "check setstripe permissions (should return error)"
+
 test_28() {
        mkdir $DIR/d28
        $CREATETEST $DIR/d28/ct || error
@@ -849,6 +896,12 @@ test_31d() {
 }
 run_test 31d "remove of open directory ========================="
 
+test_31e() {
+       check_kernel_version 34 || return 0
+       openfilleddirunlink $DIR/d31e || error
+}
+run_test 31e "remove of open non-empty directory ==============="
+
 test_32a() {
        echo "== more mountpoints and symlinks ================="
        [ -e $DIR/d32a ] && rm -fr $DIR/d32a
@@ -1085,92 +1138,92 @@ run_test 33a "test open file(mode=0444) with O_RDWR (should return error)"
 
 TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
 test_34a() {
-       rm -f $DIR/test_34_file
-       $MCREATE $DIR/test_34_file || error
-       $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
-       $TRUNCATE $DIR/test_34_file $TEST_34_SIZE || error
-       $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
-       $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
+       rm -f $DIR/f34
+       $MCREATE $DIR/f34 || error
+       $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
+       $TRUNCATE $DIR/f34 $TEST_34_SIZE || error
+       $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
+       $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
 }
 run_test 34a "truncate file that has not been opened ==========="
 
 test_34b() {
-       [ ! -f $DIR/test_34_file ] && run_one 34a
-       $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
-       $OPENFILE -f O_RDONLY $DIR/test_34_file
-       $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
-       $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
+       [ ! -f $DIR/f34 ] && test_34a
+       $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
+       $OPENFILE -f O_RDONLY $DIR/f34
+       $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
+       $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
 }
 run_test 34b "O_RDONLY opening file doesn't create objects ====="
 
 test_34c() {
-       [ ! -f $DIR/test_34_file ] && run_one 34a 
-       $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
-       $OPENFILE -f O_RDWR $DIR/test_34_file
-       $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" && error
-       $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
+       [ ! -f $DIR/f34 ] && test_34a 
+       $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
+       $OPENFILE -f O_RDWR $DIR/f34
+       $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" && error
+       $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
 }
 run_test 34c "O_RDWR opening file-with-size works =============="
 
 test_34d() {
-       dd if=/dev/zero of=$DIR/test_34_file conv=notrunc bs=4k count=1 || error
-       $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
-       rm $DIR/test_34_file
+       [ ! -f $DIR/f34 ] && test_34a 
+       dd if=/dev/zero of=$DIR/f34 conv=notrunc bs=4k count=1 || error
+       $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
+       rm $DIR/f34
 }
 run_test 34d "write to sparse file ============================="
 
 test_34e() {
-       rm -f $DIR/test_34_file
-       $MCREATE $DIR/test_34_file || error
-       $TRUNCATE $DIR/test_34_file 1000 || error
-       $CHECKSTAT -s 1000 $DIR/test_34_file || error
-       $OPENFILE -f O_RDWR $DIR/test_34_file
-       $CHECKSTAT -s 1000 $DIR/test_34_file || error
+       rm -f $DIR/f34e
+       $MCREATE $DIR/f34e || error
+       $TRUNCATE $DIR/f34e 1000 || error
+       $CHECKSTAT -s 1000 $DIR/f34e || error
+       $OPENFILE -f O_RDWR $DIR/f34e
+       $CHECKSTAT -s 1000 $DIR/f34e || error
 }
 run_test 34e "create objects, some with size and some without =="
 
 test_35a() {
-       cp /bin/sh $DIR/test_35a_file
-       chmod 444 $DIR/test_35a_file
-       chown $RUNAS_ID $DIR/test_35a_file
-       $RUNAS $DIR/test_35a_file && error || true
-       rm $DIR/test_35a_file
+       cp /bin/sh $DIR/f35a
+       chmod 444 $DIR/f35a
+       chown $RUNAS_ID $DIR/f35a
+       $RUNAS $DIR/f35a && error || true
+       rm $DIR/f35a
 }
 run_test 35a "exec file with mode 444 (should return and not leak) ====="
 
-
 test_36a() {
-       rm -f $DIR/test_36_file
-       utime $DIR/test_36_file || error
+       rm -f $DIR/f36
+       utime $DIR/f36 || error
 }
 run_test 36a "MDS utime check (mknod, utime) ==================="
 
 test_36b() {
-       echo "" > $DIR/test_36_file
-       utime $DIR/test_36_file || error
+       echo "" > $DIR/f36
+       utime $DIR/f36 || error
 }
 run_test 36b "OST utime check (open, utime) ===================="
 
 test_36c() {
-       rm -f $DIR/d36/test_36_file
+       rm -f $DIR/d36/f36
        mkdir $DIR/d36
        chown $RUNAS_ID $DIR/d36
-       $RUNAS utime $DIR/d36/test_36_file || error
+       $RUNAS utime $DIR/d36/f36 || error
 }
 run_test 36c "non-root MDS utime check (mknod, utime) =========="
 
 test_36d() {
-       [ ! -d $DIR/d36 ] && run_one 36c
-       echo "" > $DIR/d36/test_36_file
-       $RUNAS utime $DIR/d36/test_36_file || error
+       [ ! -d $DIR/d36 ] && test_36c
+       echo "" > $DIR/d36/f36
+       $RUNAS utime $DIR/d36/f36 || error
 }
 run_test 36d "non-root OST utime check (open, utime) ==========="
 
 test_36e() {
-       [ $RUNAS_ID -eq $UID ] && return
+       [ $RUNAS_ID -eq $UID ] && echo "skipping test 36e" && return
        [ ! -d $DIR/d36 ] && mkdir $DIR/d36
-       touch $DIR/d36/test_36_file2
-       $RUNAS utime $DIR/d36/test_36_file2 && error || true
+       touch $DIR/d36/f36e
+       $RUNAS utime $DIR/d36/f36e && error "utime worked, want failure" || true
 }
 run_test 36e "utime on non-owned file (should return error) ===="
 
@@ -1221,34 +1274,64 @@ count_ost_writes() {
         cat /proc/fs/lustre/osc/*/stats |
             awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
 }
-start_kupdated() {
+
+# decent default
+WRITEBACK_SAVE=500
+
+start_writeback() {
        # in 2.6, restore /proc/sys/vm/dirty_writeback_centisecs
-       kill -CONT `pidof kupdated`
+       if [ -f /proc/sys/vm/dirty_writeback_centisecs ]; then
+               echo $WRITEBACK_SAVE > /proc/sys/vm/dirty_writeback_centisecs
+       else
+               # if file not here, we are a 2.4 kernel
+               kill -CONT `pidof kupdated`
+       fi
 }
-stop_kupdated() {
+stop_writeback() {
+       # setup the trap first, so someone cannot exit the test at the
+       # exact wrong time and mess up a machine
+       trap start_writeback EXIT
        # in 2.6, save and 0 /proc/sys/vm/dirty_writeback_centisecs
-       kill -STOP `pidof kupdated`
-       trap start_kupdated EXIT
+       if [ -f /proc/sys/vm/dirty_writeback_centisecs ]; then
+               WRITEBACK_SAVE=`cat /proc/sys/vm/dirty_writeback_centisecs`
+               echo 0 > /proc/sys/vm/dirty_writeback_centisecs
+       else
+               # if file not here, we are a 2.4 kernel
+               kill -STOP `pidof kupdated`
+       fi
+}
+
+# ensure that all stripes have some grant before we test client-side cache
+setup_test42() {
+       [ "$SETUP_TEST42" ] && return
+       for i in `seq -f $DIR/f42-%g 1 $OSTCOUNT`; do
+               dd if=/dev/zero of=$i bs=4k count=1
+               rm $i
+       done
+       SETUP_TEST42=DONE
 }
 
 # Tests 42* verify that our behaviour is correct WRT caching, file closure,
 # file truncation, and file removal.
 test_42a() {
+       setup_test42
        cancel_lru_locks OSC
-       stop_kupdated
-        sync # just to be safe
-        BEFOREWRITES=`count_ost_writes`
-        dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
-        AFTERWRITES=`count_ost_writes`
-        [ $BEFOREWRITES -eq $AFTERWRITES ] || \
+       stop_writeback
+       sync; sleep 1; sync # just to be safe
+       BEFOREWRITES=`count_ost_writes`
+       grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/cur_grant_bytes
+       dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
+       AFTERWRITES=`count_ost_writes`
+       [ $BEFOREWRITES -eq $AFTERWRITES ] || \
                error "$BEFOREWRITES < $AFTERWRITES"
-       start_kupdated
+       start_writeback
 }
 run_test 42a "ensure that we don't flush on close =============="
 
 test_42b() {
+       setup_test42
        cancel_lru_locks OSC
-       stop_kupdated
+       stop_writeback
         sync
         dd if=/dev/zero of=$DIR/f42b bs=1024 count=100
         BEFOREWRITES=`count_ost_writes`
@@ -1262,7 +1345,7 @@ test_42b() {
         [ $BEFOREWRITES -eq $AFTERWRITES ] ||
             error "$BEFOREWRITES < $AFTERWRITES on sync"
         dmesg | grep 'error from obd_brw_async' && error 'error writing back'
-       start_kupdated
+       start_writeback
         return 0
 }
 run_test 42b "test destroy of file with cached dirty data ======"
@@ -1285,7 +1368,7 @@ trunc_test() {
         file=$DIR/$test
         offset=$2
        cancel_lru_locks OSC
-       stop_kupdated
+       stop_writeback
        # prime the file with 0,EOF PW to match
        touch $file
         $TRUNCATE $file 0
@@ -1296,7 +1379,7 @@ trunc_test() {
         $TRUNCATE $file $offset
         cancel_lru_locks OSC
         AFTERWRITES=`count_ost_writes`
-       start_kupdated
+       start_writeback
 }
 
 test_42c() {
@@ -1358,8 +1441,8 @@ test_43c() {
 run_test 43c "md5sum of copy into lustre========================"
 
 test_44() {
-       [  "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
-       dd if=/dev/zero of=$DIR/f1 bs=4k count=1 seek=127
+       [  "$OSTCOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
+       dd if=/dev/zero of=$DIR/f1 bs=4k count=1 seek=1023
        dd if=$DIR/f1 bs=4k count=1
 }
 run_test 44 "zero length read from a sparse stripe ============="
@@ -1414,7 +1497,7 @@ test_45() {
        f="$DIR/f45"
        # Obtain grants from OST if it supports it
        echo blah > ${f}_grant
-       stop_kupdated
+       stop_writeback
        sync
        do_dirty_record "echo blah > $f"
        [ $before -eq $after ] && error "write wasn't cached"
@@ -1428,7 +1511,7 @@ test_45() {
        [ $before -eq $after ] && error "write wasn't cached"
        do_dirty_record "cancel_lru_locks OSC"
        [ $before -gt $after ] || error "lock cancellation didn't lower dirty count"
-       start_kupdated
+       start_writeback
 }
 run_test 45 "osc io page accounting ============================"
 
@@ -1436,20 +1519,20 @@ page_size() {
        getconf PAGE_SIZE
 }
 
-# in a 2 stripe file (lov.sh), page 63 maps to page 31 in its object.  this
+# in a 2 stripe file (lov.sh), page 1023 maps to page 511 in its object.  this
 # test tickles a bug where re-dirtying a page was failing to be mapped to the
-# objects offset and an assert hit when an rpc was built with 63's mapped 
-# offset 31 and 31's raw 31 offset. it also found general redirtying bugs.
+# objects offset and an assert hit when an rpc was built with 1023's mapped 
+# offset 511 and 511's raw 511 offset. it also found general redirtying bugs.
 test_46() {
        f="$DIR/f46"
-       stop_kupdated
+       stop_writeback
        sync
-       dd if=/dev/zero of=$f bs=`page_size` seek=31 count=1
+       dd if=/dev/zero of=$f bs=`page_size` seek=511 count=1
        sync
-       dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=63 count=1
-       dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=31 count=1
+       dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=1023 count=1
+       dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=511 count=1
        sync
-       start_kupdated
+       start_writeback
 }
 run_test 46 "dirtying a previously written page ================"
 
@@ -1459,14 +1542,80 @@ test_47() {
 }
 run_test 47 "Device nodes check ================================"
 
-test_48() {
-        mkdir $DIR/d48
-        cd $DIR/d48
-        mv $DIR/d48 $DIR/d48.new || error "move directory failed"
-        mkdir $DIR/d48 || error "recreate diectory failed"
-        ls || error "can't list after recreate directory"
-}
-run_test 48 "Access renamed current working directory =========="
+test_48a() { # bug 2399
+       check_kernel_version 34 || return 0
+       mkdir -p $DIR/d48a
+       cd $DIR/d48a
+       mv $DIR/d48a $DIR/d48.new || error "move directory failed"
+       mkdir $DIR/d48a || error "recreate directory failed"
+       touch foo || error "'touch foo' failed after recreating cwd"
+       mkdir bar || error "'mkdir foo' failed after recreating cwd"
+       ls . || error "'ls .' failed after recreating cwd"
+       ls .. || error "'ls ..' failed after removing cwd"
+       cd . || error "'cd .' failed after recreating cwd"
+       mkdir . && error "'mkdir .' worked after recreating cwd"
+       rmdir . && error "'rmdir .' worked after recreating cwd"
+       ln -s . baz || error "'ln -s .' failed after recreating cwd"
+       cd .. || error "'cd ..' failed after recreating cwd"
+}
+run_test 48a "Access renamed working dir (should return errors)="
+
+test_48b() { # bug 2399
+       check_kernel_version 34 || return 0
+       mkdir -p $DIR/d48b
+       cd $DIR/d48b
+       rmdir $DIR/d48b || error "remove cwd $DIR/d48b failed"
+       touch foo && error "'touch foo' worked after removing cwd"
+       mkdir foo && error "'mkdir foo' worked after removing cwd"
+       ls . && error "'ls .' worked after removing cwd"
+       ls .. || error "'ls ..' failed after removing cwd"
+       cd . && error "'cd .' worked after removing cwd"
+       mkdir . && error "'mkdir .' worked after removing cwd"
+       rmdir . && error "'rmdir .' worked after removing cwd"
+       ln -s . foo && error "'ln -s .' worked after removing cwd" || true
+       #cd .. || error "'cd ..' failed after removing cwd"
+}
+run_test 48b "Access removed working dir (should return errors)="
+
+test_48c() { # bug 2350
+       check_kernel_version 36 || return 0
+       #sysctl -w portals.debug=-1
+       #set -vx
+       mkdir -p $DIR/d48c/dir
+       cd $DIR/d48c/dir
+       $TRACE rmdir $DIR/d48c/dir || error "remove cwd $DIR/d48c/dir failed"
+       $TRACE touch foo && error "'touch foo' worked after removing cwd"
+       $TRACE mkdir foo && error "'mkdir foo' worked after removing cwd"
+       $TRACE ls . && error "'ls .' worked after removing cwd"
+       $TRACE ls .. || error "'ls ..' failed after removing cwd"
+       $TRACE cd . && error "'cd .' worked after recreate cwd"
+       $TRACE mkdir . && error "'mkdir .' worked after removing cwd"
+       $TRACE rmdir . && error "'rmdir .' worked after removing cwd"
+       $TRACE ln -s . foo && error "'ln -s .' worked after removing cwd" ||true
+       $TRACE cd .. || echo "'cd ..' failed after removing cwd (`pwd)`"
+}
+run_test 48c "Access removed working subdir (should return errors)"
+
+test_48d() { # bug 2350
+       check_kernel_version 36 || return 0
+       #sysctl -w portals.debug=-1
+       #set -vx
+       mkdir -p $DIR/d48d/dir
+       cd $DIR/d48d/dir
+       pwd
+       ls .
+       $TRACE rm -vr $DIR/d48d || error "remove cwd+parent $DIR/d48d failed"
+       $TRACE touch foo && error "'touch foo' worked after removing cwd"
+       $TRACE mkdir foo && error "'mkdir foo' worked after removing cwd"
+       $TRACE ls . && error "'ls .' worked after removing cwd"
+       $TRACE ls .. && echo "'ls ..' worked after removing cwd" # bug 3415
+       $TRACE cd . && error "'cd .' worked after recreate cwd"
+       $TRACE mkdir . && error "'mkdir .' worked after removing cwd"
+       $TRACE rmdir . && error "'rmdir .' worked after removing cwd"
+       $TRACE ln -s . foo && error "'ln -s .' worked after removing cwd" ||true
+       $TRACE cd .. && error "'cd ..' worked after removing cwd" || true
+}
+run_test 48d "Access removed parent subdir (should return errors)"
 
 test_50() {
        # bug 1485
@@ -1544,26 +1693,66 @@ test_53() {
 }
 run_test 53 "verify that MDS and OSTs agree on pre-creation ===="
 
-test_54() {
-       $SOCKETSERVER $DIR/socket &
-       sleep 1
+test_54a() {
+       $SOCKETSERVER $DIR/socket
        $SOCKETCLIENT $DIR/socket || error
        $MUNLINK $DIR/socket
 }
-run_test 54 "unix damain socket test ==========================="
+run_test 54a "unix damain socket test =========================="
+
+test_54b() {
+       f="$DIR/f54b"
+       mknod $f c 1 3
+       chmod 0666 $f
+       dd if=/dev/zero of=$f bs=`page_size` count=1 
+}
+run_test 54b "char device works in lustre ======================"
+
+test_54c() {
+       tfile="$DIR/f54c"
+       tdir="$DIR/d54c"
+       loopdev="$DIR/loop54c"
+       
+       for i in `seq 3 7`; do
+               rm -f $loopdev
+               mknod $loopdev b 7 $i
+               losetup $loopdev > /dev/null 2>&1 || break
+       done
+       echo "make a loop file system with $tfile on $loopdev ($i)..."  
+       dd if=/dev/zero of=$tfile bs=`page_size` seek=1024 count=1 > /dev/null
+       losetup $loopdev $tfile || error "can't set up $loopdev for $tfile"
+       mkfs.ext2 $loopdev || error "mke2fs on $loopdev"
+       mkdir -p $tdir
+       mount -t ext2 $loopdev $tdir || error "error mounting $loopdev on $tdir"
+       dd if=/dev/zero of=$tdir/tmp bs=`page_size` count=30 || error "dd write"
+       df $tdir
+       dd if=$tdir/tmp of=/dev/zero bs=`page_size` count=30 || error "dd read"
+       umount $tdir
+       losetup -d $loopdev
+       rm $loopdev
+}
+run_test 54c "block device works in lustre ====================="
+
+test_54d() {
+       f="$DIR/f54d"
+       string="aaaaaa"
+       mknod $f p
+       [ "$string" = `echo $string > $f | cat $f` ] || error
+}
+run_test 54d "fifo device works in lustre ======================"
 
 test_55() {
         rm -rf $DIR/d55
         mkdir $DIR/d55
-        mount -t ext3 -o loop,iopen $EXT3_DEV $DIR/d55 || error
+        mount -t $FSTYPE -o loop,iopen $EXT2_DEV $DIR/d55 || error
         touch $DIR/d55/foo
         $IOPENTEST1 $DIR/d55/foo $DIR/d55 || error
         $IOPENTEST2 $DIR/d55 || error
-        echo "check for $EXT3_DEV. Please wait..."
+        echo "check for $EXT2_DEV. Please wait..."
         rm -rf $DIR/d55/*
         umount $DIR/d55 || error
 }
-run_test 55 "check iopen_connect_dentry()======================="
+run_test 55 "check iopen_connect_dentry() ======================"
 
 test_56() {
         rm -rf $DIR/d56
@@ -1603,7 +1792,7 @@ test_56() {
         $LFIND --obd wrong_uuid $DIR/d56 2>&1 | grep -q "unknown obduuid" || \
                 error "lfs find --obd wrong_uuid should return error information"
 
-        [  "$STRIPECOUNT" -lt 2 ] && \
+        [  "$OSTCOUNT" -lt 2 ] && \
                 echo "skipping other lfs find --obd test" && return
         FILENUM=`$LFIND --recursive $DIR/d56 | sed -n '/^[      ]*1[    ]/p' | wc -l`
         OBDUUID=`$LFIND --recursive $DIR/d56 | sed -n '/^[      ]*1:/p' | awk '{print $2}'`
@@ -1713,9 +1902,9 @@ test_62() {
 }
 run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
 
-# bug 2319 - osic_wait() interrupted causes crash because of invalid waitq.
+# bug 2319 - oig_wait() interrupted causes crash because of invalid waitq.
 test_63() {
-       MAX_DIRTY_MB=`cat /proc/fs/lustre/osc/*/max_dirty_mb | head -1`
+       MAX_DIRTY_MB=`cat /proc/fs/lustre/osc/*/max_dirty_mb | head -1`
        for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
                echo 0 > $i
        done
@@ -1731,18 +1920,90 @@ test_63() {
        done
        true
 }
-run_test 63 "Verify osic_wait interruption does not crash ======"
+run_test 63 "Verify oig_wait interruption does not crash ======"
 
 test_64a () {
        df $DIR
        grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/cur*
 }
-run_test 64a "verify filter grant calculations (in kernel) ======"
+run_test 64a "verify filter grant calculations (in kernel) ====="
 
 test_64b () {
        sh oos.sh $MOUNT
 }
-run_test 64b "check out-of-space detection on client ============"
+run_test 64b "check out-of-space detection on client ==========="
+
+# bug 1414 - set/get directories' stripe info
+test_65a() {
+       mkdir -p $DIR/d65
+       touch $DIR/d65/f1
+       $LVERIFY $DIR/d65 $DIR/d65/f1 || error "lverify failed"
+}
+run_test 65a "directory with no stripe info ===================="
+
+test_65b() {
+       mkdir -p $DIR/d65
+               $LSTRIPE $DIR/d65 $(($STRIPESIZE * 2)) 0 1 || error "setstripe"
+       touch $DIR/d65/f2
+       $LVERIFY $DIR/d65 $DIR/d65/f2 || error "lverify failed"
+}
+run_test 65b "directory setstripe $(($STRIPESIZE * 2)) 0 1 ==============="
+
+test_65c() {
+       if [ $OSTCOUNT -gt 1 ]; then
+               mkdir -p $DIR/d65
+               $LSTRIPE $DIR/d65 $(($STRIPESIZE * 4)) 1 \
+                       $(($OSTCOUNT - 1)) || error "setstripe"
+               touch $DIR/d65/f3
+               $LVERIFY $DIR/d65 $DIR/d65/f3 || error "lverify failed"
+       fi
+}
+run_test 65c "directory setstripe $(($STRIPESIZE * 4)) 1 $(($OSTCOUNT - 1))"
+
+[ $STRIPECOUNT -eq 0 ] && sc=1 || sc=$(($STRIPECOUNT - 1))
+
+test_65d() {
+       mkdir -p $DIR/d65
+       $LSTRIPE $DIR/d65 $STRIPESIZE -1 $sc || error "setstripe"
+       touch $DIR/d65/f4 $DIR/d65/f5
+       $LVERIFY $DIR/d65 $DIR/d65/f4 $DIR/d65/f5 || error "lverify failed"
+}
+run_test 65d "directory setstripe $STRIPESIZE -1 $sc ======================"
+
+test_65e() {
+       mkdir -p $DIR/d65
+
+       $LSTRIPE $DIR/d65 0 -1 0 || error "setstripe"
+       touch $DIR/d65/f6
+       $LVERIFY $DIR/d65 $DIR/d65/f6 || error "lverify failed"
+}
+run_test 65e "directory setstripe 0 -1 0 (default) ============="
+
+test_65f() {
+       mkdir -p $DIR/d65f
+       $RUNAS $LSTRIPE $DIR/d65f 0 -1 0 && error "setstripe succeeded" || true
+}
+run_test 65f "dir setstripe permission (should return error) ==="
+
+# bug 2543 - update blocks count on client
+test_66() {
+       COUNT=${COUNT:-8}
+       dd if=/dev/zero of=$DIR/f66 bs=1k count=$COUNT
+       sync
+       BLOCKS=`ls -s $DIR/f66 | awk '{ print $1 }'`
+       [ $BLOCKS -ge $COUNT ] || error "$DIR/f66 blocks $BLOCKS < $COUNT"
+}
+run_test 66 "update inode blocks count on client ==============="
+
+test_67() { # bug 3285 - supplementary group fails on MDS, passes on client
+       [ "$RUNAS_ID" = "$UID" ] && echo "skipping test 67" && return
+       check_kernel_version 35 || return 0
+       mkdir $DIR/d67
+       chmod 771 $DIR/d67
+       chgrp $RUNAS_ID $DIR/d67
+       $RUNAS -g $((RUNAS_ID + 1)) -G1,2,$RUNAS_ID ls $DIR/d67 && error || true
+}
+run_test 67 "supplementary group failure (should return error) ="
 
 # on the LLNL clusters, runas will still pick up root's $TMP settings,
 # which will not be writable for the runas user, and then you get a CVS
@@ -1763,14 +2024,19 @@ test_99a() {
 run_test 99a "cvs init ========================================="
 
 test_99b() {
-       [ ! -d $DIR/d99cvsroot ] && run_one 99a
+       [ ! -d $DIR/d99cvsroot ] && test_99a
        cd /etc/init.d
-       $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" d99reposname vtag rtag
+       # 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')
+       $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" $TOIGNORE \
+               d99reposname vtag rtag
 }
 run_test 99b "cvs import ======================================="
 
 test_99c() {
-       [ ! -d $DIR/d99cvsroot ] && run_one 99b
+       [ ! -d $DIR/d99cvsroot ] && test_99b
        cd $DIR
        mkdir -p $DIR/d99reposname
        chown $RUNAS_ID $DIR/d99reposname
@@ -1779,7 +2045,7 @@ test_99c() {
 run_test 99c "cvs checkout ====================================="
 
 test_99d() {
-       [ ! -d $DIR/d99cvsroot ] && run_one 99c
+       [ ! -d $DIR/d99cvsroot ] && test_99c
        cd $DIR/d99reposname
        $RUNAS touch foo99
        $RUNAS cvs add -m 'addmsg' foo99
@@ -1787,14 +2053,14 @@ test_99d() {
 run_test 99d "cvs add =========================================="
 
 test_99e() {
-       [ ! -d $DIR/d99cvsroot ] && run_one 99c
+       [ ! -d $DIR/d99cvsroot ] && test_99c
        cd $DIR/d99reposname
        $RUNAS cvs update
 }
 run_test 99e "cvs update ======================================="
 
 test_99f() {
-       [ ! -d $DIR/d99cvsroot ] && run_one 99d
+       [ ! -d $DIR/d99cvsroot ] && test_99d
        cd $DIR/d99reposname
        $RUNAS cvs commit -m 'nomsg' foo99
 }