Whamcloud - gitweb
Add proc interface for distinguishing clinet type -- local / remote.
authorfanyong <fanyong>
Wed, 1 Nov 2006 02:33:20 +0000 (02:33 +0000)
committerfanyong <fanyong>
Wed, 1 Nov 2006 02:33:20 +0000 (02:33 +0000)
lustre/llite/lproc_llite.c
lustre/tests/sanity-sec.sh

index 8b03321..d0e5a9a 100644 (file)
@@ -156,6 +156,23 @@ static int ll_rd_filesfree(char *page, char **start, off_t off, int count,
 
 }
 
+static int ll_rd_client_type(char *page, char **start, off_t off, int count,
+                            int *eof, void *data)
+{
+        struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)data);
+        int rc;
+
+        LASSERT(sbi != NULL);
+
+        *eof = 1;
+        if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
+                rc = snprintf(page, count, "remote client\n");
+        else
+                rc = snprintf(page, count, "local client\n");
+
+        return rc;
+}
+
 static int ll_rd_fstype(char *page, char **start, off_t off, int count,
                         int *eof, void *data)
 {
@@ -377,6 +394,7 @@ static struct lprocfs_vars lprocfs_obd_vars[] = {
         { "kbytesavail",  ll_rd_kbytesavail,      0, 0 },
         { "filestotal",   ll_rd_filestotal,       0, 0 },
         { "filesfree",    ll_rd_filesfree,        0, 0 },
+        { "client_type",  ll_rd_client_type,      0, 0 },
         //{ "filegroups",   lprocfs_rd_filegroups,  0, 0 },
         { "max_read_ahead_mb", ll_rd_max_readahead_mb,
                                ll_wr_max_readahead_mb, 0 },
index 319800e..9b08cdc 100644 (file)
@@ -29,7 +29,7 @@ log() {
 
 run_one() {
        BEFORE=`date +%s`
-       log "== test $2= `date +%H:%M:%S` ($BEFORE)"
+       log "== test $1 $2= `date +%H:%M:%S` ($BEFORE)"
        export TESTNAME=test_$1
        test_$1 || error "exit with rc=$?"
        unset TESTNAME
@@ -139,9 +139,12 @@ ROOTSQUASH_UID=$LPROC/mdt/$MDT/rootsquash_uid
 ROOTSQUASH_GID=$LPROC/mdt/$MDT/rootsquash_gid
 NOSQUASH_NIDS=$LPROC/mdt/$MDT/nosquash_nids
 KRB5_REALM=`cat /etc/krb5.conf |grep default_realm| awk '{ print $3 }'`
+CLIENT_TYPE=$LPROC/llite/*/client_type
 USER1=`cat /etc/passwd|grep :500:|cut -d: -f1`
 USER2=`cat /etc/passwd|grep :501:|cut -d: -f1`
 
+grep "local client" $CLIENT_TYPE > /dev/null 2>&1 && EXCEPT="$EXCEPT 2"
+
 if [ ! "$USER1" ]
 then
        echo "==========Please add user1 (uid=500)!=========="
@@ -166,7 +169,7 @@ setup() {
                rm -f $SETXID_CONF_BAK
        fi
        echo $ENABLE_IDENTITY > $IDENTITY_UPCALL
-       echo 1 > $IDENTITY_FLUSH
+       echo -1 > $IDENTITY_FLUSH
        $RUNAS -u 500 ls $DIR
        $RUNAS -u 501 ls $DIR
 }
@@ -203,7 +206,7 @@ test_1() {
        $RUNAS -u 501 -v 500 touch $DIR/d1/f0 && error
        echo "* 501 setuid" > $SETXID_CONF
        echo "enable uid 501 setuid"
-       echo 1 > $IDENTITY_FLUSH
+       echo -1 > $IDENTITY_FLUSH
        $RUNAS -u 501 -v 500 touch $DIR/d1/f1 || error
 
        chown root $DIR/d1
@@ -212,13 +215,13 @@ test_1() {
        $RUNAS -u 501 -g 501 touch $DIR/d1/f2 && error
        echo "* 501 setuid,setgid" > $SETXID_CONF
        echo "enable uid 501 setuid,setgid"
-       echo 1 > $IDENTITY_FLUSH
+       echo -1 > $IDENTITY_FLUSH
        $RUNAS -u 501 -g 501 -j 500 touch $DIR/d1/f3 || error
        $RUNAS -u 501 -v 500 -g 501 -j 500 touch $DIR/d1/f4 || error
 
        rm -f $SETXID_CONF
        rm -rf $DIR/d1
-       echo 1 > $IDENTITY_FLUSH
+       echo -1 > $IDENTITY_FLUSH
 }
 run_test 1 "setuid/gid ============================="
 
@@ -319,7 +322,7 @@ unsetup() {
                mv -f $SETXID_CONF_BAK $SETXID_CONF
        fi
        echo $IDENTITY_UPCALL_BAK > $IDENTITY_UPCALL
-       echo 1 > $IDENTITY_FLUSH
+       echo -1 > $IDENTITY_FLUSH
        $RUNAS -u 500 ls $DIR
        $RUNAS -u 501 ls $DIR
 }