+ if (th == NULL) {
+ dt = lu2dt_dev(cathandle->lgh_obj->do_lu.lo_dev);
+
+ handle = dt_trans_create(env, dt);
+ if (IS_ERR(handle))
+ RETURN(PTR_ERR(handle));
+
+ /* 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 (cathandle->lgh_ctxt->loc_flags & LLOG_CTXT_FLAG_NORMAL_FID)
+ handle->th_sync = 1;
+
+ handle->th_wait_submit = 1;
+
+ rc = llog_declare_create(env, loghandle, handle);
+ if (rc != 0)
+ GOTO(out, rc);
+
+ rec->lid_hdr.lrh_len = sizeof(*rec);
+ rec->lid_hdr.lrh_type = LLOG_LOGID_MAGIC;
+ rec->lid_id = loghandle->lgh_id;
+ rc = llog_declare_write_rec(env, cathandle, &rec->lid_hdr, -1,
+ handle);
+ if (rc != 0)
+ GOTO(out, rc);
+
+ rc = dt_trans_start_local(env, dt, handle);
+ if (rc != 0)
+ GOTO(out, rc);
+
+ th = handle;
+ }
+