loghandle->lgh_hdr->llh_flags &= ~LLOG_F_ZAP_WHEN_EMPTY;
/* this is to mimic full log, so another llog_cat_current_log()
* can skip it and ask for another onet */
- loghandle->lgh_last_idx = LLOG_HDR_BITMAP_SIZE(llh) + 1;
+ loghandle->lgh_last_idx = LLOG_HDR_BITMAP_SIZE(loghandle->lgh_hdr) + 1;
llog_trans_destroy(env, loghandle, th);
+ if (handle != NULL)
+ dt_trans_stop(env, dt, handle);
RETURN(rc);
}
down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
llh = loghandle->lgh_hdr;
- LASSERT(llh);
- if (!llog_is_full(loghandle))
+ if (llh == NULL || !llog_is_full(loghandle))
GOTO(out_unlock, loghandle);
else
up_write(&loghandle->lgh_lock);
up_write(&loghandle->lgh_lock);
/* nobody should be trying to use this llog */
down_write(&cathandle->lgh_lock);
- if (cathandle->u.chd.chd_current_log == loghandle)
+ /* only reset current log if still room in catalog, to
+ * avoid unnecessarily and racy creation of new and
+ * partially initialized llog_handle
+ */
+ if ((cathandle->u.chd.chd_current_log == loghandle) &&
+ rc != -ENOSPC)
cathandle->u.chd.chd_current_log = NULL;
up_write(&cathandle->lgh_lock);
RETURN(rc);