Whamcloud - gitweb
LU-8311 mount: fix lmd_parse() to parse colon as NID delimiter 29/21329/4
authorJian Yu <jian.yu@intel.com>
Fri, 15 Jul 2016 07:11:45 +0000 (00:11 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 6 Aug 2016 06:24:23 +0000 (06:24 +0000)
In multi-rail and failover configurations, colon is a valid
delimiter in LNET nid list to separate different hosts.
This patch fixes lmd_parse()->lmd_parse_nidlist() to handle
both comma and colon as delimiters.

Signed-off-by: Jian Yu <jian.yu@intel.com>
Change-Id: I287e08c22c82c2143fe9aba185473a672e8f1429
Reviewed-on: http://review.whamcloud.com/21329
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/obd_mount.c
lustre/tests/conf-sanity.sh

index 3908e1e..fba6e8e 100644 (file)
@@ -1046,18 +1046,18 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)
 }
 
 /**
- * Find the first comma delimiter from the specified \a buf and make \a *endh
- * point to the string starting with the comma. The commas in expression list
- * [...] will be skipped.
+ * Find the first delimiter (comma or colon) from the specified \a buf and
+ * make \a *endh point to the string starting with the delimiter. The commas
+ * in expression list [...] will be skipped.
  *
- * \param[in] buf      a comma-separated string
+ * \param[in] buf      a delimiter-separated string
  * \param[in] endh     a pointer to a pointer that will point to the string
- *                     starting with the comma
+ *                     starting with the delimiter
  *
- * \retval 0           if comma delimiter is found
- * \retval 1           if comma delimiter is not found
+ * \retval 0           if delimiter is found
+ * \retval 1           if delimiter is not found
  */
-static int lmd_find_comma(char *buf, char **endh)
+static int lmd_find_delimiter(char *buf, char **endh)
 {
        char *c = buf;
        int   skip = 0;
@@ -1071,7 +1071,7 @@ static int lmd_find_comma(char *buf, char **endh)
                else if (*c == ']')
                        skip--;
 
-               if (*c == ',' && skip == 0) {
+               if ((*c == ',' || *c == ':') && skip == 0) {
                        if (endh != NULL)
                                *endh = c;
                        return 0;
@@ -1084,13 +1084,13 @@ static int lmd_find_comma(char *buf, char **endh)
 }
 
 /**
- * Find the first valid string delimited by comma from the specified \a buf
- # and parse it to see whether it's a valid nid list. If yes, \a *endh will
- * point to the next string starting with the comma.
+ * Find the first valid string delimited by comma or colon from the specified
+ * \a buf and parse it to see whether it's a valid nid list. If yes, \a *endh
+ * will point to the next string starting with the delimiter.
  *
- * \param[in] buf      a comma-separated string
+ * \param[in] buf      a delimiter-separated string
  * \param[in] endh     a pointer to a pointer that will point to the string
- *                     starting with the comma
+ *                     starting with the delimiter
  *
  * \retval 0           if the string is a valid nid list
  * \retval 1           if the string is not a valid nid list
@@ -1109,7 +1109,7 @@ static int lmd_parse_nidlist(char *buf, char **endh)
        if (*buf == ' ' || *buf == '/' || *buf == '\0')
                return 1;
 
-       if (lmd_find_comma(buf, &endp) != 0)
+       if (lmd_find_delimiter(buf, &endp) != 0)
                endp = buf + strlen(buf);
 
        tmp = *endp;
@@ -1248,7 +1248,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
                } else if (strncmp(s1, "param=", 6) == 0) {
                        size_t length, params_length;
                        char  *tail = s1;
-                       if (lmd_find_comma(s1 + 6, &tail) != 0)
+                       if (lmd_find_delimiter(s1 + 6, &tail) != 0)
                                length = strlen(s1);
                        else {
                                char *param_str = tail + 1;
index 1bd8cff..89a945b 100755 (executable)
@@ -5150,10 +5150,8 @@ run_test 76c "verify changelog_mask is applied with set_param -P"
 
 test_77() { # LU-3445
        local server_version=$(lustre_version_code $SINGLEMDS)
-
-       [[ $server_version -ge $(version_code 2.2.60) ]] &&
-       [[ $server_version -le $(version_code 2.4.0) ]] &&
-               skip "Need MDS version < 2.2.60 or > 2.4.0" && return
+       [[ $server_version -ge $(version_code 2.8.55) ]] ||
+               { skip "Need MDS version 2.8.55+ "; return; }
 
        if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
                is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
@@ -5174,7 +5172,7 @@ test_77() { # LU-3445
                error "start fs2mds failed"
 
        mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
-       [[ $mgsnid = *,* ]] || mgsnid+=",$mgsnid"
+       mgsnid="$mgsnid,$mgsnid:$mgsnid"
 
        add fs2ost $(mkfs_opts ost1 $fs2ostdev) --mgsnode=$mgsnid \
                --failnode=$failnid --fsname=$fsname \