From 206796d507b78212a9bcee4b50d74a1dc38d806b Mon Sep 17 00:00:00 2001
From: nathan <nathan>
Date: Fri, 7 Sep 2007 20:45:29 +0000
Subject: [PATCH] b=13542 i=deen i=tianzy the reply state was leaked in the
 no_reply case

---
 lustre/ost/ost_handler.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
index e72d6d1610..d2a8adec62 100644
--- a/lustre/ost/ost_handler.c
+++ b/lustre/ost/ost_handler.c
@@ -669,7 +669,7 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
         struct l_wait_info lwi;
         struct lustre_handle lockh = { 0 };
         int size[2] = { sizeof(struct ptlrpc_body), sizeof(*body) };
-        int comms_error = 0, niocount, npages, nob = 0, rc, i;
+        int niocount, npages, nob = 0, rc, i;
         int no_reply = 0;
         ENTRY;
 
@@ -758,7 +758,7 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
                        "object "LPX64" took %ld seconds.\n",
                        libcfs_id2str(req->rq_peer), ioo->ioo_id,
                        cfs_time_current_sec() - req->rq_arrival_time.tv_sec);
-                goto out_lock;
+                GOTO(out_lock, rc = -ETIMEDOUT);
         }
 
         rc = obd_preprw(OBD_BRW_READ, req->rq_export, &body->oa, 1,
@@ -842,7 +842,7 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
                 } else {
                         DEBUG_REQ(D_ERROR, req, "bulk PUT failed: rc %d", rc);
                 }
-                comms_error = rc != 0;
+                no_reply = rc != 0;
         }
 
         /* Must commit after prep above in all cases */
@@ -861,15 +861,13 @@ out_lock:
         ost_brw_lock_put(LCK_PR, ioo, pp_rnb, &lockh);
 out_bulk:
         ptlrpc_free_bulk(desc);
-        if (no_reply)
-                RETURN(rc);
 out:
         LASSERT(rc <= 0);
         if (rc == 0) {
                 req->rq_status = nob;
                 target_committed_to_req(req);
                 ptlrpc_reply(req);
-        } else if (!comms_error) {
+        } else if (!no_reply) {
                 /* Only reply if there was no comms problem with bulk */
                 target_committed_to_req(req);
                 req->rq_status = rc;
@@ -904,7 +902,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
         struct lustre_capa      *capa = NULL;
         __u32                   *rcs;
         int size[3] = { sizeof(struct ptlrpc_body), sizeof(*body) };
-        int objcount, niocount, npages, comms_error = 0;
+        int objcount, niocount, npages;
         int rc, swab, i, j;
         obd_count                client_cksum, server_cksum = 0;
         int                      no_reply = 0; 
@@ -1017,7 +1015,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
                        "object "LPX64" took %ld seconds.\n",
                        libcfs_id2str(req->rq_peer), ioo->ioo_id,
                        cfs_time_current_sec() - req->rq_arrival_time.tv_sec);
-                goto out_lock;
+                GOTO(out_lock, rc = -ETIMEDOUT);
         }
 
         ost_prolong_locks(req->rq_export, ioo, pp_rnb, LCK_PW);
@@ -1076,7 +1074,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
         } else {
                 DEBUG_REQ(D_ERROR, req, "ptlrpc_bulk_get failed: rc %d", rc);
         }
-        comms_error = rc != 0;
+        no_reply = rc != 0;
 
         repbody = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF,
                                  sizeof(*repbody));
@@ -1170,14 +1168,12 @@ out_lock:
         ost_brw_lock_put(LCK_PW, ioo, pp_rnb, &lockh);
 out_bulk:
         ptlrpc_free_bulk(desc);
-        if (no_reply)
-                RETURN(rc);
 out:
         if (rc == 0) {
                 oti_to_request(oti, req);
                 target_committed_to_req(req);
                 rc = ptlrpc_reply(req);
-        } else if (!comms_error) {
+        } else if (!no_reply) {
                 /* Only reply if there was no comms problem with bulk */
                 target_committed_to_req(req);
                 req->rq_status = rc;
-- 
GitLab