Whamcloud - gitweb
LU-3536 lod: cancel update log after all committed
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_handler.c
index bcdf461..9c8ea63 100644 (file)
@@ -1026,7 +1026,7 @@ static int osd_trans_stop(const struct lu_env *env, struct dt_device *dt,
        qtrans = oh->ot_quota_trans;
        oh->ot_quota_trans = NULL;
 
-        if (oh->ot_handle != NULL) {
+       if (oh->ot_handle != NULL) {
                 handle_t *hdl = oh->ot_handle;
 
                 /*
@@ -1039,6 +1039,7 @@ static int osd_trans_stop(const struct lu_env *env, struct dt_device *dt,
 
                 LASSERT(oti->oti_txns == 1);
                 oti->oti_txns--;
+
                 rc = dt_txn_hook_stop(env, th);
                 if (rc != 0)
                        CERROR("%s: failed in transaction hook: rc = %d\n",
@@ -5549,10 +5550,18 @@ static int osd_fid_init(const struct lu_env *env, struct osd_device *osd)
 
        rc = seq_client_init(osd->od_cl_seq, NULL, LUSTRE_SEQ_METADATA,
                             osd->od_svname, ss->ss_server_seq);
-
        if (rc != 0) {
                OBD_FREE_PTR(osd->od_cl_seq);
                osd->od_cl_seq = NULL;
+               RETURN(rc);
+       }
+
+       if (ss->ss_node_id == 0) {
+               /* If the OSD on the sequence controller(MDT0), then allocate
+                * sequence here, otherwise allocate sequence after connected
+                * to MDT0 (see mdt_register_lwp_callback()). */
+               rc = seq_server_alloc_meta(osd->od_cl_seq->lcs_srv,
+                                  &osd->od_cl_seq->lcs_space, env);
        }
 
        RETURN(rc);