Whamcloud - gitweb
LU-13776 tests: make sure pjdfstest.sh writes to tmp
[fs/lustre-release.git] / lustre / tests / sanity-krb5.sh
index 6d3ba8e..7afb38c 100755 (executable)
@@ -118,6 +118,7 @@ stop_dbench()
 }
 
 restore_krb5_cred() {
+       keyctl reap
        cp $KRB5_CRED_SAVE $KRB5_CRED
        chown $RUNAS_ID:$RUNAS_ID $KRB5_CRED
        chmod 0600 $KRB5_CRED
@@ -129,7 +130,7 @@ check_multiple_gss_daemons() {
        local gssd_name=$(basename $gssd)
 
        for ((i = 0; i < 10; i++)); do
-               do_facet $facet "$gssd -v &"
+               do_facet $facet "$gssd -v"
        done
 
        # wait daemons entering "stable" status
@@ -310,25 +311,18 @@ test_5() {
 
        # flush context, and touch
        $RUNAS $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
-       $RUNAS touch $file2 &
-       TOUCHPID=$!
-
-       # wait certain time
-       echo "waiting $wait_time seconds for touch pid $TOUCHPID"
-       sleep $wait_time
-       num=$(ps --no-headers -p $TOUCHPID | wc -l)
-       [ $num -eq 1 ] || error "touch already ended ($num)"
-       echo "process $TOUCHPID still hanging there... OK"
+       $RUNAS touch $file2 && error 'should fail without lsvcgssd'
 
        # restart lsvcgssd, expect touch suceed
        echo "restart lsvcgssd and recovering"
        start_gss_daemons $(comma_list $(mdts_nodes)) "$LSVCGSSD -v"
        sleep 5
        check_gss_daemon_nodes $(comma_list $(mdts_nodes)) lsvcgssd
-       wait $TOUCHPID || error "touch fail"
+       $RUNAS keyctl reap
+       $RUNAS touch $file2 || error 'should not fail now'
        [ -f $file2 ] || error "$file2 not found"
 }
-run_test 5 "lsvcgssd dead, operations lead to recovery"
+run_test 5 "lsvcgssd dead, operations fail"
 
 test_6() {
        local nfile=10
@@ -415,7 +409,7 @@ test_8()
        do_facet $SINGLEMDS $LCTL set_param fail_loc=0
        wait $TOUCHPID || error "touch should have succeeded"
 
-       $LCTL dk | grep "Early reply #" || error "No early reply"
+       $LCTL dk | grep -i "Early reply #" || error "No early reply"
 
        debugrestore
        do_facet $SINGLEMDS "echo $ATOLDBASE >> $ATHISTORY" || true
@@ -466,10 +460,10 @@ test_99() {
        echo "original general rules: $nrule_old"
 
        for ((i = $nrule_old; i < $max; i++)); do
-               set_rule $FSNAME elan$i any krb5n || error "set rule $i"
+               set_rule $FSNAME ${NETTYPE}$i any krb5n || error "set rule $i"
        done
        for ((i = $nrule_old; i < $max; i++)); do
-               set_rule $FSNAME elan$i any || error "remove rule $i"
+               set_rule $FSNAME ${NETTYPE}$i any || error "remove rule $i"
        done
 
        nrule_new=$(do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME \
@@ -486,10 +480,10 @@ test_99() {
        echo "original target rules: $nrule_old"
 
        for ((i = $nrule_old; i < $max; i++)); do
-               set_rule $FSNAME-MDT0000 elan$i any krb5i || error "set rule $i"
+               set_rule $FSNAME-MDT0000 ${NETTYPE}$i any krb5i || error "set rule $i"
        done
        for ((i = $nrule_old; i < $max; i++)); do
-               set_rule $FSNAME-MDT0000 elan$i any || error "remove rule $i"
+               set_rule $FSNAME-MDT0000 ${NETTYPE}$i any || error "remove rule $i"
        done
 
        nrule_new=$(do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME \
@@ -719,7 +713,7 @@ test_102() {
 run_test 102 "survive from insanely fast flavor switch"
 
 test_150() {
-       local save_opts
+       local mount_opts
        local count
        local clients=$CLIENTS
 
@@ -736,18 +730,14 @@ test_150() {
        zconf_umount_clients $clients $MOUNT || return 1
 
        # mount client with conflict flavor - should fail
-       save_opts=$MOUNTOPT
-       MOUNTOPT="$MOUNTOPT,mgssec=krb5p"
-       zconf_mount_clients $clients $MOUNT &&
+       mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=krb5p"
+       zconf_mount_clients $clients $MOUNT $mount_opts &&
            error "mount with conflict flavor should have failed"
-       MOUNTOPT=$save_opts
 
        # mount client with same flavor - should succeed
-       save_opts=$MOUNTOPT
-       MOUNTOPT="$MOUNTOPT,mgssec=null"
-       zconf_mount_clients $clients $MOUNT ||
+       mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=null"
+       zconf_mount_clients $clients $MOUNT $mount_opts ||
            error "mount with same flavor should have succeeded"
-       MOUNTOPT=$save_opts
        zconf_umount_clients $clients $MOUNT || return 2
 
        # mount client with default flavor - should succeed
@@ -765,23 +755,42 @@ test_151() {
        # umount everything, modules still loaded
        stopall
 
+       # start gss daemon on mgs node
+       combined_mgs_mds || start_gss_daemons $mgs_HOST "$LSVCGSSD -v"
+
+       # start mgs
+       start mgs $(mgsdevname 1) $MDS_MOUNT_OPTS
+
        # mount mgs with default flavor, in current framework it means mgs+mdt1.
        # the connection of mgc of mdt1 to mgs is expected fail.
        DEVNAME=$(mdsdevname 1)
-       start mds1 $DEVNAME $MDS_MOUNT_OPTS &&
+       start mds1 $DEVNAME $MDS_MOUNT_OPTS
+       wait_mgc_import_state mds FULL 0 &&
            error "mount with default flavor should have failed"
+       stop mds1
 
        # mount with unauthorized flavor should fail
        save_opts=$MDS_MOUNT_OPTS
+       if [ -z "$MDS_MOUNT_OPTS" ]; then
+           MDS_MOUNT_OPTS="-o mgssec=null"
+       else
        MDS_MOUNT_OPTS="$MDS_MOUNT_OPTS,mgssec=null"
-       start mds1 $DEVNAME $MDS_MOUNT_OPTS &&
+       fi
+       start mds1 $DEVNAME $MDS_MOUNT_OPTS
+       wait_mgc_import_state mds FULL 0 &&
            error "mount with unauthorized flavor should have failed"
        MDS_MOUNT_OPTS=$save_opts
+       stop mds1
 
        # mount with designated flavor should succeed
        save_opts=$MDS_MOUNT_OPTS
+       if [ -z "$MDS_MOUNT_OPTS" ]; then
+           MDS_MOUNT_OPTS="-o mgssec=krb5p"
+       else
        MDS_MOUNT_OPTS="$MDS_MOUNT_OPTS,mgssec=krb5p"
-       start mds1 $DEVNAME $MDS_MOUNT_OPTS ||
+       fi
+       start mds1 $DEVNAME $MDS_MOUNT_OPTS
+       wait_mgc_import_state mds FULL 0 ||
            error "mount with designated flavor should have succeeded"
        MDS_MOUNT_OPTS=$save_opts