Whamcloud - gitweb
LU-9119 socklnd: propagate errors on send failure
[fs/lustre-release.git] / lnet / klnds / socklnd / socklnd.c
index 2b8854c..d0e073c 100644 (file)
@@ -618,7 +618,7 @@ ksocknal_del_peer(struct lnet_ni *ni, struct lnet_process_id id, __u32 ip)
 
        write_unlock_bh(&ksocknal_data.ksnd_global_lock);
 
-       ksocknal_txlist_done(ni, &zombies, 1);
+       ksocknal_txlist_done(ni, &zombies, -ENETDOWN);
 
        return rc;
 }
@@ -1030,6 +1030,7 @@ ksocknal_create_conn(struct lnet_ni *ni, ksock_route_t *route,
         ksock_tx_t        *tx;
         ksock_tx_t        *txtmp;
         int                rc;
+       int                rc2;
         int                active;
         char              *warn = NULL;
 
@@ -1384,7 +1385,13 @@ failed_2:
                write_unlock_bh(global_lock);
         }
 
-        ksocknal_txlist_done(ni, &zombies, 1);
+       /*
+        * If we get here without an error code, just use -EALREADY.
+        * Depending on how we got here, the error may be positive
+        * or negative. Normalize the value for ksocknal_txlist_done().
+        */
+       rc2 = (rc == 0 ? -EALREADY : (rc > 0 ? -rc : rc));
+       ksocknal_txlist_done(ni, &zombies, rc2);
         ksocknal_peer_decref(peer_ni);
 
 failed_1:
@@ -2348,20 +2355,6 @@ ksocknal_base_shutdown(void)
        module_put(THIS_MODULE);
 }
 
-static __u64 ksocknal_new_incarnation(void)
-{
-       struct timeval tv;
-
-       /* The incarnation number is the time this module loaded and it
-        * identifies this particular instance of the socknal.  Hopefully
-        * we won't be able to reboot more frequently than 1MHz for the
-        * forseeable future :) */
-
-       do_gettimeofday(&tv);
-
-       return (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
-}
-
 static int
 ksocknal_base_startup(void)
 {
@@ -2794,8 +2787,8 @@ ksocknal_startup(struct lnet_ni *ni)
                 goto fail_0;
 
        spin_lock_init(&net->ksnn_lock);
-        net->ksnn_incarnation = ksocknal_new_incarnation();
-        ni->ni_data = net;
+       net->ksnn_incarnation = ktime_get_real_ns();
+       ni->ni_data = net;
        if (!ni->ni_net->net_tunables_set) {
                ni->ni_net->net_tunables.lct_peer_timeout =
                        *ksocknal_tunables.ksnd_peertimeout;