Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / mgs / mgs_llog.c
index e328f33..dc52ab0 100644 (file)
@@ -1856,6 +1856,44 @@ static int mgs_wlp_lcfg(struct obd_device *obd, struct fs_db *fsdb,
         return rc;
 }
 
+/* write global variable settings into log */
+static int mgs_write_log_sys(struct obd_device *obd, struct fs_db *fsdb,
+                             struct mgs_target_info *mti, char *sys, char *ptr)
+{
+        struct lustre_cfg_bufs bufs;
+        struct lustre_cfg *lcfg;
+        char *tmp;
+        int cmd, val;
+        int rc;
+
+        if (class_match_param(ptr, PARAM_TIMEOUT, &tmp) == 0)
+                cmd = LCFG_SET_TIMEOUT;
+        else if (class_match_param(ptr, PARAM_LDLM_TIMEOUT, &tmp) == 0)
+                cmd = LCFG_SET_LDLM_TIMEOUT;
+        /* Check for known params here so we can return error to lctl */
+        else if ((class_match_param(ptr, PARAM_AT_MIN, &tmp) == 0)
+                 || (class_match_param(ptr, PARAM_AT_MAX, &tmp) == 0)
+                 || (class_match_param(ptr, PARAM_AT_EXTRA, &tmp) == 0)
+                 || (class_match_param(ptr, PARAM_AT_EARLY_MARGIN, &tmp) == 0)
+                 || (class_match_param(ptr, PARAM_AT_HISTORY, &tmp) == 0))
+                cmd = LCFG_PARAM;
+        else
+                return -EINVAL;
+
+        val = simple_strtoul(tmp, NULL, 0);
+        CDEBUG(D_MGS, "global %s = %d\n", ptr, val);
+
+        lustre_cfg_bufs_reset(&bufs, NULL);
+        lustre_cfg_bufs_set_string(&bufs, 1, sys);
+        lcfg = lustre_cfg_new(cmd, &bufs);
+        lcfg->lcfg_num = val;
+        /* modify all servers and clients */
+        rc = mgs_write_log_direct_all(obd, fsdb, mti, lcfg, mti->mti_fsname,
+                                      ptr);
+        lustre_cfg_free(lcfg);
+        return rc;
+}
+
 static int mgs_srpc_set_param_disk(struct obd_device *obd,
                                    struct fs_db *fsdb,
                                    struct mgs_target_info *mti,
@@ -2032,7 +2070,7 @@ static int mgs_srpc_set_param_mem(struct fs_db *fsdb,
                 rset = &fsdb->fsdb_srpc_gen;
         }
 
-        rc = sptlrpc_rule_set_merge(rset, &rule, 1);
+        rc = sptlrpc_rule_set_merge(rset, &rule);
 
         RETURN(rc);
 }
@@ -2046,6 +2084,9 @@ static int mgs_srpc_set_param(struct obd_device *obd,
         int                     rc, copy_size;
         ENTRY;
 
+#ifndef HAVE_GSS
+        RETURN(-EINVAL);
+#endif
         /* keep a copy of original param, which could be destroied
          * during parsing */
         copy_size = strlen(param) + 1;
@@ -2202,7 +2243,6 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
                                struct mgs_target_info *mti, char *ptr)
 {
         struct lustre_cfg_bufs bufs;
-        struct lustre_cfg *lcfg;
         char *logname;
         char *tmp;
         int rc = 0;
@@ -2247,20 +2287,8 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
                 GOTO(end, rc);
         }
 
-        if (class_match_param(ptr, PARAM_SYS_TIMEOUT, &tmp) == 0) {
-                /* Change obd timeout */
-                int timeout;
-                timeout = simple_strtoul(tmp, NULL, 0);
-
-                CDEBUG(D_MGS, "obd timeout %d\n", timeout);
-                lustre_cfg_bufs_reset(&bufs, NULL);
-                lcfg = lustre_cfg_new(LCFG_SET_TIMEOUT, &bufs);
-                lcfg->lcfg_num = timeout;
-                /* modify all servers and clients */
-                rc = mgs_write_log_direct_all(obd, fsdb, mti, lcfg,
-                                              mti->mti_fsname,
-                                              "timeout");
-                lustre_cfg_free(lcfg);
+        if (class_match_param(ptr, PARAM_SYS, &tmp) == 0) {
+                rc = mgs_write_log_sys(obd, fsdb, mti, ptr, tmp);
                 GOTO(end, rc);
         }