Whamcloud - gitweb
LU-2309 config: ignore unknown configuration param
authorJian Yu <jian.yu@intel.com>
Wed, 16 Jan 2013 06:37:35 +0000 (14:37 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 26 Jan 2013 02:56:44 +0000 (21:56 -0500)
Client or server should not fail to mount if it hits
a configuration parameter that it doesn't understand.
This patch fixes class_process_config() to meet
the above requirement.

The patch also improves conf-sanity test 42 to verify
that invalid sys config param should not prevent client
or server from mounting.

Signed-off-by: Jian Yu <jian.yu@intel.com>
Change-Id: I33a6eb3c2beb3dd7425a097e8e7b5a2766852a96
Reviewed-on: http://review.whamcloud.com/5037
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/obdclass/obd_config.c
lustre/tests/conf-sanity.sh

index d23f1b9..a9c1ceb 100644 (file)
@@ -1149,11 +1149,14 @@ int class_process_config(struct lustre_cfg *lcfg)
                                               PARAM_SYS, &tmp) == 0)) {
                         /* Global param settings */
                        err = class_set_global(tmp, lcfg->lcfg_num, lcfg);
                                               PARAM_SYS, &tmp) == 0)) {
                         /* Global param settings */
                        err = class_set_global(tmp, lcfg->lcfg_num, lcfg);
-                        /* Note that since LCFG_PARAM is LCFG_REQUIRED, new
-                           unknown globals would cause config to fail */
-                        if (err)
-                                CWARN("Ignoring unknown param %s\n", tmp);
-                        GOTO(out, 0);
+                       /*
+                        * Client or server should not fail to mount if
+                        * it hits an unknown configuration parameter.
+                        */
+                       if (err != 0)
+                               CWARN("Ignoring unknown param %s\n", tmp);
+
+                       GOTO(out, err = 0);
                } else if ((class_match_param(lustre_cfg_string(lcfg, 1),
                                              PARAM_QUOTA, &tmp) == 0) &&
                           quota_process_config) {
                } else if ((class_match_param(lustre_cfg_string(lcfg, 1),
                                              PARAM_QUOTA, &tmp) == 0) &&
                           quota_process_config) {
index 71519de..63c9aaa 100644 (file)
@@ -2231,15 +2231,23 @@ test_41b() {
 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
 
 test_42() { #bug 14693
 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
 
 test_42() { #bug 14693
-        setup
-        check_mount || return 2
-        do_facet mgs $LCTL conf_param lustre.llite.some_wrong_param=10
-        umount_client $MOUNT
-        mount_client $MOUNT || return 1
-        cleanup
-        return 0
+       setup
+       check_mount || error "client was not mounted"
+
+       do_facet mgs $LCTL conf_param $FSNAME.llite.some_wrong_param=10
+       umount_client $MOUNT ||
+               error "unmounting client failed with invalid llite param"
+       mount_client $MOUNT ||
+               error "mounting client failed with invalid llite param"
+
+       do_facet mgs $LCTL conf_param $FSNAME.sys.some_wrong_param=20
+       cleanup || error "stopping $FSNAME failed with invalid sys param"
+       setup
+       check_mount || "client was not mounted with invalid sys param"
+       cleanup || error "stopping $FSNAME failed with invalid sys param"
+       return 0
 }
 }
-run_test 42 "invalid config param should not prevent client from mounting"
+run_test 42 "allow client/server mount/unmount with invalid config param"
 
 test_43() {
        [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
 
 test_43() {
        [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"