Whamcloud - gitweb
LU-1517 ptlrpc: throw net error to ptlrpc for bulk
[fs/lustre-release.git] / lustre / ptlrpc / events.c
index 6de9c20..55cc32e 100644 (file)
@@ -178,6 +178,7 @@ void client_bulk_callback (lnet_event_t *ev)
 {
         struct ptlrpc_cb_id     *cbid = ev->md.user_ptr;
         struct ptlrpc_bulk_desc *desc = cbid->cbid_arg;
+        struct ptlrpc_request   *req;
         ENTRY;
 
         LASSERT ((desc->bd_type == BULK_PUT_SINK &&
@@ -198,7 +199,7 @@ void client_bulk_callback (lnet_event_t *ev)
                ev->type, ev->status, desc);
 
         cfs_spin_lock(&desc->bd_lock);
-
+        req = desc->bd_req;
         LASSERT(desc->bd_network_rw);
         desc->bd_network_rw = 0;
 
@@ -206,6 +207,11 @@ void client_bulk_callback (lnet_event_t *ev)
                 desc->bd_success = 1;
                 desc->bd_nob_transferred = ev->mlength;
                 desc->bd_sender = ev->sender;
+        } else {
+                /* start reconnect and resend if network error hit */
+                cfs_spin_lock(&req->rq_lock);
+                req->rq_net_err = 1;
+                cfs_spin_unlock(&req->rq_lock);
         }
 
         /* release the encrypted pages for write */
@@ -214,7 +220,7 @@ void client_bulk_callback (lnet_event_t *ev)
 
         /* NB don't unlock till after wakeup; desc can disappear under us
          * otherwise */
-        ptlrpc_client_wake_req(desc->bd_req);
+        ptlrpc_client_wake_req(req);
 
         cfs_spin_unlock(&desc->bd_lock);
         EXIT;
@@ -334,6 +340,7 @@ void request_in_callback(lnet_event_t *ev)
         req->rq_phase = RQ_PHASE_NEW;
         cfs_spin_lock_init(&req->rq_lock);
         CFS_INIT_LIST_HEAD(&req->rq_timed_list);
+       CFS_INIT_LIST_HEAD(&req->rq_exp_list);
         cfs_atomic_set(&req->rq_refcount, 1);
         if (ev->type == LNET_EVENT_PUT)
                 CDEBUG(D_INFO, "incoming req@%p x"LPU64" msgsize %u\n",