Whamcloud - gitweb
LU-13675 o2iblnd: revert 'Timed out tx' patch
[fs/lustre-release.git] / lnet / klnds / o2iblnd / o2iblnd_cb.c
index 1bd8844..3b3ede1 100644 (file)
@@ -610,7 +610,8 @@ kiblnd_fmr_map_tx(struct kib_net *net, struct kib_tx *tx,
        fps = net->ibn_fmr_ps[cpt];
        rc = kiblnd_fmr_pool_map(fps, tx, rd, nob, 0, &tx->tx_fmr);
        if (rc != 0) {
-               CERROR("Can't map %u pages: %d\n", nob, rc);
+               CERROR("Can't map %u bytes (%u/%u)s: %d\n", nob,
+                      tx->tx_nfrags, rd->rd_nfrags, rc);
                return rc;
        }
 
@@ -1020,24 +1021,28 @@ kiblnd_check_sends_locked(struct kib_conn *conn)
 static void
 kiblnd_tx_complete(struct kib_tx *tx, int status)
 {
-        int           failed = (status != IB_WC_SUCCESS);
+       int           failed = (status != IB_WC_SUCCESS);
        struct kib_conn   *conn = tx->tx_conn;
-        int           idle;
+       int           idle;
 
-        LASSERT (tx->tx_sending > 0);
+       if (tx->tx_sending <= 0) {
+               CERROR("Received an event on a freed tx: %p status %d\n",
+                      tx, tx->tx_status);
+               return;
+       }
 
-        if (failed) {
-                if (conn->ibc_state == IBLND_CONN_ESTABLISHED)
+       if (failed) {
+               if (conn->ibc_state == IBLND_CONN_ESTABLISHED)
                        CNETERR("Tx -> %s cookie %#llx"
-                                " sending %d waiting %d: failed %d\n",
-                                libcfs_nid2str(conn->ibc_peer->ibp_nid),
-                                tx->tx_cookie, tx->tx_sending, tx->tx_waiting,
-                                status);
+                               " sending %d waiting %d: failed %d\n",
+                               libcfs_nid2str(conn->ibc_peer->ibp_nid),
+                               tx->tx_cookie, tx->tx_sending, tx->tx_waiting,
+                               status);
 
-                kiblnd_close_conn(conn, -EIO);
-        } else {
-                kiblnd_peer_alive(conn->ibc_peer);
-        }
+               kiblnd_close_conn(conn, -EIO);
+       } else {
+               kiblnd_peer_alive(conn->ibc_peer);
+       }
 
        spin_lock(&conn->ibc_lock);
 
@@ -1234,7 +1239,7 @@ kiblnd_queue_tx_locked(struct kib_tx *tx, struct kib_conn *conn)
                return;
        }
 
-       timeout_ns = lnet_get_lnd_timeout() * NSEC_PER_SEC;
+       timeout_ns = kiblnd_timeout() * NSEC_PER_SEC;
        tx->tx_queued = 1;
        tx->tx_deadline = ktime_add_ns(ktime_get(), timeout_ns);
 
@@ -1363,12 +1368,12 @@ kiblnd_connect_peer(struct kib_peer_ni *peer_ni)
 
        if (*kiblnd_tunables.kib_use_priv_port) {
                rc = kiblnd_resolve_addr(cmid, &srcaddr, &dstaddr,
-                                        lnet_get_lnd_timeout() * 1000);
+                                        kiblnd_timeout() * 1000);
        } else {
                rc = rdma_resolve_addr(cmid,
                                       (struct sockaddr *)&srcaddr,
                                       (struct sockaddr *)&dstaddr,
-                                      lnet_get_lnd_timeout() * 1000);
+                                      kiblnd_timeout() * 1000);
        }
        if (rc != 0) {
                /* Can't initiate address resolution:  */
@@ -3077,7 +3082,7 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
                         rc = event->status;
                } else {
                        rc = rdma_resolve_route(
-                               cmid, lnet_get_lnd_timeout() * 1000);
+                               cmid, kiblnd_timeout() * 1000);
                        if (rc == 0) {
                                struct kib_net *net = peer_ni->ibp_ni->ni_data;
                                struct kib_dev *dev = net->ibn_dev;
@@ -3493,7 +3498,7 @@ kiblnd_connd (void *arg)
                          * connection within (n+1)/n times the timeout
                          * interval. */
 
-                       lnd_timeout = lnet_get_lnd_timeout();
+                       lnd_timeout = kiblnd_timeout();
                        if (lnd_timeout > n * p)
                                chunk = (chunk * n * p) / lnd_timeout;
                        if (chunk == 0)