Whamcloud - gitweb
LU-4843 mdt: disallow old clients access striped dir
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index b902571..e58f466 100644 (file)
@@ -49,7 +49,6 @@ PTLDEBUG=${PTLDEBUG:--1}
 SAVE_PWD=$PWD
 LUSTRE=${LUSTRE:-`dirname $0`/..}
 RLUSTRE=${RLUSTRE:-$LUSTRE}
-LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
 export MULTIOP=${MULTIOP:-multiop}
 
 . $LUSTRE/tests/test-framework.sh
@@ -75,8 +74,8 @@ if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
 fi
 
 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
-# bug number for skipped test:        LU-2778 LU-2059 LU-4444
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 57b     50h     69"
+# bug number for skipped test:        LU-2778 LU-4444
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 57b     69"
 
 init_logging
 
@@ -450,9 +449,6 @@ test_5d() {
        grep " $MOUNT " /etc/mtab && \
                error false "unexpected entry in mtab before mount" && return 10
 
-       [ "$(facet_fstype ost1)" = "zfs" ] &&
-               skip "LU-2059: no local config for ZFS OSTs" && return
-
        local rc=0
        start_ost
        start_mds
@@ -699,9 +695,6 @@ test_19a() {
 run_test 19a "start/stop MDS without OSTs"
 
 test_19b() {
-       [ "$(facet_fstype ost1)" = "zfs" ] &&
-               skip "LU-2059: no local config for ZFS OSTs" && return
-
        start_ost || return 1
        stop_ost -f || return 2
 }
@@ -738,9 +731,6 @@ test_21a() {
 run_test 21a "start mds before ost, stop ost first"
 
 test_21b() {
-       [ "$(facet_fstype ost1)" = "zfs" ] &&
-               skip "LU-2059: no local config for ZFS OSTs" && return
-
         start_ost
        start_mds
         wait_osc_import_state mds ost FULL
@@ -1007,9 +997,6 @@ test_26() {
 run_test 26 "MDT startup failure cleans LOV (should return errs)"
 
 test_27a() {
-       [ "$(facet_fstype ost1)" = "zfs" ] &&
-               skip "LU-2059: no local config for ZFS OSTs" && return
-
        start_ost || return 1
        start_mds || return 2
        echo "Requeue thread should have started: "
@@ -1615,7 +1602,7 @@ t32_test() {
        echo "    Arch: $img_arch"
 
        local version=$(version_code $img_commit)
-       [[ $version -gt $(version_code 2.4.0) ]] && ff_convert="no"
+       [[ $version -ge $(version_code 2.5.0) ]] && ff_convert="no"
 
        if [ $fstype == "zfs" ]; then
                # import pool first
@@ -1707,6 +1694,10 @@ t32_test() {
                        error_noexit "mount mdt1 failed"
                        return 1
                }
+
+               $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
+                       error_noexit "enable remote dir create failed"
+
                shall_cleanup_mdt1=true
        fi
 
@@ -2320,7 +2311,7 @@ test_36() { # 12743
        #     different one than the default value here.
        add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
                --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
-       add fs3ost $(mkfs_opts ost1 ${fs3ostdev}) --mgsnode=$MGSNID \
+       add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
                --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
 
         start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
@@ -2587,16 +2578,30 @@ run_test 42 "allow client/server mount/unmount with invalid config param"
 
 test_43() {
        [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
+
+       ID1=${ID1:-501}
+       USER1=$(cat /etc/passwd | grep :$ID1:$ID1: | cut -d: -f1)
+       [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" &&
+               return
+
        setup
        chmod ugo+x $DIR || error "chmod 0 failed"
        set_conf_param_and_check mds                                    \
                "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash"     \
                "$FSNAME.mdt.root_squash"                               \
                "0:0"
+       wait_update $HOSTNAME                                           \
+               "lctl get_param -n llite.${FSNAME}*.root_squash"        \
+               "0:0" ||
+               error "check llite root_squash failed!"
        set_conf_param_and_check mds                                    \
                "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids"   \
                "$FSNAME.mdt.nosquash_nids"                             \
                "NONE"
+       wait_update $HOSTNAME                                           \
+               "lctl get_param -n llite.${FSNAME}*.nosquash_nids"      \
+               "NONE" ||
+               error "check llite nosquash_nids failed!"
 
     #
     # create set of test files
@@ -2612,6 +2617,10 @@ test_43() {
     chmod go-rwx $DIR/$tdir-rootdir   || error "chmod 3 failed"
     touch $DIR/$tdir-rootdir/tfile-1  || error "touch failed"
 
+       echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
+       chmod go-rw $DIR/$tfile-user1file  || error "chmod 7 failed"
+       chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
+
        #
        # check root_squash:
        #   set root squash UID:GID to RUNAS_ID
@@ -2621,6 +2630,10 @@ test_43() {
                "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash"     \
                "$FSNAME.mdt.root_squash"                               \
                "$RUNAS_ID:$RUNAS_ID"
+       wait_update $HOSTNAME                                           \
+               "lctl get_param -n llite.${FSNAME}*.root_squash"        \
+               "$RUNAS_ID:$RUNAS_ID" ||
+               error "check llite root_squash failed!"
 
     ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
     dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
@@ -2628,7 +2641,7 @@ test_43() {
     echo "$ST: root read permission is granted - ok"
 
     echo "444" | \
-    dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
+    dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
         error "$ST: root write permission is denied"
     echo "$ST: root write permission is granted - ok"
 
@@ -2651,6 +2664,31 @@ test_43() {
         error "$ST: root create permission is granted"
     echo "$ST: root create permission is denied - ok"
 
+
+       # LU-1778
+       # check root_squash is enforced independently
+       # of client cache content
+       #
+       # access file by USER1, keep access open
+       # root should be denied access to user file
+
+       runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
+       pid=$!
+       sleep 1
+
+       ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
+       dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
+           { kill $pid; error "$ST: root read permission is granted"; }
+       echo "$ST: root read permission is denied - ok"
+
+       echo "777" | \
+       dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
+           { kill $pid; error "$ST: root write permission is granted"; }
+       echo "$ST: root write permission is denied - ok"
+
+       kill $pid
+       wait $pid
+
        #
        # check nosquash_nids:
        #   put client's NID into nosquash_nids list,
@@ -2663,6 +2701,10 @@ test_43() {
                "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids"   \
                "$FSNAME-MDTall.mdt.nosquash_nids"                      \
                "$NIDLIST"
+       wait_update $HOSTNAME                                           \
+               "lctl get_param -n llite.${FSNAME}*.nosquash_nids"      \
+               "$NIDLIST" ||
+               error "check llite nosquash_nids failed!"
 
     ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
     dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
@@ -3133,6 +3175,8 @@ run_test 50g "deactivated OST should not cause panic====================="
 test_50h() {
        # prepare MDT/OST, make OSC inactive for OST1
        [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
+
+       [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
        do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
                error "tunefs OST1 failed"
        start_mds  || error "Unable to start MDT"
@@ -4358,17 +4402,6 @@ test_73() { #LU-3006
 }
 run_test 73 "failnode to update from mountdata properly"
 
-test_74() { # LU-1606
-       for TESTPROG in $LUSTRE_TESTS_API_DIR/*.c; do
-               gcc -Wall -Werror $LUSTRE_TESTS_API_DIR/simple_test.c \
-                       -I$LUSTRE/include \
-                       -L$LUSTRE/utils -llustreapi ||
-                               error "client api broken"
-       done
-       cleanup || return $?
-}
-run_test 74 "Lustre client api program can compile and link"
-
 test_75() { # LU-2374
        [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.1) ]] &&
                        skip "Need MDS version at least 2.4.1" && return
@@ -4396,7 +4429,7 @@ test_75() { # LU-2374
 }
 run_test 75 "The order of --index should be irrelevant"
 
-test_76() {
+test_76a() {
        [[ $(lustre_version_code mgs) -ge $(version_code 2.4.52) ]] ||
                { skip "Need MDS version at least 2.4.52" && return 0; }
        setup
@@ -4453,7 +4486,18 @@ test_76() {
                error "client_cache_count is not saved after remount"
        stopall
 }
-run_test 76 "set permanent params set_param -P"
+run_test 76a "set permanent params set_param -P"
+
+test_76b() { # LU-4783
+       [[ $(lustre_version_code mgs) -ge $(version_code 2.5.57) ]] ||
+               { skip "Need MGS version at least 2.5.57" && return 0; }
+       stopall
+       setupall
+       do_facet mgs $LCTL get_param mgs.MGS.live.params ||
+               error "start params log failed"
+       stopall
+}
+run_test 76b "verify params log setup correctly"
 
 test_77() { # LU-3445
        local server_version=$(lustre_version_code $SINGLEMDS)