From 02747e042a333319be5e4c32fc9e8c00a51b5ebd Mon Sep 17 00:00:00 2001 From: fanyong Date: Wed, 1 Nov 2006 02:33:20 +0000 Subject: [PATCH] Add proc interface for distinguishing clinet type -- local / remote. --- lustre/llite/lproc_llite.c | 18 ++++++++++++++++++ lustre/tests/sanity-sec.sh | 15 +++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 8b03321..d0e5a9a 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -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 }, diff --git a/lustre/tests/sanity-sec.sh b/lustre/tests/sanity-sec.sh index 319800e..9b08cdc 100644 --- a/lustre/tests/sanity-sec.sh +++ b/lustre/tests/sanity-sec.sh @@ -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 } -- 1.8.3.1