Whamcloud - gitweb
LU-4749 mgs: Recognize colons in failover.node values 96/12196/3
authorLi Wei <wei.g.li@intel.com>
Wed, 17 Sep 2014 05:55:33 +0000 (13:55 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 6 Nov 2014 18:40:35 +0000 (18:40 +0000)
Current mgs assumes that all the NIDs in a single failover.node
parameter belong to one node.  This is not the case, even prior to
http://review.whamcloud.com/11161, because mkfs.lustre options like

  --servicenode=<nid1>,<nid2>:<nid3>,<nid4>

are allowed.

Lustre-commit: bbe5f8ec92c63cc4fcb9ab0b316e92fb2a3d9683
Lustre-change: http://review.whamcloud.com/11956

Change-Id: If3e2ebc0e81093e9c8304e496afdca24edf456ef
Signed-off-by: Li Wei <wei.g.li@intel.com>
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-on: http://review.whamcloud.com/12196
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/mgs/mgs_llog.c

index 6c0f44f..02b6d90 100644 (file)
@@ -1888,7 +1888,12 @@ static int mgs_write_log_failnids(const struct lu_env *env,
         #07 L add_conn 0:OSC_uml1_ost1_mdsA  1:uml2_UUID
         */
 
-        /* Pull failnid info out of params string */
+       /*
+        * Pull failnid info out of params string, which may contain something
+        * like "<nid1>,<nid2>:<nid3>,<nid4>".  class_parse_nid() does not
+        * complain about abnormal inputs like ",:<nid1>", "<nid1>:,<nid2>",
+        * etc.  However, convert_hostnames() should have caught those.
+        */
         while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) {
                 while (class_parse_nid(ptr, &nid, &ptr) == 0) {
                         if (failnodeuuid == NULL) {
@@ -1903,15 +1908,25 @@ static int mgs_write_log_failnids(const struct lu_env *env,
                                "client %s\n", libcfs_nid2str(nid),
                                failnodeuuid, cliname);
                        rc = record_add_uuid(env, llh, nid, failnodeuuid);
-                }
+                       /*
+                        * If *ptr is ':', we have added all NIDs for
+                        * failnodeuuid.
+                        */
+                       if (*ptr == ':') {
+                               rc = record_add_conn(env, llh, cliname,
+                                                    failnodeuuid);
+                               name_destroy(&failnodeuuid);
+                               failnodeuuid = NULL;
+                       }
+               }
                if (failnodeuuid) {
                        rc = record_add_conn(env, llh, cliname, failnodeuuid);
                        name_destroy(&failnodeuuid);
                        failnodeuuid = NULL;
                }
-        }
+       }
 
-        return rc;
+       return rc;
 }
 
 static int mgs_write_log_mdc_to_lmv(const struct lu_env *env,