Whamcloud - gitweb
LU-2059 mgs: don't fail on missing params log 11/10311/4
authorMikhail Pershin <mike.pershin@intel.com>
Tue, 13 May 2014 14:34:03 +0000 (18:34 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 19 May 2014 20:27:04 +0000 (20:27 +0000)
The mgc_process_cfg_log() fails if 'params' log is not
accessinble and has no local copy. In fact that log is
optional and may be just empty.

Patch allows 'params' log to be empty and checks also for
'params' log in other places to avoid wrong error messages.
There was also deprecated code in mgs_write_log_direct_all()
which creates lustre-params log which is not used by anyone now.
Third change is removal of exceptions in conf-sanity.sh and
insanity.sh related to LU-2059

The only exception is insanity test_1 which is still failed due
to other reason.

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: I1ad024a87b0a10665f9669fa8ff7cca2d07a09fe
Reviewed-on: http://review.whamcloud.com/10311
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
lustre/mgc/mgc_request.c
lustre/mgs/mgs_handler.c
lustre/mgs/mgs_llog.c
lustre/obdclass/llog.c
lustre/tests/conf-sanity.sh
lustre/tests/insanity.sh

index c2ecb07..99ba813 100644 (file)
@@ -1765,7 +1765,8 @@ static int mgc_process_cfg_log(struct obd_device *mgc,
                        rc = mgc_llog_local_copy(env, mgc, ctxt, lctxt,
                                                 cld->cld_logname);
                if (local_only || rc) {
-                       if (llog_is_empty(env, lctxt, cld->cld_logname)) {
+                       if (strcmp(cld->cld_logname, PARAMS_FILENAME) != 0 &&
+                           llog_is_empty(env, lctxt, cld->cld_logname)) {
                                LCONSOLE_ERROR_MSG(0x13a, "Failed to get MGS "
                                                   "log %s and no local copy."
                                                   "\n", cld->cld_logname);
@@ -1774,6 +1775,7 @@ static int mgc_process_cfg_log(struct obd_device *mgc,
                        CDEBUG(D_MGC, "Failed to get MGS log %s, using local "
                               "copy for now, will try to update later.\n",
                               cld->cld_logname);
+                       rc = 0;
                }
                /* Now, whether we copied or not, start using the local llog.
                 * If we failed to copy, we'll start using whatever the old
index b0c5be7..645e574 100644 (file)
@@ -541,7 +541,8 @@ static int mgs_llog_open(struct tgt_session_info *tsi)
                char *ptr = strchr(logname, '-');
                int   len = (int)(ptr - logname);
 
-               if (ptr == NULL || len >= sizeof(mgi->mgi_fsname)) {
+               if ((ptr == NULL && strcmp(logname, PARAMS_FILENAME) != 0) ||
+                    len >= sizeof(mgi->mgi_fsname)) {
                        LCONSOLE_WARN("%s: non-config logname received: %s\n",
                                      tgt_name(tsi->tsi_tgt), logname);
                        /* not error, this can be llog test name */
index 55ffe90..b2e2a48 100644 (file)
@@ -1447,29 +1447,9 @@ int mgs_write_log_direct_all(const struct lu_env *env, struct mgs_device *mgs,
        struct list_head         log_list;
        struct mgs_direntry     *dirent, *n;
        char                    *fsname = mti->mti_fsname;
-       char                    *logname;
        int                      rc = 0, len = strlen(fsname);
 
        ENTRY;
-       /* We need to set params for any future logs
-        * as well.
-        * FIXME Append this file to every new log.
-        * Actually, we should store as params (text), not llogs,
-        * or in a database. */
-       rc = name_create(&logname, fsname, "-params");
-       if (rc)
-               RETURN(rc);
-       if (mgs_log_is_empty(env, mgs, logname)) {
-               struct llog_handle *llh = NULL;
-
-               rc = record_start_log(env, mgs, &llh, logname);
-               if (rc == 0)
-                       record_end_log(env, &llh);
-       }
-       name_destroy(&logname);
-       if (rc)
-               RETURN(rc);
-
        /* Find all the logs in the CONFIGS directory */
        rc = class_dentry_readdir(env, mgs, &log_list);
        if (rc)
index 7146001..8202b41 100644 (file)
@@ -942,6 +942,17 @@ out:
 }
 EXPORT_SYMBOL(llog_close);
 
+/**
+ * Helper function to get the llog size in records. It is used by MGS
+ * mostly to check that config llog exists and contains data.
+ *
+ * \param[in] env      execution environment
+ * \param[in] ctxt     llog context
+ * \param[in] name     llog name
+ *
+ * \retval             true if there are records in llog besides a header
+ * \retval             false on error or llog without records
+ */
 int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt,
                  char *name)
 {
@@ -963,7 +974,8 @@ int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt,
 out_close:
        llog_close(env, llh);
 out:
-       /* header is record 1 */
+       /* The header is record 1, the llog is still considered as empty
+        * if there is only header */
        return (rc <= 1);
 }
 EXPORT_SYMBOL(llog_is_empty);
index 1c8c8c0..85b9307 100644 (file)
@@ -74,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
 
@@ -449,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
@@ -698,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
 }
@@ -737,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
@@ -1006,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: "
@@ -3183,6 +3171,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"
index 1a25d91..cadaaea 100755 (executable)
@@ -212,10 +212,7 @@ test_2() {
        echo "Verify Lustre filesystem is up and running"
        [ -z "$(mounted_lustre_filesystems)" ] && error "Lustre is not running"
 
-       [ "$(facet_fstype ost1)" = "zfs" ] &&
-               skip "LU-2059: no local config for ZFS OSTs" && return
-
-    clients_up
+       clients_up
 
        for i in $(seq $MDSCOUNT) ; do
                shutdown_facet mds$i
@@ -289,9 +286,6 @@ run_test 3  "Thirdb Failure Mode: MDS/CLIENT `date`"
 test_4() {
        echo "Fourth Failure Mode: OST/MDS `date`"
 
-       [ "$(facet_fstype ost1)" = "zfs" ] &&
-               skip "LU-2059: no local config for ZFS OSTs" && return
-
     #OST Portion
     shutdown_facet ost1
 
@@ -609,12 +603,6 @@ run_test 9 "Ninth Failure Mode: CLIENT/CLIENT `date`"
 test_10() {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
 
-       #XXX Disable the test now for LU-4409
-       [ $MDSCOUNT -ge 2 ] && skip "skip for DNE due to LU-4409" && return
-
-       [ "$(facet_fstype ost1)" = "zfs" ] &&
-               skip "LU-2059: no local config for ZFS OSTs" && return
-
        shutdown_facet mds1
        reboot_facet mds1