From: James Simmons Date: Wed, 7 Nov 2018 14:08:30 +0000 (-0500) Subject: LU-10937 mgc: restore mgc binding for sptlrpc X-Git-Tag: 2.12.0-RC1~61 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ca9300e53dc2b7bcaaa5482bb4234cce7d9a344e LU-10937 mgc: restore mgc binding for sptlrpc The work for LU-9034 mapped config logs to separate mgc devices. This change prevented the ability to configure sptlrpc. A later work around was introduced in LU-9567. Recently it was reported that the work around introduced can now cause a MGC failover panic. This patch is the proper fix in that the sptlrpc is properly bound to an mgc device. The sptlrpc config record expects 2 pieces of data: * [0]: fs_name/target_name, * [1]: rule string What was happening is that when you set cfg_instance it was used to create a new instance name of the form fsname-%p. For sptlrpc it expects it to only be fsname. The solution is to test if the config record is for sptlrpc and in that can keep the first record field as is. With this change we can drop cfg_obdname which only sptlrpc used. Test-Parameters: testlist=sanity-gss envdefinitions=ONLY=1,SHARED_KEY=true Test-Parameters: testlist=sanity-sec envdefinitions=SHARED_KEY=true Change-Id: I785f98264c6269f95c0d9a564b731d1b6ff0bcee Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/33311 Tested-by: Jenkins Reviewed-by: Sebastien Buisson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 1cf3a7a..8682248 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -189,7 +189,6 @@ int class_add_conn(struct obd_device *obd, struct lustre_cfg *lcfg); /* Passed as data param to class_config_parse_llog */ struct config_llog_instance { - char *cfg_obdname; void *cfg_instance; struct super_block *cfg_sb; struct obd_uuid cfg_uuid; diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 381a57a..430b01b 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -235,10 +235,8 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, /* Keep the mgc around until we are done */ cld->cld_mgcexp = class_export_get(obd->obd_self_export); - if (cld_is_sptlrpc(cld)) { + if (cld_is_sptlrpc(cld)) sptlrpc_conf_log_start(logname); - cld->cld_cfg.cfg_obdname = obd->obd_name; - } spin_lock(&config_list_lock); list_add(&cld->cld_list_chain, &config_llog_list); @@ -297,9 +295,6 @@ static struct config_llog_data *config_log_find_or_add(struct obd_device *obd, lcfg.cfg_instance = sb != NULL ? (void *)sb : (void *)obd; - if (type == CONFIG_T_SPTLRPC) - lcfg.cfg_instance = NULL; - cld = config_log_find(logname, &lcfg); if (unlikely(cld != NULL)) return cld; diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index c4a20e6..8d03b7b 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -1711,6 +1711,7 @@ int class_config_llog_handler(const struct lu_env *env, lustre_cfg_bufs_init(&bufs, lcfg); if (cfg->cfg_instance && + lcfg->lcfg_command != LCFG_SPTLRPC_CONF && LUSTRE_CFG_BUFLEN(lcfg, 0) > 0) { inst_len = LUSTRE_CFG_BUFLEN(lcfg, 0) + sizeof(cfg->cfg_instance) * 2 + 4; @@ -1739,14 +1740,16 @@ int class_config_llog_handler(const struct lu_env *env, * moving them to index [1] and [2], and insert MGC's * obdname at index [0]. */ - if (cfg->cfg_instance == NULL && + if (cfg->cfg_instance && lcfg->lcfg_command == LCFG_SPTLRPC_CONF) { + struct obd_device *obd = cfg->cfg_instance; + lustre_cfg_bufs_set(&bufs, 2, bufs.lcfg_buf[1], bufs.lcfg_buflen[1]); lustre_cfg_bufs_set(&bufs, 1, bufs.lcfg_buf[0], bufs.lcfg_buflen[0]); lustre_cfg_bufs_set_string(&bufs, 0, - cfg->cfg_obdname); + obd->obd_name); } /* Add net info to setup command