RETURN(target);
}
- /* if target is not found, there is logical error anyway, so here is
- * LBUG() to catch this situation. */
+ /*
+ * If target is not found, there is logical error anyway, so here is
+ * LBUG() to catch this situation.
+ */
LBUG();
RETURN(NULL);
}
* Process request.
*/
rc = h->mh_act(info);
+
+ req->rq_status = rc;
+
/*
- * XXX result value is unconditionally shoved into ->rq_status (original
- * code sometimes placed error code into ->rq_status, and sometimes
- * returned it to the caller). ptlrpc_server_handle_request() doesn't
- * check return value anyway.
+ * It is not correct to zero @rc out here unconditionally. First of all,
+ * for error cases, we do not need target_committed_to_req(req). Second
+ * reason is that, @rc is passed to target_send_reply() and used for
+ * figuring out what should be done about reply in capricular case. We
+ * only zero it out for ELDLM_* codes which > 0 because they do not
+ * support invariant of marking req as difficult only in case of error.
*/
- req->rq_status = rc;
- rc = 0;
+ if (rc > 0)
+ rc = 0;
+
LASSERT(current->journal_info == NULL);
- if (flags & HABEO_CLAVIS && info->mti_mdt->mdt_opts.mo_compat_resname) {
+ if (rc == 0 && (flags & HABEO_CLAVIS)
+ && info->mti_mdt->mdt_opts.mo_compat_resname) {
struct ldlm_reply *dlmrep;
dlmrep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
DEBUG_REQ(D_HA, req, "LAST_REPLAY, queuing reply");
RETURN(target_queue_final_reply(req, rc));
} else {
- /* Lost a race with recovery; let the error path
- * DTRT. */
+ /*
+ * Lost a race with recovery; let the error path DTRT.
+ */
rc = req->rq_status = -ENOTCONN;
}
}
DEBUG_REQ(D_ERROR, req,"OPEN_CREAT not in open replay");
GOTO(out, result = -EFAULT);
}
- CDEBUG(D_INFO, "open replay failed to find object, "
- "continue as regular open\n");
+ CDEBUG(D_INFO, "Open replay failed to find object, "
+ "continue as regular open\n");
}
if (MDT_FAIL_CHECK(OBD_FAIL_MDS_OPEN_PACK))