From: Bobi Jam <bobijam...@intel.com> If we specify multiple --mgsnode for a MDT, when we start MDS upon it while MGS is no the other node, the MGC import connection will always select the local nid (which is one of the candidate mgsnode) since it think its the closest connection.
This patch treats further --mgsnode nids as failover nids, so that multiple import connections are added for the MGC import. Lustre-change: http://review.whamcloud.com/7509 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3829 Signed-off-by: Bobi Jam <bobijam...@intel.com> Reviewed-by: Liang Zhen <liang.z...@intel.com> Reviewed-by: Lai Siyao <lai.si...@intel.com> Reviewed-by: Oleg Drokin <oleg.dro...@intel.com> Signed-off-by: Peng Tao <bergw...@gmail.com> Signed-off-by: Andreas Dilger <andreas.dil...@intel.com> --- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 38 +++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index a69a630..74e170f 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -332,12 +332,13 @@ int lustre_start_mgc(struct super_block *sb) sprintf(niduuid, "%s_%x", mgcname, i); if (IS_SERVER(lsi)) { ptr = lsi->lsi_lmd->lmd_mgs; + CDEBUG(D_MOUNT, "mgs nids %s.\n", ptr); if (IS_MGS(lsi)) { /* Use local nids (including LO) */ lnet_process_id_t id; while ((rc = LNetGetId(i++, &id)) != -ENOENT) { - rc = do_lcfg(mgcname, id.nid, - LCFG_ADD_UUID, niduuid, 0,0,0); + rc = do_lcfg(mgcname, id.nid, LCFG_ADD_UUID, + niduuid, 0, 0, 0); } } else { /* Use mgsnode= nids */ @@ -349,19 +350,30 @@ int lustre_start_mgc(struct super_block *sb) CERROR("No MGS nids given.\n"); GOTO(out_free, rc = -EINVAL); } + /* + * LU-3829. + * Here we only take the first mgsnid as its primary + * serving mgs node, the rest mgsnid will be taken as + * failover mgs node, otherwise they would be takens + * as multiple nids of a single mgs node. + */ while (class_parse_nid(ptr, &nid, &ptr) == 0) { - rc = do_lcfg(mgcname, nid, - LCFG_ADD_UUID, niduuid, 0,0,0); - i++; + rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, + niduuid, 0, 0, 0); + if (rc == 0) { + i = 1; + break; + } } } } else { /* client */ /* Use nids from mount line: uml1,1@elan:uml2,2@elan:/lustre */ ptr = lsi->lsi_lmd->lmd_dev; while (class_parse_nid(ptr, &nid, &ptr) == 0) { - rc = do_lcfg(mgcname, nid, - LCFG_ADD_UUID, niduuid, 0,0,0); - i++; + rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, + niduuid, 0, 0, 0); + if (rc == 0) + ++i; /* Stop at the first failover nid */ if (*ptr == ':') break; @@ -394,16 +406,18 @@ int lustre_start_mgc(struct super_block *sb) sprintf(niduuid, "%s_%x", mgcname, i); j = 0; while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) { - j++; - rc = do_lcfg(mgcname, nid, - LCFG_ADD_UUID, niduuid, 0,0,0); + rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, + niduuid, 0, 0, 0); + if (rc == 0) + ++j; if (*ptr == ':') break; } if (j > 0) { rc = do_lcfg(mgcname, 0, LCFG_ADD_CONN, niduuid, 0, 0, 0); - i++; + if (rc == 0) + ++i; } else { /* at ":/fsname" */ break; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/