From e9df9e9c3f4fbe5d2b7246edec55233b4e782bcd Mon Sep 17 00:00:00 2001 From: yury Date: Tue, 26 Sep 2006 15:27:40 +0000 Subject: [PATCH] - pass handling errors down to target_send_reply() to let it know when to send normal reply and when to send errors. --- lustre/fld/fld_request.c | 6 ++++-- lustre/mdt/mdt_handler.c | 26 +++++++++++++++++--------- lustre/mdt/mdt_open.c | 4 ++-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 77cfb3f..ab6d530 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -73,8 +73,10 @@ fld_rrb_scan(struct lu_client_fld *fld, seqno_t seq) 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); } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index bc30961..5f003ec 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1539,17 +1539,24 @@ static int mdt_req_handle(struct mdt_thread_info *info, * 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); @@ -1701,8 +1708,9 @@ static int mdt_reply(struct ptlrpc_request *req, int rc, 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; } } diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 52ecd5a..268ee8e 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -703,8 +703,8 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) 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)) -- 1.8.3.1