Whamcloud - gitweb
LU-2059 mgs: don't fail on missing params log 27/12427/2
authorMikhail Pershin <mike.pershin@intel.com>
Sat, 25 Oct 2014 04:58:05 +0000 (21:58 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 6 Nov 2014 18:37:34 +0000 (18:37 +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.

This patch is back-ported from the following one:
Lustre-commit: 864fc9daac267819f5e3bdebef6cdac4c6325626
Lustre-change: http://review.whamcloud.com/10311

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: I081ca3920f3c2d05d4e966ed5234369ddc0eaac0
Reviewed-on: http://review.whamcloud.com/12427
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@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 2124adf..9066fe0 100644 (file)
@@ -1761,7 +1761,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);
@@ -1770,6 +1771,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 fe485c7..fcaf37e 100644 (file)
@@ -539,7 +539,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 c73ed82..6c0f44f 100644 (file)
@@ -1452,26 +1452,9 @@ int mgs_write_log_direct_all(const struct lu_env *env,
        cfs_list_t 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);
-               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, &list);
        if (rc)
index 84c56d9..ef0b3c7 100644 (file)
@@ -935,6 +935,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)
 {
@@ -956,7 +967,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 f463680..e109dce 100644 (file)
@@ -77,8 +77,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
 
@@ -452,9 +452,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
@@ -701,9 +698,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
 }
@@ -740,9 +734,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
@@ -1009,9 +1000,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: "
@@ -3209,6 +3197,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 96d1d96..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