#14 L mount_option 0: 1:client 2:lov1 3:MDC_uml1_mdsA_MNT_client
*/
- /* copy client info about lov/lmv */
- mgi->mgi_comp.comp_mti = mti;
- mgi->mgi_comp.comp_fsdb = fsdb;
+ /* copy client info about lov/lmv */
+ mgi->mgi_comp.comp_mti = mti;
+ mgi->mgi_comp.comp_fsdb = fsdb;
- rc = mgs_steal_llog_for_mdt_from_client(env, mgs, cliname,
- &mgi->mgi_comp);
- if (rc)
- GOTO(out_free, rc);
- rc = mgs_write_log_mdc_to_lmv(env, mgs, fsdb, mti, cliname,
- fsdb->fsdb_clilmv);
- if (rc)
- GOTO(out_free, rc);
+ rc = mgs_steal_llog_for_mdt_from_client(env, mgs, cliname,
+ &mgi->mgi_comp);
+ if (rc)
+ GOTO(out_free, rc);
+ rc = mgs_write_log_mdc_to_lmv(env, mgs, fsdb, mti, cliname,
+ fsdb->fsdb_clilmv);
+ if (rc)
+ GOTO(out_free, rc);
- /* add mountopts */
- rc = record_start_log(env, mgs, &llh, cliname);
- if (rc)
- GOTO(out_free, rc);
+ /* add mountopts */
+ rc = record_start_log(env, mgs, &llh, cliname);
+ if (rc)
+ GOTO(out_free, rc);
- rc = record_marker(env, llh, fsdb, CM_START, cliname,
- "mount opts");
- if (rc)
- GOTO(out_end, rc);
- rc = record_mount_opt(env, llh, cliname, fsdb->fsdb_clilov,
- fsdb->fsdb_clilmv);
- if (rc)
- GOTO(out_end, rc);
- rc = record_marker(env, llh, fsdb, CM_END, cliname,
- "mount opts");
+ rc = record_marker(env, llh, fsdb, CM_START, cliname,
+ "mount opts");
+ if (rc)
+ GOTO(out_end, rc);
+ rc = record_mount_opt(env, llh, cliname, fsdb->fsdb_clilov,
+ fsdb->fsdb_clilmv);
+ if (rc)
+ GOTO(out_end, rc);
+ rc = record_marker(env, llh, fsdb, CM_END, cliname,
+ "mount opts");
if (rc)
GOTO(out_end, rc);
if (rc)
GOTO(out_end, rc);
- rc = mgs_write_log_osp_to_mdt(env, mgs, fsdb, mti,
- i, logname);
+ /* NB: If the log for the MDT is empty, it means
+ * the MDT is only added to the index
+ * map, and not being process yet, i.e. this
+ * is an unregistered MDT, see mgs_write_log_target().
+ * so we should skip it. Otherwise
+ *
+ * 1. MGS get register request for MDT1 and MDT2.
+ *
+ * 2. Then both MDT1 and MDT2 are added into
+ * fsdb_mdt_index_map. (see mgs_set_index()).
+ *
+ * 3. Then MDT1 get the lock of fsdb_mutex, then
+ * generate the config log, here, it will regard MDT2
+ * as an existent MDT, and generate "add osp" for
+ * lustre-MDT0001-osp-MDT0002. Note: at the moment
+ * MDT0002 config log is still empty, so it will
+ * add "add osp" even before "lov setup", which
+ * will definitly cause trouble.
+ *
+ * 4. MDT1 registeration finished, fsdb_mutex is
+ * released, then MDT2 get in, then in above
+ * mgs_steal_llog_for_mdt_from_client(), it will
+ * add another osp log for lustre-MDT0001-osp-MDT0002,
+ * which will cause another trouble.*/
+ if (!mgs_log_is_empty(env, mgs, logname))
+ rc = mgs_write_log_osp_to_mdt(env, mgs, fsdb,
+ mti, i, logname);
+
name_destroy(&logname);
if (rc)
GOTO(out_end, rc);
rc = 0;
}
+ OBD_FAIL_TIMEOUT(OBD_FAIL_MGS_WRITE_TARGET_DELAY, cfs_fail_val > 0 ?
+ cfs_fail_val : 10);
+
mutex_lock(&fsdb->fsdb_mutex);
if (mti->mti_flags &