From: Niu Yawei Date: Wed, 14 Nov 2012 03:33:33 +0000 (-0500) Subject: LU-2183 interop: handle deprecated quota param X-Git-Tag: 2.3.55~7 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1af8d779310084c0d7399dcc574c08fb471aae0d LU-2183 interop: handle deprecated quota param The 'quota_type' param is deprecated now, we should ignore them when processing config logs. Signed-off-by: Niu Yawei Change-Id: Ife12d266db9ac049487217076410671685063389 Reviewed-on: http://review.whamcloud.com/4528 Tested-by: Hudson Reviewed-by: Johann Lombardi Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Yu Jian --- diff --git a/lustre/include/lustre_param.h b/lustre/include/lustre_param.h index 320f641..fbafab0 100644 --- a/lustre/include/lustre_param.h +++ b/lustre/include/lustre_param.h @@ -48,7 +48,7 @@ * @{ */ -/* For interoperability between 1.8 and 2.0. */ +/* For interoperability */ struct cfg_interop_param { char *old_param; char *new_param; diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 37ac715..0eae56f 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5149,10 +5149,13 @@ err_lmi: return (rc); } -/* For interoperability between 1.8 and 2.0. */ +/* For interoperability, the left element is old parameter, the right one + * is the new version of the parameter, if some parameter is deprecated, + * the new version should be set as NULL. */ static struct cfg_interop_param mdt_interop_param[] = { { "mdt.group_upcall", NULL }, - { "mdt.quota_type", "mdd.quota_type" }, + { "mdt.quota_type", NULL }, + { "mdd.quota_type", NULL }, { "mdt.rootsquash", "mdt.root_squash" }, { "mdt.nosquash_nid", "mdt.nosquash_nids" }, { NULL } @@ -5165,7 +5168,7 @@ static int mdt_process_config(const struct lu_env *env, struct mdt_device *m = mdt_dev(d); struct md_device *md_next = m->mdt_child; struct lu_device *next = md2lu_dev(md_next); - int rc = 0; + int rc; ENTRY; switch (cfg->lcfg_command) { @@ -5173,7 +5176,7 @@ static int mdt_process_config(const struct lu_env *env, struct lprocfs_static_vars lvars; struct obd_device *obd = d->ld_obd; - /* For interoperability between 1.8 and 2.0. */ + /* For interoperability */ struct cfg_interop_param *ptr = NULL; struct lustre_cfg *old_cfg = NULL; char *param = NULL; @@ -5188,9 +5191,10 @@ static int mdt_process_config(const struct lu_env *env, ptr = class_find_old_param(param, mdt_interop_param); if (ptr != NULL) { if (ptr->new_param == NULL) { - CWARN("For 1.8 interoperability, skip this %s." + rc = 0; + CWARN("For interoperability, skip this %s." " It is obsolete.\n", ptr->old_param); - break; + break; } CWARN("Found old param %s, changed it to %s.\n", diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index bc26331..b315be0 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -179,6 +179,12 @@ static void ofd_stack_fini(const struct lu_env *env, struct ofd_device *m, EXIT; } +/* For interoperability, see mdt_interop_param[]. */ +static struct cfg_interop_param ofd_interop_param[] = { + { "ost.quota_type", NULL }, + { NULL } +}; + /* used by MGS to process specific configurations */ static int ofd_process_config(const struct lu_env *env, struct lu_device *d, struct lustre_cfg *cfg) @@ -194,6 +200,38 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d, case LCFG_PARAM: { struct lprocfs_static_vars lvars; + /* For interoperability */ + struct cfg_interop_param *ptr = NULL; + struct lustre_cfg *old_cfg = NULL; + char *param = NULL; + + param = lustre_cfg_string(cfg, 1); + if (param == NULL) { + CERROR("param is empty\n"); + rc = -EINVAL; + break; + } + + ptr = class_find_old_param(param, ofd_interop_param); + if (ptr != NULL) { + if (ptr->new_param == NULL) { + rc = 0; + CWARN("For interoperability, skip this %s." + " It is obsolete.\n", ptr->old_param); + break; + } + + CWARN("Found old param %s, changed it to %s.\n", + ptr->old_param, ptr->new_param); + + old_cfg = cfg; + cfg = lustre_cfg_rename(old_cfg, ptr->new_param); + if (IS_ERR(cfg)) { + rc = PTR_ERR(cfg); + break; + } + } + lprocfs_ofd_init_vars(&lvars); rc = class_process_proc_param(PARAM_OST, lvars.obd_vars, cfg, d->ld_obd);