- LASSERT(lsm->lsm_object_gr == loi->loi_gr);
- rc1 = llog_add(cctxt, rec, NULL, logcookies + rc,
- numcookies - rc);
- if (rc1 < 0)
- RETURN(rc1);
- rc += rc1;
+ /* inject error in llog_add() below */
+ if (OBD_FAIL_CHECK(OBD_FAIL_MDS_FAIL_LOV_LOG_ADD)) {
+ llog_ctxt_put(cctxt);
+ cctxt = NULL;
+ }
+ 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 %d\n",
+ rc, cookies);
+ memset(logcookies + cookies, 0,
+ sizeof(struct llog_cookie));
+ rc = 1; /* skip this cookie */
+ }
+ /* Note that rc is always 1 if llog_add was successful */
+ cookies += rc;