From 57ba9deb978a8335e0dde04baf6281e8b9ab23f8 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Tue, 7 Feb 2017 02:51:12 -0500 Subject: [PATCH] LU-9081 config: don't attach sub logs for LWP Lustre target processes client log to retrieve MDT NIDs and start LWPs, it goes the same code path of mgc_process_config() just like processing the target config log, so that sub clds for security, nodemap, param & recovery will be attached unnecessarily. Signed-off-by: Niu Yawei Change-Id: I926ec4f33d3899c73a9c000b3ad0c0e5c102dfde Reviewed-on: https://review.whamcloud.com/25293 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- lustre/include/obd_class.h | 20 +++++++++++-------- lustre/llite/llite_lib.c | 1 + lustre/mgc/mgc_request.c | 40 +++++++++++++++++++++----------------- lustre/obdclass/obd_mount_server.c | 1 + 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 46fe25e..aba0e5f 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -166,18 +166,22 @@ struct config_llog_instance { int cfg_last_idx; /* for partial llog processing */ int cfg_flags; __u32 cfg_lwp_idx; + __u32 cfg_sub_clds; }; int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt, char *name, struct config_llog_instance *cfg); -enum { - CONFIG_T_CONFIG = 0, - CONFIG_T_SPTLRPC = 1, - CONFIG_T_RECOVER = 2, - CONFIG_T_PARAMS = 3, - CONFIG_T_NODEMAP = 4, - CONFIG_T_MAX = 5 -}; +#define CONFIG_T_CONFIG 0x01 +#define CONFIG_T_SPTLRPC 0x02 +#define CONFIG_T_RECOVER 0x04 +#define CONFIG_T_PARAMS 0x08 +#define CONFIG_T_NODEMAP 0x10 + +/* Sub clds should be attached to the config_llog_data when processing + * config log for client or server target. */ +#define CONFIG_SUB_CLIENT (CONFIG_T_SPTLRPC | CONFIG_T_RECOVER | \ + CONFIG_T_PARAMS) +#define CONFIG_SUB_SERVER (CONFIG_SUB_CLIENT | CONFIG_T_NODEMAP) #define PARAMS_FILENAME "params" #define LCTL_UPCALL "lctl" diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index f1379d4..3578e50 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1025,6 +1025,7 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt) cfg->cfg_instance = sb; cfg->cfg_uuid = lsi->lsi_llsbi->ll_sb_uuid; cfg->cfg_callback = class_config_llog_handler; + cfg->cfg_sub_clds = CONFIG_SUB_CLIENT; /* set up client obds */ err = lustre_process_log(sb, profilenm, cfg); if (err < 0) diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index d5b4f40..3e88d49 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -312,9 +312,9 @@ config_log_add(struct obd_device *obd, char *logname, { struct lustre_sb_info *lsi = s2lsi(sb); struct config_llog_data *cld; - struct config_llog_data *sptlrpc_cld; - struct config_llog_data *params_cld; - struct config_llog_data *nodemap_cld; + struct config_llog_data *sptlrpc_cld = NULL; + struct config_llog_data *params_cld = NULL; + struct config_llog_data *nodemap_cld = NULL; char seclogname[32]; char *ptr; int rc; @@ -336,15 +336,16 @@ config_log_add(struct obd_device *obd, char *logname, memcpy(seclogname, logname, ptr - logname); strcpy(seclogname + (ptr - logname), "-sptlrpc"); - sptlrpc_cld = config_log_find_or_add(obd, seclogname, NULL, - CONFIG_T_SPTLRPC, cfg); - if (IS_ERR(sptlrpc_cld)) { - CERROR("can't create sptlrpc log: %s\n", seclogname); - GOTO(out, rc = PTR_ERR(sptlrpc_cld)); + if (cfg->cfg_sub_clds & CONFIG_T_SPTLRPC) { + sptlrpc_cld = config_log_find_or_add(obd, seclogname, NULL, + CONFIG_T_SPTLRPC, cfg); + if (IS_ERR(sptlrpc_cld)) { + CERROR("can't create sptlrpc log: %s\n", seclogname); + GOTO(out, rc = PTR_ERR(sptlrpc_cld)); + } } - nodemap_cld = NULL; - if (IS_SERVER(lsi) && !IS_MGS(lsi)) { + if (!IS_MGS(lsi) && cfg->cfg_sub_clds & CONFIG_T_NODEMAP) { nodemap_cld = config_log_find_or_add(obd, LUSTRE_NODEMAP_NAME, NULL, CONFIG_T_NODEMAP, cfg); @@ -356,13 +357,15 @@ config_log_add(struct obd_device *obd, char *logname, } } - params_cld = config_log_find_or_add(obd, PARAMS_FILENAME, sb, - CONFIG_T_PARAMS, cfg); - if (IS_ERR(params_cld)) { - rc = PTR_ERR(params_cld); - CERROR("%s: can't create params log: rc = %d\n", - obd->obd_name, rc); - GOTO(out_nodemap, rc); + if (cfg->cfg_sub_clds & CONFIG_T_PARAMS) { + params_cld = config_log_find_or_add(obd, PARAMS_FILENAME, sb, + CONFIG_T_PARAMS, cfg); + if (IS_ERR(params_cld)) { + rc = PTR_ERR(params_cld); + CERROR("%s: can't create params log: rc = %d\n", + obd->obd_name, rc); + GOTO(out_nodemap, rc); + } } cld = do_config_log_add(obd, logname, CONFIG_T_CONFIG, cfg, sb); @@ -372,7 +375,8 @@ config_log_add(struct obd_device *obd, char *logname, } LASSERT(lsi->lsi_lmd); - if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)) { + if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR) && + cfg->cfg_sub_clds & CONFIG_T_RECOVER) { struct config_llog_data *recover_cld; ptr = strrchr(seclogname, '-'); diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index c1f50cb..d6a7fe4 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -1346,6 +1346,7 @@ static int server_start_targets(struct super_block *sb) /* Start targets using the llog named for the target */ memset(&cfg, 0, sizeof(cfg)); cfg.cfg_callback = class_config_llog_handler; + cfg.cfg_sub_clds = CONFIG_SUB_SERVER; rc = lustre_process_log(sb, lsi->lsi_svname, &cfg); if (rc) { CERROR("failed to start server %s: %d\n", -- 1.8.3.1