From 2972033f0b0104a01549382efb9598dd636e23a1 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 1 Feb 2006 22:09:21 +0000 Subject: [PATCH] Branch b1_4_mountconf b=9861 add local nids to mgsnid list at runtime (for MGS's), so that we don't need to figure out the mgsnids at mkfs.lustre time. Now we don't need LNET at all at mkfs time, and we always try the local MGS when running on backup nodes as well, so this is a big win. --- lustre/obdclass/obd_mount.c | 16 ++++++++++++---- lustre/utils/mkfs_lustre.c | 27 ++++++++++++++++++--------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index e0ac24f..a88dafa 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -1343,7 +1343,7 @@ static int server_fill_super(struct super_block *sb) lsi->lsi_ldd->ldd_svname, lsi->lsi_ldd->ldd_fsname, lsi->lsi_lmd->lmd_dev); - /* append ldd nids to lmd nids */ + /* append on-disk MGS nids to mount-line MGS nids */ for (i = 0; (i < lsi->lsi_ldd->ldd_mgsnid_count) && (lsi->lsi_lmd->lmd_mgsnid_count < MTI_NIDS_MAX); i++) { lsi->lsi_lmd->lmd_mgsnid[lsi->lsi_lmd->lmd_mgsnid_count++] = @@ -1357,6 +1357,17 @@ static int server_fill_super(struct super_block *sb) CERROR("ignoring Failed MGS start!!\n"); //GOTO(out_mnt, rc); } else { + /* add local nids (including LO) to MGS nids */ + lnet_process_id_t id; + int j = lsi->lsi_lmd->lmd_mgsnid_count; + i = 0; + while ((rc = LNetGetId(i++, &id)) != -ENOENT) { + if (j >= MTI_NIDS_MAX) + break; + lsi->lsi_lmd->lmd_mgsnid[j++] = id.nid; + } + lsi->lsi_lmd->lmd_mgsnid_count = j; + mgs_service++; } } @@ -1365,9 +1376,6 @@ static int server_fill_super(struct super_block *sb) if (rc) GOTO(out_mnt, rc); - /*Only start MGS/MGC on servers, no other services, even not - *actually mount the filesystem. */ - /* Set up all obd devices for service */ if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOSVC) && (IS_OST(lsi->lsi_ldd) || IS_MDT(lsi->lsi_ldd))) { diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index 164a278..1fff034 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -189,6 +189,7 @@ static void run_command_out() } } +#if 0 static int lnet_setup = 0; static int lnet_start() { @@ -212,7 +213,7 @@ static void lnet_stop() if (--lnet_setup == 0) jt_ptl_network(2, cmd); } - +#endif /*============ disk dev functions ===================*/ @@ -872,11 +873,6 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, case 'f': { int i = 0; char *s1 = optarg, *s2; - if (IS_MGS(&mop->mo_ldd)) { - badopt(long_opt[longidx].name, - "non-MGMT MDT,OST"); - return 1; - } while ((s2 = strsep(&s1, ","))) { mop->mo_ldd.ldd_failnid[i++] = libcfs_str2nid(s2); @@ -1085,6 +1081,7 @@ int main(int argc, char *const argv[]) mop.mo_ldd.ldd_flags |= LDD_F_SV_TYPE_MGS; } +#if 0 if (IS_MGS(&mop.mo_ldd) && (mop.mo_ldd.ldd_mgsnid_count == 0)) { int i; __u64 *nids; @@ -1110,7 +1107,21 @@ int main(int argc, char *const argv[]) } } - if (mop.mo_ldd.ldd_mgsnid_count == 0) { + if (IS_MGS(&mop.mo_ldd) && mop.mo_ldd.ldd_failnid_count) { + /* Add failover nids to mgsnids if we start an MGS + (MDT must have all possible MGS nids for failover.) */ + int i = 0, j = mop.mo_ldd.ldd_mgsnid_count; + while (i < mop.mo_ldd.ldd_failnid_count) { + if (j >= MTI_NIDS_MAX) + break; + mop.mo_ldd.ldd_mgsnid[j++] = + mop.mo_ldd.ldd_failnid[i++]; + } + mop.mo_ldd.ldd_mgsnid_count = j; + } +#endif + + if (!IS_MGS(&mop.mo_ldd) && (mop.mo_ldd.ldd_mgsnid_count == 0)) { fatal(); fprintf(stderr, "Must specify either --mgs or --mgsnid\n"); usage(stderr); @@ -1229,7 +1240,5 @@ int main(int argc, char *const argv[]) out: loop_cleanup(&mop); - lnet_stop(); - return ret; } -- 1.8.3.1