Whamcloud - gitweb
LU-3536 lod: cancel update log after all committed
[fs/lustre-release.git] / lustre / obdclass / llog_osd.c
index 9aa79de..f0e904b 100644 (file)
@@ -1377,12 +1377,15 @@ static int llog_osd_close(const struct lu_env *env, struct llog_handle *handle)
 
        LASSERT(handle->lgh_obj);
 
-       lu_object_put(env, &handle->lgh_obj->do_lu);
-
-       if (handle->lgh_ctxt->loc_flags &
-           LLOG_CTXT_FLAG_NORMAL_FID)
+       if (handle->lgh_ctxt->loc_flags & LLOG_CTXT_FLAG_NORMAL_FID) {
+               /* Remove the object from the cache, otherwise it may
+                * hold LOD being released during cleanup process */
+               lu_object_put_nocache(env, &handle->lgh_obj->do_lu);
+               LASSERT(handle->private_data == NULL);
                RETURN(rc);
-
+       } else {
+               lu_object_put(env, &handle->lgh_obj->do_lu);
+       }
        los = handle->private_data;
        LASSERT(los);
        dt_los_put(los);
@@ -1511,6 +1514,8 @@ static int llog_osd_destroy(const struct lu_env *env,
        if (rc)
                GOTO(out_trans, rc);
 
+       th->th_wait_submit = 1;
+
        dt_write_lock(env, o, 0);
        if (dt_object_exists(o)) {
                if (name) {
@@ -1722,6 +1727,12 @@ int llog_osd_get_cat_list(const struct lu_env *env, struct dt_device *d,
                lgi->lgi_attr.la_mode = S_IFREG | S_IRUGO | S_IWUSR;
                lgi->lgi_dof.dof_type = dt_mode_to_dft(S_IFREG);
 
+               th->th_wait_submit = 1;
+               /* Make the llog object creation synchronization, so
+                * it will be reliable to the reference, especially
+                * for remote reference */
+               th->th_sync = 1;
+
                rc = dt_declare_create(env, o, &lgi->lgi_attr, NULL,
                                       &lgi->lgi_dof, th);
                if (rc)
@@ -1854,6 +1865,8 @@ int llog_osd_put_cat_list(const struct lu_env *env, struct dt_device *d,
        if (rc)
                GOTO(out_trans, rc);
 
+       th->th_wait_submit = 1;
+
        rc = dt_record_write(env, o, &lgi->lgi_buf, &lgi->lgi_off, th);
        if (rc)
                CDEBUG(D_INODE, "can't write CATALOGS at index %d: rc = %d\n",