Whamcloud - gitweb
LU-8066 lod: replace class_process_proc_param() 80/33180/9
authorJames Simmons <uja.ornl@yahoo.com>
Wed, 7 Nov 2018 16:37:47 +0000 (11:37 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 17 Nov 2018 01:24:46 +0000 (01:24 +0000)
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 <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/33180
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_dev.c
lustre/lod/lproc_lod.c

index 810bf35..767b850 100644 (file)
@@ -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: {
index cbf7160..80c6d44 100644 (file)
@@ -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;