Whamcloud - gitweb
LU-350 fix bug in mgs to allow starting OST before MDT
authorhongchao.zhang <hongchao.zhang@whamcloud.com>
Thu, 28 Jul 2011 05:43:59 +0000 (13:43 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 9 Aug 2011 00:43:38 +0000 (20:43 -0400)
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 <hongchao.zhang@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/595
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mgs/mgs_llog.c

index a8bb398..4c64911 100644 (file)
@@ -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;
                 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)");
                         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) {
         }
 
         if (lcfg->lcfg_command == LCFG_LOV_ADD_OBD) {
+                int index;
                 char mdt_index[9];
                 char *logname, *lovname;
 
                 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);
 
                 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);
                 mgs_write_log_osc_to_lov(obd, fsdb, tmti, logname,
                                          mdt_index, lovname,
                                          LUSTRE_SP_MDT, 0);