Whamcloud - gitweb
LU-13252 mgs: Handle possible failure from name_create_mdt
[fs/lustre-release.git] / lustre / mgs / mgs_llog.c
index 45f7678..726262f 100644 (file)
@@ -1594,7 +1594,9 @@ int mgs_replace_nids(const struct lu_env *env,
        }
 
        /* Process client llogs */
-       name_create(&logname, fsname, "-client");
+       rc = name_create(&logname, fsname, "-client");
+       if (rc)
+               GOTO(out, rc);
        rc = mgs_replace_nids_log(env, mgs_obd, logname, devname, nids);
        name_destroy(&logname);
        if (rc) {
@@ -1607,7 +1609,9 @@ int mgs_replace_nids(const struct lu_env *env,
        for (i = 0; i < INDEX_MAP_SIZE * 8; i++) {
                if (!test_bit(i, fsdb->fsdb_mdt_index_map))
                        continue;
-               name_create_mdt(&logname, fsname, i);
+               rc = name_create_mdt(&logname, fsname, i);
+               if (rc)
+                       GOTO(out, rc);
                rc = mgs_replace_nids_log(env, mgs_obd, logname, devname, nids);
                name_destroy(&logname);
                if (rc)
@@ -3285,8 +3289,7 @@ static int mgs_wlp_lcfg(const struct lu_env *env,
        int rc, del;
 
        /* Erase any old settings of this same parameter */
-       memcpy(comment, ptr, MTI_NAME_MAXLEN);
-       comment[MTI_NAME_MAXLEN - 1] = 0;
+       strlcpy(comment, ptr, sizeof(comment));
        /* But don't try to match the value. */
        tmp = strchr(comment, '=');
        if (tmp != NULL)
@@ -3913,16 +3916,16 @@ static int mgs_write_log_param(const struct lu_env *env,
        if (class_match_param(ptr, PARAM_NETWORK, NULL) == 0)
                GOTO(end, rc);
 
-        /* Processed in mgs_write_log_ost */
-        if (class_match_param(ptr, PARAM_FAILMODE, NULL) == 0) {
-                if (mti->mti_flags & LDD_F_PARAM) {
-                        LCONSOLE_ERROR_MSG(0x169, "%s can only be "
-                                           "changed with tunefs.lustre"
-                                           "and --writeconf\n", ptr);
-                        rc = -EPERM;
-                }
-                GOTO(end, rc);
-        }
+       /* Processed in mgs_write_log_ost */
+       if (class_match_param(ptr, PARAM_FAILMODE, NULL) == 0) {
+               if (mti->mti_flags & LDD_F_PARAM) {
+                       LCONSOLE_ERROR_MSG(0x169,
+                                          "%s can only be changed with tunefs.lustre and --writeconf\n",
+                                          ptr);
+                       rc = -EPERM;
+               }
+               GOTO(end, rc);
+       }
 
         if (class_match_param(ptr, PARAM_SRPC, NULL) == 0) {
                rc = mgs_srpc_set_param(env, mgs, fsdb, mti, ptr);
@@ -4005,18 +4008,12 @@ static int mgs_write_log_param(const struct lu_env *env,
                }
 active_err:
                if (rc < 0) {
-                       LCONSOLE_ERROR_MSG(0x145, "Couldn't find %s in"
-                                          "log (%d). No permanent "
-                                          "changes were made to the "
-                                          "config log.\n",
+                       LCONSOLE_ERROR_MSG(0x145,
+                                          "Couldn't find %s in log (%d). No permanent changes were made to the config log.\n",
                                           mti->mti_svname, rc);
                        if (test_bit(FSDB_OLDLOG14, &fsdb->fsdb_flags))
-                               LCONSOLE_ERROR_MSG(0x146, "This may be"
-                                                  " because the log"
-                                                  "is in the old 1.4"
-                                                  "style. Consider "
-                                                  " --writeconf to "
-                                                  "update the logs.\n");
+                               LCONSOLE_ERROR_MSG(0x146,
+                                                  "This may be because the log is in the old 1.4 style. Consider --writeconf to update the logs.\n");
                        GOTO(end, rc);
                }
                /* Fall through to osc/mdc proc for deactivating live