Whamcloud - gitweb
LU-5380 at: net AT after connect
[fs/lustre-release.git] / lustre / ptlrpc / client.c
index 8c2a833..1f9452d 100644 (file)
@@ -281,8 +281,8 @@ int ptlrpc_at_get_net_latency(struct ptlrpc_request *req)
 }
 
 /* Adjust expected network latency */
-static void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req,
-                                      unsigned int service_time)
+void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req,
+                              unsigned int service_time)
 {
         unsigned int nl, oldnl;
         struct imp_at *at;
@@ -1075,9 +1075,9 @@ static int ptlrpc_import_delay_req(struct obd_import *imp,
                          D_HA : D_ERROR, req, "IMP_CLOSED ");
                *status = -EIO;
         } else if (ptlrpc_send_limit_expired(req)) {
-                /* probably doesn't need to be a D_ERROR after initial testing */
-                DEBUG_REQ(D_ERROR, req, "send limit expired ");
-                *status = -EIO;
+               /* probably doesn't need to be a D_ERROR after initial testing*/
+               DEBUG_REQ(D_HA, req, "send limit expired ");
+               *status = -ETIMEDOUT;
        } else if (req->rq_send_state == LUSTRE_IMP_CONNECTING &&
                   imp->imp_state == LUSTRE_IMP_CONNECTING) {
                /* allow CONNECT even if import is invalid */ ;
@@ -1268,7 +1268,9 @@ static int after_reply(struct ptlrpc_request *req)
                time_t  now = cfs_time_current_sec();
 
                DEBUG_REQ(D_RPCTRACE, req, "Resending request on EINPROGRESS");
+               spin_lock(&req->rq_lock);
                req->rq_resend = 1;
+               spin_unlock(&req->rq_lock);
                req->rq_nr_resend++;
 
                /* allocate new xid to avoid reply reconstruction */
@@ -1521,12 +1523,14 @@ static inline int ptlrpc_set_producer(struct ptlrpc_request_set *set)
 int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
 {
        struct list_head *tmp, *next;
-        int force_timer_recalc = 0;
-        ENTRY;
+       struct list_head  comp_reqs;
+       int force_timer_recalc = 0;
+       ENTRY;
 
        if (atomic_read(&set->set_remaining) == 0)
-                RETURN(1);
+               RETURN(1);
 
+       INIT_LIST_HEAD(&comp_reqs);
        list_for_each_safe(tmp, next, &set->set_requests) {
                struct ptlrpc_request *req =
                        list_entry(tmp, struct ptlrpc_request,
@@ -1601,8 +1605,10 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
                         ptlrpc_rqphase_move(req, req->rq_next_phase);
                 }
 
-                if (req->rq_phase == RQ_PHASE_COMPLETE)
+                if (req->rq_phase == RQ_PHASE_COMPLETE) {
+                       list_move_tail(&req->rq_set_chain, &comp_reqs);
                         continue;
+               }
 
                 if (req->rq_phase == RQ_PHASE_INTERPRET)
                         GOTO(interpret, req->rq_status);
@@ -1889,9 +1895,15 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
                        if (req->rq_status != 0)
                                set->set_rc = req->rq_status;
                        ptlrpc_req_finished(req);
+               } else {
+                       list_move_tail(&req->rq_set_chain, &comp_reqs);
                }
        }
 
+       /* move completed request at the head of list so it's easier for
+        * caller to find them */
+       list_splice(&comp_reqs, &set->set_requests);
+
        /* If we hit an error, we want to recover promptly. */
        RETURN(atomic_read(&set->set_remaining) == 0 || force_timer_recalc);
 }