Whamcloud - gitweb
b=17323
[fs/lustre-release.git] / lustre / ptlrpc / client.c
index f185808..39d7049 100644 (file)
@@ -94,7 +94,7 @@ static inline struct ptlrpc_bulk_desc *new_bulk(int npages, int type, int portal
         cfs_waitq_init(&desc->bd_waitq);
         desc->bd_max_iov = npages;
         desc->bd_iov_count = 0;
-        desc->bd_md_h = LNET_INVALID_HANDLE;
+        LNetInvalidateHandle(&desc->bd_md_h);
         desc->bd_portal = portal;
         desc->bd_type = type;
 
@@ -575,9 +575,10 @@ struct ptlrpc_request *__ptlrpc_request_alloc(struct obd_import *imp,
                 OBD_ALLOC_PTR(request);
 
         if (request) {
-                LASSERT((unsigned long)imp > 0x1000);
+                LASSERTF((unsigned long)imp > 0x1000, "%p", imp);
                 LASSERT(imp != LP_POISON);
-                LASSERT((unsigned long)imp->imp_client > 0x1000);
+                LASSERTF((unsigned long)imp->imp_client > 0x1000, "%p",
+                        imp->imp_client);
                 LASSERT(imp->imp_client != LP_POISON);
 
                 request->rq_import = class_import_get(imp);
@@ -722,14 +723,13 @@ void ptlrpc_set_destroy(struct ptlrpc_request_set *set)
                 if (req->rq_phase == RQ_PHASE_NEW) {
 
                         if (req->rq_interpret_reply != NULL) {
-                                int (*interpreter)(struct ptlrpc_request *,
-                                                   void *, int) =
+                                ptlrpc_interpterer_t interpreter =
                                         req->rq_interpret_reply;
 
                                 /* higher level (i.e. LOV) failed;
                                  * let the sub reqs clean up */
                                 req->rq_status = -EBADR;
-                                interpreter(req, &req->rq_async_args,
+                                interpreter(NULL, req, &req->rq_async_args,
                                             req->rq_status);
                         }
                         set->set_remaining--;
@@ -1125,7 +1125,7 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req)
 }
 
 /* this sends any unsent RPCs in @set and returns TRUE if all are sent */
-int ptlrpc_check_set(struct ptlrpc_request_set *set)
+int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
 {
         struct list_head *tmp;
         int force_timer_recalc = 0;
@@ -1231,7 +1231,11 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set)
                                 spin_unlock(&imp->imp_lock);
 
                                 req->rq_waiting = 0;
-                                if (req->rq_resend) {
+
+                                if (req->rq_timedout||req->rq_resend) {
+                                        /* This is re-sending anyways, 
+                                         * let's mark req as resend. */
+                                        req->rq_resend = 1;
                                         lustre_msg_add_flags(req->rq_reqmsg,
                                                              MSG_RESENT);
                                         if (req->rq_bulk) {
@@ -1351,9 +1355,10 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set)
                         ptlrpc_unregister_bulk (req);
 
                 if (req->rq_interpret_reply != NULL) {
-                        int (*interpreter)(struct ptlrpc_request *,void *,int) =
+                        ptlrpc_interpterer_t interpreter =
                                 req->rq_interpret_reply;
-                        req->rq_status = interpreter(req, &req->rq_async_args,
+                        req->rq_status = interpreter(NULL, req,
+                                                     &req->rq_async_args,
                                                      req->rq_status);
                 }
                 req->rq_phase = RQ_PHASE_COMPLETE;
@@ -1576,7 +1581,8 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set)
                 lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(timeout ? timeout : 1),
                                        ptlrpc_expired_set,
                                        ptlrpc_interrupted_set, set);
-                rc = l_wait_event(set->set_waitq, ptlrpc_check_set(set), &lwi);
+                rc = l_wait_event(set->set_waitq,
+                                  ptlrpc_check_set(NULL, set), &lwi);
 
                 LASSERT(rc == 0 || rc == -EINTR || rc == -ETIMEDOUT);
 
@@ -2082,8 +2088,8 @@ repeat:
                   "-- sleeping for "CFS_DURATION_T" ticks", timeout);
         lwi = LWI_TIMEOUT_INTR(timeout, expired_request, interrupted_request,
                                req);
-        rc = l_wait_event(req->rq_reply_waitq, ptlrpc_check_reply(req), &lwi);
-        if (rc == -ETIMEDOUT && ((req->rq_deadline > cfs_time_current_sec()) ||
+        brc = l_wait_event(req->rq_reply_waitq, ptlrpc_check_reply(req), &lwi);
+        if (brc == -ETIMEDOUT && ((req->rq_deadline > cfs_time_current_sec()) ||
                                  ptlrpc_check_and_wait_suspend(req)))
                 goto repeat;
 
@@ -2108,7 +2114,7 @@ after_send:
         if (req->rq_err) {
                 DEBUG_REQ(D_RPCTRACE, req, "err rc=%d status=%d",
                           rc, req->rq_status);
-                GOTO(out, rc = -EIO);
+                GOTO(out, rc = rc ? rc : -EIO);
         }
 
         if (req->rq_intr) {
@@ -2185,7 +2191,8 @@ struct ptlrpc_replay_async_args {
         int praa_old_status;
 };
 
-static int ptlrpc_replay_interpret(struct ptlrpc_request *req,
+static int ptlrpc_replay_interpret(const struct lu_env *env,
+                                   struct ptlrpc_request *req,
                                     void * data, int rc)
 {
         struct ptlrpc_replay_async_args *aa = data;