From b55669bb896b40067bf529c35531d15a029de002 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Fri, 24 Oct 2014 21:58:05 -0700 Subject: [PATCH] LU-2059 mgs: don't fail on missing params log 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 Change-Id: I081ca3920f3c2d05d4e966ed5234369ddc0eaac0 Reviewed-on: http://review.whamcloud.com/12427 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- lustre/mgc/mgc_request.c | 4 +++- lustre/mgs/mgs_handler.c | 3 ++- lustre/mgs/mgs_llog.c | 17 ----------------- lustre/obdclass/llog.c | 14 +++++++++++++- lustre/tests/conf-sanity.sh | 18 ++++-------------- lustre/tests/insanity.sh | 8 +------- 6 files changed, 23 insertions(+), 41 deletions(-) diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 2124adf..9066fe0 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -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 diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index fe485c7..fcaf37e 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -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 */ diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index c73ed82..6c0f44f 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -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) diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c index 84c56d9..ef0b3c7 100644 --- a/lustre/obdclass/llog.c +++ b/lustre/obdclass/llog.c @@ -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); diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index f463680..e109dce 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -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" diff --git a/lustre/tests/insanity.sh b/lustre/tests/insanity.sh index 96d1d96..cadaaea 100755 --- a/lustre/tests/insanity.sh +++ b/lustre/tests/insanity.sh @@ -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 -- 1.8.3.1