Whamcloud - gitweb
- pass handling errors down to target_send_reply() to let it know when to send normal...
authoryury <yury>
Tue, 26 Sep 2006 15:27:40 +0000 (15:27 +0000)
committeryury <yury>
Tue, 26 Sep 2006 15:27:40 +0000 (15:27 +0000)
lustre/fld/fld_request.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_open.c

index 77cfb3f..ab6d530 100644 (file)
@@ -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);
 }
index bc30961..5f003ec 100644 (file)
@@ -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;
                 }
         }
index 52ecd5a..268ee8e 100644 (file)
@@ -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))