From c9f3efded4ef5aea926e4c67cfb0859d8592e58a Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 7 Nov 2018 11:37:47 -0500 Subject: [PATCH] LU-8066 lod: replace class_process_proc_param() With the move to sysfs for lod every lctl conf_param option will send out a udev event. Replace class_process_proc_param() with class_modify_config() so sysfs attributes can be set directly. This patch exposed an error in stripecount_store() which doesn't allow setting stripe count to -1 which is wrong. Change-Id: I4eee8b2b0f3661ac69242ff7a1da6346153a56e8 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/33180 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/lod/lod_dev.c | 14 ++++++-------- lustre/lod/lproc_lod.c | 7 +++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index 810bf35..767b850 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -961,6 +961,7 @@ static int lod_process_config(const struct lu_env *env, case LCFG_PARAM: { struct obd_device *obd; + ssize_t count; char *param; /* Check if it is activate/deactivate mdc @@ -1033,16 +1034,13 @@ static int lod_process_config(const struct lu_env *env, } - obd = lod2obd(lod); if (strstr(param, PARAM_LOD) != NULL) - rc = class_process_proc_param(PARAM_LOD, obd->obd_vars, - lcfg, obd); + count = class_modify_config(lcfg, PARAM_LOD, + &lod->lod_dt_dev.dd_kobj); else - rc = class_process_proc_param(PARAM_LOV, obd->obd_vars, - lcfg, obd); - if (rc > 0) - rc = 0; - + count = class_modify_config(lcfg, PARAM_LOV, + &lod->lod_dt_dev.dd_kobj); + rc = count > 0 ? 0 : count; GOTO(out, rc); } case LCFG_PRE_CLEANUP: { diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c index cbf7160..80c6d44 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c @@ -322,13 +322,16 @@ static ssize_t stripecount_store(struct kobject *kobj, struct attribute *attr, struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj); struct lod_device *lod = dt2lod_dev(dt); - u32 stripe_count; + int stripe_count; int rc; - rc = kstrtouint(buffer, 0, &stripe_count); + rc = kstrtoint(buffer, 0, &stripe_count); if (rc) return rc; + if (stripe_count < -1) + return -ERANGE; + lod_fix_desc_stripe_count(&stripe_count); lod->lod_desc.ld_default_stripe_count = stripe_count; -- 1.8.3.1