Whamcloud - gitweb
improve handling recoverable errors
[fs/lustre-release.git] / lustre / ptlrpc / client.c
index 8547338..18ca9d2 100644 (file)
@@ -680,10 +680,10 @@ static int after_reply(struct ptlrpc_request *req)
                 /* Either we've been evicted, or the server has failed for
                  * some reason. Try to reconnect, and if that fails, punt to
                  * the upcall. */
-                if (rc == -ENOTCONN || rc == -ENODEV) {
+                if (ll_rpc_recoverable_error(rc)) {
                         if (req->rq_send_state != LUSTRE_IMP_FULL ||
                             imp->imp_obd->obd_no_recov || imp->imp_dlm_fake) {
-                                RETURN(-ENOTCONN);
+                                RETURN(rc);
                         }
                         ptlrpc_request_handle_notconn(req);
                         RETURN(rc);
@@ -737,6 +737,9 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
         ENTRY;
 
         LASSERT(req->rq_phase == RQ_PHASE_NEW);
+        if (req->rq_sent && (req->rq_sent > CURRENT_SECONDS))
+                RETURN (0);
+        
         req->rq_phase = RQ_PHASE_RPC;
 
         imp = req->rq_import;
@@ -824,6 +827,9 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set)
                     ptlrpc_send_new_req(req)) {
                         force_timer_recalc = 1;
                 }
+                /* delayed send - skip */
+                if (req->rq_phase == RQ_PHASE_NEW && req->rq_sent)
+                        continue;
 
                 if (!(req->rq_phase == RQ_PHASE_RPC ||
                       req->rq_phase == RQ_PHASE_BULK ||
@@ -1180,13 +1186,18 @@ int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set)
 
                 /* request in-flight? */
                 if (!((req->rq_phase == RQ_PHASE_RPC && !req->rq_waiting) ||
-                      (req->rq_phase == RQ_PHASE_BULK)))
+                      (req->rq_phase == RQ_PHASE_BULK) ||
+                      (req->rq_phase == RQ_PHASE_NEW)))
                         continue;
 
                 if (req->rq_timedout)   /* already timed out */
                         continue;
 
-                deadline = req->rq_sent + req->rq_timeout;
+                if (req->rq_phase == RQ_PHASE_NEW)
+                        deadline = req->rq_sent;
+                else
+                        deadline = req->rq_sent + req->rq_timeout;
+
                 if (deadline <= now)    /* actually expired already */
                         timeout = 1;    /* ASAP */
                 else if (timeout == 0 || timeout > deadline - now)