int llog_setup(struct obd_device *obd, int index, struct obd_device *disk_obd,
int count, struct llog_logid *logid, struct llog_operations *op);
int llog_cleanup(struct llog_ctxt *);
-int llog_precleanup(struct llog_ctxt *);
+int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp);
int llog_add(struct llog_ctxt *ctxt,
struct llog_rec_hdr *rec, struct lov_stripe_md *lsm,
struct llog_cookie *logcookies, int numcookies);
int llog_obd_repl_cancel(struct llog_ctxt *ctxt,
struct lov_stripe_md *lsm, int count,
struct llog_cookie *cookies, int flags);
+int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp);
int llog_repl_connect(struct llog_ctxt *ctxt, int count,
struct llog_logid *logid, struct llog_ctxt_gen *gen);
int (*lop_setup)(struct obd_device *obd, int ctxt_idx,
struct obd_device *disk_obd, int count,
struct llog_logid *logid);
- int (*lop_precleanup)(struct llog_ctxt *ctxt);
+ int (*lop_sync)(struct llog_ctxt *ctxt, struct obd_export *exp);
int (*lop_cleanup)(struct llog_ctxt *ctxt);
int (*lop_add)(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
struct lov_stripe_md *lsm,
}
EXPORT_SYMBOL(llog_obd_repl_cancel);
+int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp)
+{
+ int rc = 0;
+ ENTRY;
+
+ LASSERT(ctxt->loc_llcd);
+
+ if (exp && (ctxt->loc_imp == exp->exp_imp_reverse)) {
+ CWARN("import will be destroyed, put llcd %p\n",
+ ctxt->loc_llcd);
+ llcd_put(ctxt->loc_llcd);
+ ctxt->loc_llcd = NULL;
+ up(&ctxt->loc_sem);
+ } else {
+ up(&ctxt->loc_sem);
+ rc = llog_cancel(ctxt, NULL, 0, NULL, OBD_LLOG_FL_SENDNOW);
+ }
+
+ RETURN(rc);
+}
+EXPORT_SYMBOL(llog_obd_repl_sync);
+
static int log_commit_thread(void *arg)
{
struct llog_commit_master *lcm = arg;
CWARN("no callback function for recovery\n");
CDEBUG(D_HA, "send to llcd :%p forcibly\n", ctxt->loc_llcd);
- llog_cancel(ctxt, NULL, 0, NULL, OBD_LLOG_FL_SENDNOW);
+ llog_sync(ctxt, NULL);
out:
rc = llog_cat_put(llh);
if (rc)