Whamcloud - gitweb
LU-10672 lnet: pass in only time64_t to lnet_notify 39/31339/3
authorJames Simmons <uja.ornl@yahoo.com>
Wed, 21 Feb 2018 18:22:02 +0000 (13:22 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 3 Mar 2018 04:30:14 +0000 (04:30 +0000)
With the migration to 64 bit second time some calls to lnet_notify
did not get updated to use time64_t. Update those calling points.
Also for the ioctl IOC_LIBCFS_NOTIFY_ROUTER we pass in the number
of seconds since the epoch. We subtract the current epoch time but
we missed adding in the current number of seconds since booting
since the lnet ping code expects the seconds since boot to be used.

Change-Id: I5a92df08cdaf3b747fd17721a92038df05669a81
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/31339
Reviewed-by: Doug Oucharek <dougso@me.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/klnds/gnilnd/gnilnd.c
lnet/klnds/gnilnd/gnilnd.h
lnet/klnds/gnilnd/gnilnd_conn.c
lnet/klnds/gnilnd/gnilnd_proc.c
lnet/klnds/socklnd/socklnd.c
lnet/lnet/api-ni.c

index 98f4b37..9171fcd 100644 (file)
@@ -505,7 +505,9 @@ kgnilnd_destroy_conn(kgn_conn_t *conn)
 void
 kgnilnd_peer_alive(kgn_peer_t *peer)
 {
-       set_mb(peer->gnp_last_alive, jiffies);
+       time64_t now = ktime_get_seconds();
+
+       set_mb(peer->gnp_last_alive, now);
 }
 
 void
@@ -601,9 +603,9 @@ kgnilnd_peer_notify(kgn_peer_t *peer, int error, int alive)
                        peer_nid = kgnilnd_lnd2lnetnid(net->gnn_ni->ni_nid,
                                                                 peer->gnp_nid);
 
-                       CDEBUG(D_NET, "peer 0x%p->%s last_alive %lu (%lus ago)\n",
+                       CDEBUG(D_NET, "peer 0x%p->%s last_alive %lld (%llds ago)\n",
                                peer, libcfs_nid2str(peer_nid), peer->gnp_last_alive,
-                               cfs_duration_sec(jiffies - peer->gnp_last_alive));
+                               ktime_get_seconds() - peer->gnp_last_alive);
 
                        lnet_notify(net->gnn_ni, peer_nid, alive,
                                    peer->gnp_last_alive);
index bad8d6e..4a05d98 100644 (file)
@@ -789,7 +789,7 @@ typedef struct kgn_peer {
        short               gnp_connecting;             /* connection forming */
        short               gnp_pending_unlink;         /* need last conn close to trigger unlink */
        int                 gnp_last_errno;             /* last error conn saw */
-       unsigned long       gnp_last_alive;             /* last time I had valid comms */
+       time64_t            gnp_last_alive;             /* last time I had valid comms */
        int                 gnp_last_dgram_errno;       /* last error dgrams saw */
        unsigned long       gnp_last_dgram_time;        /* last time I tried to connect */
        unsigned long       gnp_reconnect_time;         /* get_seconds() when reconnect OK */
index aa48010..a3f7c75 100644 (file)
@@ -1952,9 +1952,10 @@ kgnilnd_finish_connect(kgn_dgram_t *dgram)
        write_unlock(&kgnilnd_data.kgn_peer_conn_lock);
 
        /* Notify LNET that we now have a working connection to this peer.
-        * This is a Cray extension to the "standard" LND behavior. */
-       lnet_notify(peer->gnp_net->gnn_ni, peer->gnp_nid,
-                    1, cfs_time_current());
+        * This is a Cray extension to the "standard" LND behavior.
+        */
+       lnet_notify(peer->gnp_net->gnn_ni, peer->gnp_nid, 1,
+                   ktime_get_seconds());
 
        /* drop our 'hold' ref */
        kgnilnd_conn_decref(conn);
index 71c1305..eb99fd2 100644 (file)
@@ -1267,7 +1267,7 @@ kgnilnd_peer_seq_show(struct seq_file *s, void *iter)
 
        read_unlock(&kgnilnd_data.kgn_peer_conn_lock);
 
-       seq_printf(s, "%p->%s [%d] %s NIC 0x%x q %d conn %c purg %d last %d@%dms dgram %d@%dms reconn %dms to %lus \n",
+       seq_printf(s, "%p->%s [%d] %s NIC 0x%x q %d conn %c purg %d last %d@%lldms dgram %d@%dms reconn %dms to %lus \n",
                peer, libcfs_nid2str(peer->gnp_nid),
                atomic_read(&peer->gnp_refcount),
                (peer->gnp_state == GNILND_PEER_DOWN) ? "down" :
@@ -1277,7 +1277,7 @@ kgnilnd_peer_seq_show(struct seq_file *s, void *iter)
                conn_str,
                purg_count,
                peer->gnp_last_errno,
-               jiffies_to_msecs(jiffies - peer->gnp_last_alive),
+               (ktime_get_seconds() - peer->gnp_last_alive) * MSEC_PER_SEC,
                peer->gnp_last_dgram_errno,
                jiffies_to_msecs(jiffies - peer->gnp_last_dgram_time),
                peer->gnp_reconnect_interval != 0
index e993199..1e36746 100644 (file)
@@ -1536,7 +1536,7 @@ ksocknal_peer_failed(struct ksock_peer_ni *peer_ni)
 
        if (notify)
                lnet_notify(peer_ni->ksnp_ni, peer_ni->ksnp_id.nid, 0,
-                           cfs_time_seconds(last_alive)); /* to jiffies */
+                           last_alive);
 }
 
 void
index 59171f3..43d178a 100644 (file)
@@ -3282,6 +3282,11 @@ LNetCtl(unsigned int cmd, void *arg)
        case IOC_LIBCFS_NOTIFY_ROUTER: {
                time64_t deadline = ktime_get_real_seconds() - data->ioc_u64[0];
 
+               /* The deadline passed in by the user should be some time in
+                * seconds in the future since the UNIX epoch. We have to map
+                * that deadline to the wall clock.
+                */
+               deadline += ktime_get_seconds();
                return lnet_notify(NULL, data->ioc_nid, data->ioc_flags,
                                   deadline);
        }