Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / tests / sanity-fid.sh
index ebce17f..2da851a 100644 (file)
@@ -10,6 +10,7 @@ ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
 
 SRCDIR=`dirname $0`
 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
+export SECURITY=${SECURITY:-"null"}
 
 TMP=${TMP:-/tmp}
 FSTYPE=${FSTYPE:-ext3}
@@ -34,13 +35,7 @@ IOPENTEST2=${IOPENTEST2:-iopentest2}
 PTLDEBUG=${PTLDEBUG:-0}
 MODE=${MODE:mds}
 
-if [ $UID -ne 0 ]; then
-       RUNAS_ID="$UID"
-       RUNAS=""
-else
-       RUNAS_ID=${RUNAS_ID:-500}
-       RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
-fi
+. krb5_env.sh
 
 export NAME=${NAME:-local}
 
@@ -86,7 +81,7 @@ check_kernel_version() {
 }
 
 run_one() {
-       if ! mount | grep -q $DIR; then
+       if ! cat /proc/mounts | grep -q $DIR; then
                $START
        fi
        echo $PTLDEBUG >/proc/sys/portals/debug 
@@ -203,13 +198,41 @@ test_1a() {
        
        diff=$(($new_last_fid-$old_last_fid))
        [ $diff -ne 5000 ] && {
-           echo "invalid fid management: \
+           echo "invalid fid management on $MDS: \
                old $old_last_fid, new $new_last_fid"
            error
        }
         rm -fr $DIR/1a0 || error
 }
-run_test 1a " fid managing correctness ============="
+run_test 1a " fid correctness (create) ============="
+
+test_1b() {
+        rm -fr $DIR/1b0 > /dev/null
+       MDS=`find /proc/fs/lustre/mds/* -type d | head -n1 | sed 's/.*\///'`
+       [ -z "$MDS" ] && {
+           echo "no MDS available, skipping test"
+           return 0
+       }
+       count=`find /proc/fs/lustre/mds/* -type d | wc -l`
+       [ $count -gt 1 ] && {
+           echo "more than 1 MDS is found, skipping test"
+           return 0
+       }
+
+       mkdir $DIR/1b0 || error
+       createmany -o $DIR/1b0/f 5000
+       old_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
+       rm -fr $DIR/1b0/f
+       new_last_fid=`cat /proc/fs/lustre/mds/$MDS/last_fid`
+       
+       [ $new_last_fid -ne $old_last_fid ] && {
+           echo "invalid fid management on $MDS: \
+               old $old_last_fid, new $new_last_fid"
+           error
+       }
+        rm -fr $DIR/1b0 || error
+}
+run_test 1b " fid correctness (remove) ============="
 
 TMPDIR=$OLDTMPDIR
 TMP=$OLDTMP