Whamcloud - gitweb
LU-11658 lov: cl_cache could miss initialize
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index 50361a1..3b390f3 100644 (file)
@@ -1139,7 +1139,7 @@ test_29() {
 
        local PARAM="$FSNAME-OST0001.osc.active"
        # With lctl set_param -P the value $PROC_ACT will be sent to
-       # all nodes. The [^M] filter out the ability to set active
+       # all nodes. The [!M] filter out the ability to set active
        # on the MDS servers which is tested with wait_osp_* below.
        # For ost_server_uuid that only exist on client so filtering
        # is safe.
@@ -1164,12 +1164,15 @@ test_29() {
        # test new client starts deactivated
        umount_client $MOUNT || error "umount_client $MOUNT failed"
        mount_client $MOUNT || error "mount_client $MOUNT failed"
-       RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
-       if [ -z "$RESULT" ]; then
-               error "New client start active: $(lctl get_param -n $PROC_UUID)"
-       else
-               echo "New client success: got $RESULT"
-       fi
+
+       # the 2nd and 3rd field of ost_server_uuid do not update at the same
+       # time when using lctl set_param -P
+       wait_update_facet client                                        \
+               "$LCTL get_param -n $PROC_UUID | awk '{print \\\$3 }'"  \
+               "DEACTIVATED" ||
+               error "New client start active: $($LCTL get_param -n $PROC_UUID)"
+
+       echo "New client success: got '$($LCTL get_param -n $PROC_UUID)'"
 
        # make sure it reactivates
        set_persistent_param_and_check client $PROC_ACT $PARAM $ACTV
@@ -1201,7 +1204,7 @@ test_30a() {
        pass
 
        echo Erase parameter setting
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                do_facet mgs "$PERM_CMD -d $TEST" ||
                        error "Erase param $TEST failed"
        else
@@ -1240,7 +1243,7 @@ test_30b() {
 
        local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
                grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                PARAM="osc.$FSNAME-OST0000-osc-[^M]*.import"
                echo "Setting $PARAM from $TEST to $NEW"
                do_facet mgs "$PERM_CMD $PARAM='connection=$NEW'" ||
@@ -1262,7 +1265,7 @@ test_30b() {
        [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
                error "Failover nid not added"
 
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                do_facet mgs "$PERM_CMD -d osc.$FSNAME-OST0000-osc-*.import"
        else
                do_facet mgs "$PERM_CMD -d $FSNAME-OST0000.failover.node" ||
@@ -1901,7 +1904,7 @@ t32_test() {
                return 1
        fi
 
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                $r $PERM_CMD osc.$fsname-OST0000*.import=connection=$nid || {
                        error_noexit "Setting OST \"failover.node\""
                        return 1
@@ -1985,7 +1988,7 @@ t32_test() {
        fi
 
        if [ "$dne_upgrade" != "no" ]; then
-               if [[ $PERM_CMD = *"set_param -P"* ]]; then
+               if [[ $PERM_CMD == *"set_param -P"* ]]; then
                        $r $PERM_CMD mdc.$fsname-MDT0001*.import=connection=$nid || {
                                error_noexit "Setting MDT1 \"failover.node\""
                                return 1
@@ -2477,7 +2480,7 @@ test_33a() { # bug 12333, was test_33
        start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
        start fs2ost $fs2ostdev $OST_MOUNT_OPTS
 
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                do_facet mgs "$PERM_CMD timeout=200" ||
                        error "$PERM_CMD timeout=200 failed"
        else
@@ -2558,7 +2561,7 @@ test_35a() { # bug 12459
        local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
                awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
 
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                do_facet mgs "$PERM_CMD \
                              mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
                        error "Setting mdc.*${device}*.import=connection=\
@@ -2623,7 +2626,7 @@ test_35b() { # bug 18674
        local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
                awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
 
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                do_facet mgs "$PERM_CMD \
                              mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
                        error "Set mdc.*${device}*.import=connection=\
@@ -3130,7 +3133,7 @@ test_42() { #bug 14693
        setup
        check_mount || error "client was not mounted"
 
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                PARAM="llite.$FSNAME-*.some_wrong_param"
        else
                PARAM="$FSNAME.llite.some_wrong_param"
@@ -3781,7 +3784,7 @@ test_50g() {
         wait_osc_import_state mds ost2 FULL
        wait_osc_import_ready client ost2
 
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                local PARAM="osc.${FSNAME}-OST0001*.active"
        else
                local PARAM="${FSNAME}-OST0001.osc.active"
@@ -3830,14 +3833,15 @@ test_50h() {
        $SETSTRIPE -c -1 -i 0 $DIR/$tdir/2 ||
                error "$SETSTRIPE $DIR/$tdir/2 failed"
        sleep 1 && echo "create a file after OST1 is activated"
-       # create some file
-       createmany -o $DIR/$tdir/2/$tfile-%d 1
+       # doing some io, shouldn't crash
+       dd if=/dev/zero of=$DIR/$tdir/2/$tfile-io bs=1M count=10
 
        # check OSC import is working
        stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
                error "some OSC imports are still not connected"
 
        # cleanup
+       rm -rf DIR/$tdir
        umount_client $MOUNT || error "Unable to umount client"
        stop_ost2 || error "Unable to stop OST2"
        cleanup_nocli || error "cleanup_nocli failed with $?"
@@ -3859,7 +3863,7 @@ test_50i() {
 
        mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
 
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                $PERM_CMD mdc.${FSNAME}-MDT0001-mdc-*.active=0 &&
                        error "deactive MDC0 succeeds"
        else
@@ -4172,10 +4176,12 @@ thread_sanity() {
        setmodopts $modname "$oldvalue"
 
        # Check that $opts took
-       tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min")
-       tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max")
+       tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
+               echo 0)
+       tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
+               echo 0)
        tstarted=$(do_facet $facet \
-                  "$LCTL get_param -n ${paramp}.threads_started")
+                  "$LCTL get_param -n ${paramp}.threads_started" || echo 0)
        lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
                return $?
        cleanup
@@ -4756,6 +4762,8 @@ test_66() {
        echo "wrong nids list should not destroy the system"
        do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
                error "wrong parse"
+       do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "asdfasdf, asdfadf" &&
+               error "wrong parse"
 
        echo "replace OST nid"
        do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
@@ -4769,6 +4777,14 @@ test_66() {
        do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
                error "wrong parse"
 
+       local FAKE_NIDS="192.168.0.112@tcp1,192.168.0.112@tcp2"
+       local FAKE_FAILOVER="192.168.0.113@tcp1,192.168.0.113@tcp2"
+       local NIDS_AND_FAILOVER="$MDS_NID,$FAKE_NIDS:$FAKE_FAILOVER"
+       echo "set NIDs with failover"
+       do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $NIDS_AND_FAILOVER ||
+               error "replace nids failed"
+
+
        echo "replace MDS nid"
        do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
                error "replace nids failed"
@@ -7637,7 +7653,7 @@ test_107() {
        start_ost || error "unable to start OST"
 
        # add unknown configuration parameter.
-       if [[ $PERM_CMD = *"set_param -P"* ]]; then
+       if [[ $PERM_CMD == *"set_param -P"* ]]; then
                cmd="$PERM_CMD ost.$FSNAME-OST0000*.unknown_param"
        else
                cmd="$PERM_CMD $FSNAME-OST0000*.ost.unknown_param"
@@ -7835,6 +7851,7 @@ test_108b() {
                $rcmd mount -t ldiskfs -o loop $tmp/images/$facet \
                        $tmp/mnt/$facet ||
                        error "failed to local mount $facet"
+
                $rcmd tar jxf $LUSTRE/tests/zfs_${facet}_2_11.tar.bz2 \
                        --xattrs --xattrs-include="*.*" \
                        -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
@@ -8177,6 +8194,31 @@ test_117() {
 }
 run_test 117 "lctl get_param return errors properly"
 
+test_120() { # LU-11130
+       [ "$MDSCOUNT" -lt 2 ] && skip "mdt count < 2"
+       [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] &&
+               skip "ldiskfs only test"
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.56) ] &&
+               skip "Need DNE2 capable MD target with LU-11130 fix"
+
+       setup
+
+       local mds1host=$(facet_active_host mds1)
+       local mds1dev=$(mdsdevname 1)
+
+       $LFS mkdir -i 1 $DIR/$tdir
+       $LFS mkdir -i 0 $DIR/$tdir/mds1dir
+
+       ln -s foo $DIR/$tdir/bar
+       mv $DIR/$tdir/bar $DIR/$tdir/mds1dir/bar2 ||
+               error "cross-target rename failed"
+
+       stopall
+
+       run_e2fsck $mds1host $mds1dev "-n"
+}
+run_test 120 "cross-target rename should not create bad symlinks"
+
 test_122() {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        [[ $(lustre_version_code ost1) -ge $(version_code 2.11.53) ]] ||
@@ -8199,6 +8241,75 @@ test_122() {
 }
 run_test 122 "Check OST sequence update"
 
+test_123() {
+       setupall
+       local yaml_file="$TMP/$tfile.yaml"
+       do_facet mgs rm "$yaml_file"
+       local cfgfiles=$(do_facet mgs "lctl --device MGS llog_catlist |"\
+                       " sed 's/config_log://'")
+
+       # set jobid_var to a different value for test
+       local orig_val=$(do_facet mgs $LCTL get_param jobid_var)
+       do_facet mgs $LCTL set_param -P jobid_var="testname"
+
+       for i in $cfgfiles params; do
+               do_facet mgs "lctl --device MGS llog_print ${i} >> $yaml_file"
+       done
+
+       echo "Unmounting FS"
+       stopall
+       echo "Writeconf"
+       writeconf_all
+       echo "Remounting"
+       mountmgs
+       mountmds
+       mountoss
+       mountcli
+
+       # Reapply the config from before
+       echo "Setting configuration parameters"
+       do_facet mgs "lctl set_param -F $yaml_file"
+
+       local set_val=$(do_facet mgs $LCTL get_param jobid_var)
+       do_facet mgs $LCTL set_param -P $orig_val
+
+       [ $set_val == "jobid_var=testname" ] ||
+               error "$set_val is not testname"
+
+       do_facet mgs rm "$yaml_file"
+}
+run_test 123 "clear and reset all parameters using set_param -F"
+
+test_124()
+{
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+       [ -z $mds2failover_HOST ] && skip "needs MDT failover setup" && return
+
+       setup
+       cleanup
+
+       load_modules
+       if combined_mgs_mds; then
+               start_mdt 1 "-o nosvc" ||
+                       error "starting mds with nosvc option failed"
+       fi
+       local nid=$(do_facet mds2 $LCTL list_nids | head -1)
+       local failover_nid=$(do_node $mds2failover_HOST $LCTL list_nids | head -1)
+       do_facet mgs $LCTL replace_nids $FSNAME-MDT0001 $nid:$failover_nid ||
+               error "replace_nids execution error"
+
+       if combined_mgs_mds; then
+               stop_mdt 1
+       fi
+
+       setup
+       fail mds2
+       echo "lfs setdirstripe"
+       $LFS setdirstripe -i 1 $MOUNT/$tdir || error "setdirstirpe error"
+       echo ok
+}
+run_test 124 "check failover after replace_nids"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi