loghandle->lgh_id.lgl_ogen, rc);
GOTO(out_err, rc);
}
- RETURN(1);
+ RETURN(LLOG_DEL_PLAIN);
}
spin_unlock(&loghandle->lgh_hdr_lock);
if (rc == LLOG_PROC_BREAK) {
GOTO(out, rc);
} else if (rc == LLOG_DEL_RECORD) {
- llog_cancel_rec(lpi->lpi_env,
- loghandle,
- rec->lrh_index);
- rc = 0;
+ rc = llog_cancel_rec(lpi->lpi_env,
+ loghandle,
+ rec->lrh_index);
}
if (rc)
GOTO(out, rc);
int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
llog_cb_t cb, void *data, void *catdata)
{
- return llog_process_or_fork(env, loghandle, cb, data, catdata, true);
+ int rc;
+ rc = llog_process_or_fork(env, loghandle, cb, data, catdata, true);
+ return rc == LLOG_DEL_PLAIN ? 0 : rc;
}
EXPORT_SYMBOL(llog_process);
if (rc == LLOG_PROC_BREAK) {
GOTO(out, rc);
} else if (rc == LLOG_DEL_RECORD) {
- llog_cancel_rec(env, loghandle,
- tail->lrt_index);
- rc = 0;
+ rc = llog_cancel_rec(env, loghandle,
+ tail->lrt_index);
}
if (rc)
GOTO(out, rc);
}
lrc = llog_cancel_rec(env, loghandle, cookies->lgc_index);
- if (lrc == 1) { /* log has been destroyed */
+ if (lrc == LLOG_DEL_PLAIN) { /* log has been destroyed */
index = loghandle->u.phd.phd_cookie.lgc_index;
rc = llog_cat_cleanup(env, cathandle, loghandle,
index);
NULL, false);
}
+ /* The empty plain log was destroyed while processing */
+ if (rc == LLOG_DEL_PLAIN)
+ rc = llog_cat_cleanup(env, cat_llh, llh,
+ llh->u.phd.phd_cookie.lgc_index);
llog_handle_put(llh);
RETURN(rc);
cd.lpcd_last_idx = 0;
rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
&d, &cd, fork);
- if (rc != 0)
- RETURN(rc);
+ if (rc != 0)
+ RETURN(rc);
- cd.lpcd_first_idx = 0;
- cd.lpcd_last_idx = cat_llh->lgh_last_idx;
+ cd.lpcd_first_idx = 0;
+ cd.lpcd_last_idx = cat_llh->lgh_last_idx;
rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
&d, &cd, fork);
} else {
}
rc = llog_reverse_process(env, llh, d->lpd_cb, d->lpd_data, NULL);
+
+ /* The empty plain was destroyed while processing */
+ if (rc == LLOG_DEL_PLAIN)
+ rc = llog_cat_cleanup(env, cat_llh, llh,
+ llh->u.phd.phd_cookie.lgc_index);
+
llog_handle_put(llh);
RETURN(rc);
}
rc = llog_reverse_process(env, cat_llh,
llog_cat_reverse_process_cb,
&d, &cd);
- if (rc != 0)
- RETURN(rc);
+ if (rc != 0)
+ RETURN(rc);
- cd.lpcd_first_idx = le32_to_cpu(llh->llh_cat_idx);
- cd.lpcd_last_idx = 0;
+ cd.lpcd_first_idx = le32_to_cpu(llh->llh_cat_idx);
+ cd.lpcd_last_idx = 0;
rc = llog_reverse_process(env, cat_llh,
llog_cat_reverse_process_cb,
&d, &cd);