struct llog_operations *op);
int __llog_ctxt_put(struct llog_ctxt *ctxt);
int llog_cleanup(struct llog_ctxt *);
-int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp);
+int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
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_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp,
+ int flags);
int llog_obd_repl_connect(struct llog_ctxt *ctxt,
struct llog_logid *logid, struct llog_gen *gen,
struct obd_uuid *uuid);
int (*lop_setup)(struct obd_device *obd, struct obd_llog_group *olg,
int ctxt_idx, struct obd_device *disk_obd, int count,
struct llog_logid *logid, const char *name);
- int (*lop_sync)(struct llog_ctxt *ctxt, struct obd_export *exp);
+ int (*lop_sync)(struct llog_ctxt *ctxt, struct obd_export *exp,
+ int flags);
int (*lop_cleanup)(struct llog_ctxt *ctxt);
int (*lop_add)(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
struct lov_stripe_md *lsm,
char *name, int idx, int count, struct llog_catid *idarray);
#define LLOG_CTXT_FLAG_UNINITIALIZED 0x00000001
+#define LLOG_CTXT_FLAG_STOP 0x00000002
struct llog_ctxt {
int loc_idx; /* my index the obd array of ctxt's */
};
#define OBD_LLOG_FL_SENDNOW 0x0001
+#define OBD_LLOG_FL_EXIT 0x0002
enum obd_cleanup_stage {
/* Special case hack for MDS LOVs */
/*
* Make sure that all cached data is sent.
*/
- llog_sync(ctxt, NULL);
+ llog_sync(ctxt, NULL, 0);
GOTO(release_llh, rc);
release_llh:
rc = llog_cat_put(llh);
}
EXPORT_SYMBOL(llog_setup);
-int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp)
+int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags)
{
int rc = 0;
ENTRY;
RETURN(0);
if (CTXTP(ctxt, sync))
- rc = CTXTP(ctxt, sync)(ctxt, exp);
+ rc = CTXTP(ctxt, sync)(ctxt, exp, flags);
RETURN(rc);
}
* We actually do sync in disconnect time, but disconnect
* may not come being marked rq_no_resend = 1.
*/
- llog_sync(ctxt, NULL);
+ llog_sync(ctxt, NULL, OBD_LLOG_FL_EXIT);
/*
* Balance class_import_get() in llog_receptor_accept().
class_import_put(ctxt->loc_imp);
ctxt->loc_imp = NULL;
}
+
+ if (filter->fo_lcm) {
+ llog_recov_thread_fini(filter->fo_lcm, obd->obd_force);
+ filter->fo_lcm = NULL;
+ }
+
cfs_mutex_unlock(&ctxt->loc_mutex);
llog_ctxt_put(ctxt);
}
- if (filter->fo_lcm) {
- cfs_mutex_lock(&ctxt->loc_mutex);
- llog_recov_thread_fini(filter->fo_lcm, obd->obd_force);
- filter->fo_lcm = NULL;
- cfs_mutex_unlock(&ctxt->loc_mutex);
- }
RETURN(filter_olg_fini(&obd->obd_olg));
}
ctxt = llog_group_get_ctxt(olg_min,
LLOG_MDS_OST_REPL_CTXT);
if (ctxt) {
- err = llog_sync(ctxt, olg_min->olg_exp);
+ err = llog_sync(ctxt, olg_min->olg_exp, 0);
llog_ctxt_put(ctxt);
if (err) {
CERROR("error flushing logs to MDS: "
if (obd->u.cli.cl_conn_count == 1) {
/* Flush any remaining cancel messages out to the
* target */
- llog_sync(ctxt, exp);
+ llog_sync(ctxt, exp, 0);
}
llog_ctxt_put(ctxt);
} else {
* Send back cached llcd from llog before recovery if we have any.
* This is void is nothing cached is found there.
*/
- llog_sync(ctxt, NULL);
+ llog_sync(ctxt, NULL, 0);
/*
* Start recovery in separate thread.
* Let's check if we have all structures alive. We also check for
* possible shutdown. Do nothing if we're stopping.
*/
- if (ctxt->loc_imp == NULL) {
+ if (ctxt->loc_flags & LLOG_CTXT_FLAG_STOP) {
+ CDEBUG(D_RPCTRACE, "Last sync was done for ctxt %p\n", ctxt);
+ GOTO(out, rc = -ENODEV);
+ }
+
+ if (ctxt->loc_imp == NULL) {
CDEBUG(D_RPCTRACE, "No import for ctxt %p\n", ctxt);
GOTO(out, rc = -ENODEV);
}
out:
if (rc)
llcd_put(ctxt);
+
+ if (flags & OBD_LLOG_FL_EXIT)
+ ctxt->loc_flags = LLOG_CTXT_FLAG_STOP;
+
cfs_mutex_unlock(&ctxt->loc_mutex);
return rc;
}
EXPORT_SYMBOL(llog_obd_repl_cancel);
-int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp)
+int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp,
+ int flags)
{
int rc = 0;
ENTRY;
*/
CDEBUG(D_RPCTRACE, "Kill cached llcd\n");
llcd_put(ctxt);
+
+ if (flags & OBD_LLOG_FL_EXIT)
+ ctxt->loc_flags = LLOG_CTXT_FLAG_STOP;
+
cfs_mutex_unlock(&ctxt->loc_mutex);
} else {
/*
*/
CDEBUG(D_RPCTRACE, "Sync cached llcd\n");
cfs_mutex_unlock(&ctxt->loc_mutex);
- rc = llog_cancel(ctxt, NULL, 0, NULL, OBD_LLOG_FL_SENDNOW);
+ rc = llog_cancel(ctxt, NULL, 0, NULL, OBD_LLOG_FL_SENDNOW |
+ flags);
}
RETURN(rc);
}