if (!llog_exist(loghandle))
continue;
+ down_write(&loghandle->lgh_lock);
rc = llog_read_header(env, loghandle, NULL);
+ up_write(&loghandle->lgh_lock);
if (rc)
goto unlock;
}
rc = llog_read_header(env, cathandle, NULL);
unlock:
- up_write(&loghandle->lgh_lock);
+ up_write(&cathandle->lgh_lock);
return rc;
}
hdr = (*llhp)->lgh_hdr;
if ((hdr->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) &&
hdr->llh_count == 1 && cat_llh->lgh_obj != NULL &&
- *llhp != cat_llh->u.chd.chd_current_log) {
+ *llhp != cat_llh->u.chd.chd_current_log &&
+ *llhp != cat_llh->u.chd.chd_next_log) {
rc = llog_destroy(env, *llhp);
if (rc)
CWARN("%s: can't destroy empty log "DFID": rc = %d\n",
} else if (d->lpd_startidx > 0) {
struct llog_process_cat_data cd;
+ cd.lpcd_read_mode = LLOG_READ_MODE_NORMAL;
cd.lpcd_first_idx = d->lpd_startidx;
cd.lpcd_last_idx = 0;
rc = llog_process_or_fork(env, llh, d->lpd_cb, d->lpd_data,
if (rc == LLOG_DEL_PLAIN || rc == LLOG_DEL_RECORD)
/* clear wrong catalog entry */
rc = llog_cat_cleanup(env, cat_llh, llh, rec->lrh_index);
+ else if (rc == LLOG_SKIP_PLAIN)
+ /* processing callback ask to skip the llog -> continue */
+ rc = 0;
if (llh)
llog_handle_put(env, llh);
if (llh->llh_cat_idx >= cat_llh->lgh_last_idx &&
llh->llh_count > 1) {
- struct llog_process_cat_data cd;
+ struct llog_process_cat_data cd = {
+ .lpcd_read_mode = LLOG_READ_MODE_NORMAL
+ };
CWARN("%s: catlog "DFID" crosses index zero\n",
loghandle2name(cat_llh),
} else if (rc == LLOG_DEL_RECORD) {
/* clear wrong catalog entry */
rc = llog_cat_cleanup(env, cat_llh, NULL, rec->lrh_index);
+ } else if (rc == LLOG_SKIP_PLAIN) {
+ /* processing callback ask to skip the llog -> continue */
+ rc = 0;
}
if (rc)
RETURN(rc);
ENTRY;
LASSERT(llh->llh_flags & LLOG_F_IS_CAT);
+ cd.lpcd_read_mode = LLOG_READ_MODE_NORMAL;
d.lpd_data = data;
d.lpd_cb = cb;