From 3227436e11b4bc77ffd261e8f13adf905fae2353 Mon Sep 17 00:00:00 2001 From: "hongchao.zhang" Date: Thu, 28 Jul 2011 13:43:59 +0800 Subject: [PATCH] LU-350 fix bug in mgs to allow starting OST before MDT in mgs_steal_llog_for_mdt_from_client, it forgets to add the "index" and "svname" of the existing OST to the config log of the MDT's lov, then cause Lustre fails to mount if the OSTs start before MDT. Change-Id: I0e68bf51c88517dbd42790e7e4447a186cf268f3 Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/595 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Yu Jian Reviewed-by: Oleg Drokin --- lustre/mgs/mgs_llog.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index a8bb398..4c64911 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -1125,6 +1125,8 @@ static int mgs_steal_llog_handler(struct llog_handle *llh, if (!strncmp(marker->cm_comment,"add osc",7) && (marker->cm_flags & CM_START)){ got_an_osc_or_mdc = 1; + strncpy(tmti->mti_svname, marker->cm_tgtname, + sizeof(tmti->mti_svname)); rc = record_start_log(obd, &mdt_llh, mti->mti_svname); rc = record_marker(obd, mdt_llh, fsdb, CM_START, mti->mti_svname,"add osc(copied)"); @@ -1202,12 +1204,21 @@ static int mgs_steal_llog_handler(struct llog_handle *llh, } if (lcfg->lcfg_command == LCFG_LOV_ADD_OBD) { + int index; char mdt_index[9]; char *logname, *lovname; - name_create_mdt_and_lov(&logname, &lovname, fsdb, mti->mti_stripe_index); + name_create_mdt_and_lov(&logname, &lovname, fsdb, + mti->mti_stripe_index); sprintf(mdt_index, "-MDT%04x", mti->mti_stripe_index); + if (sscanf(lustre_cfg_buf(lcfg, 2), "%d", &index) != 1) { + name_destroy(&logname); + name_destroy(&lovname); + RETURN(-EINVAL); + } + + tmti->mti_stripe_index = index; mgs_write_log_osc_to_lov(obd, fsdb, tmti, logname, mdt_index, lovname, LUSTRE_SP_MDT, 0); -- 1.8.3.1