}
LASSERT(lgh != NULL);
- ctxt->loc_handle = lgh;
rc = llog_cat_init_and_process(env, lgh);
if (rc != 0)
GOTO(out_close, rc);
}
+ ctxt->loc_handle = lgh;
+
CDEBUG(D_INFO, "%s: Init llog for %d - catid "DOSTID":%x\n",
obd->obd_name, index, POSTID(&cid->lci_logid.lgl_oi),
cid->lci_logid.lgl_ogen);
out_close:
- if (rc != 0) {
- llog_cat_close(env, ctxt->loc_handle);
- ctxt->loc_handle = NULL;
- }
-
+ if (rc != 0)
+ llog_cat_close(env, lgh);
out_put:
llog_ctxt_put(ctxt);
RETURN(rc);
if (IS_ERR(th))
GOTO(out, rc = PTR_ERR(th));
- /* Create the remote update llog object synchronously, which
- * happens during inialization process see lod_sub_prep_llog(),
- * to make sure the update llog object is created before
- * corss-MDT writing updates into the llog object */
- if (dt_object_remote((*res)->lgh_obj))
+ /* Create update llog object synchronously, which
+ * happens during inialization process see
+ * lod_sub_prep_llog(), to make sure the update
+ * llog object is created before corss-MDT writing
+ * updates into the llog object */
+ if (ctxt->loc_flags & LLOG_CTXT_FLAG_NORMAL_FID)
th->th_sync = 1;
th->th_wait_submit = 1;
if (rc)
GOTO(out, rc);
+ /* For update log, this happens during initialization,
+ * see lod_sub_prep_llog(), and we need make sure catlog
+ * file ID is written to catlist file(committed) before
+ * cross-MDT operation write update records to catlog FILE,
+ * otherwise, during failover these update records might
+ * missing */
+ if (fid_is_update_log(fid))
+ th->th_sync = 1;
+
rc = dt_trans_start_local(env, d, th);
if (rc)
GOTO(out_trans, rc);
oth->ot_our = our;
our->our_th = oth;
- if (oth->ot_super.th_sync)
- oth->ot_our->our_flags |= UPDATE_FL_SYNC;
-
return 0;
}
{
struct osp_thandle *oth = thandle_to_osp_thandle(th);
+ if (oth->ot_super.th_sync)
+ oth->ot_our->our_flags |= UPDATE_FL_SYNC;
/* For remote thandle, if there are local thandle, start it here*/
if (is_only_remote_trans(th) && oth->ot_storage_th != NULL)
return dt_trans_start(env, oth->ot_storage_th->th_dev,
list_for_each_entry(st, &tmt->tmt_sub_thandle_list, st_sub_list) {
if (st->st_sub_th == NULL)
continue;
- st->st_sub_th->th_sync = th->th_sync;
+ if (th->th_sync)
+ st->st_sub_th->th_sync = th->th_sync;
st->st_sub_th->th_local = th->th_local;
st->st_sub_th->th_tags = th->th_tags;
rc = dt_trans_start(env, st->st_sub_th->th_dev,
* master transno in the update logs to other MDT. */
if (master_st != NULL && master_st->st_sub_th != NULL) {
master_st->st_sub_th->th_local = th->th_local;
- master_st->st_sub_th->th_sync = th->th_sync;
+ if (th->th_sync)
+ master_st->st_sub_th->th_sync = th->th_sync;
master_st->st_sub_th->th_tags = th->th_tags;
master_st->st_sub_th->th_result = th->th_result;
rc = dt_trans_stop(env, master_st->st_dt, master_st->st_sub_th);
if (st == master_st || st->st_sub_th == NULL)
continue;
- st->st_sub_th->th_sync = th->th_sync;
+ if (th->th_sync)
+ st->st_sub_th->th_sync = th->th_sync;
st->st_sub_th->th_local = th->th_local;
st->st_sub_th->th_tags = th->th_tags;
st->st_sub_th->th_result = th->th_result;