int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
char *name, int idx, int count, struct llog_catid *idarray);
+#define LLOG_CTXT_FLAG_UNINITIALIZED 0x00000001
struct llog_ctxt {
int loc_idx; /* my index the obd array of ctxt's */
struct llog_gen loc_gen;
atomic_t loc_refcount;
struct llog_commit_master *loc_lcm;
void *llog_proc_cb;
+ long loc_flags; /* flags, see above defines */
};
#define LCM_NAME_SIZE 64
llog_ctxt_put(cctxt);
cctxt = NULL;
}
- rc = llog_add(cctxt, rec, NULL, logcookies + cookies,
- numcookies - cookies);
- llog_ctxt_put(cctxt);
+
+ if (cctxt && cctxt->loc_flags & LLOG_CTXT_FLAG_UNINITIALIZED) {
+ llog_ctxt_put(cctxt);
+ rc = -EAGAIN;
+ } else {
+ /* "cctxt == NULL" will be checked in llog_add */
+ rc = llog_add(cctxt, rec, NULL, logcookies + cookies,
+ numcookies - cookies);
+ llog_ctxt_put(cctxt);
+ }
+
if (rc < 0) {
CERROR("Can't add llog (rc = %d) for stripe %i\n",
rc, cookies);
ENTRY;
lctxt = llog_get_context(lov_obd, ctxt->loc_idx);
+ if (lctxt && lctxt->loc_flags & LLOG_CTXT_FLAG_UNINITIALIZED) {
+ llog_ctxt_put(lctxt);
+ RETURN(-EAGAIN);
+ }
+ /* "lctxt == NULL" will be checked in llog_add */
rc = llog_add(lctxt, rec, lsm, logcookies, numcookies);
llog_ctxt_put(lctxt);
ctxt->loc_obd = obd;
atomic_set(&ctxt->loc_refcount, 1);
+ ctxt->loc_flags = LLOG_CTXT_FLAG_UNINITIALIZED;
return ctxt;
}
CERROR("obd %s ctxt %d lop_setup=%p failed %d\n",
obd->obd_name, index, op->lop_setup, rc);
llog_ctxt_put(ctxt);
+ } else {
+ CDEBUG(D_CONFIG, "obd %s ctxt %d is initialized\n",
+ obd->obd_name, index);
+ ctxt->loc_flags &= ~LLOG_CTXT_FLAG_UNINITIALIZED;
}
out:
mutex_up(&obd->obd_llog_alloc);