Whamcloud - gitweb
LU-9019 socklnd: use 64-bit incarnation time stamp 90/25690/3
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 9 Mar 2017 18:06:29 +0000 (13:06 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 23 Mar 2017 01:40:34 +0000 (01:40 +0000)
ksnn_incarnation is a 64-bit value, but using timeval to compute
it will cause an overflow in 2038. This changes it to use
ktime_get_real_ns() instead.

Change-Id: I9a0b1f2c35d04d8dc2c8fd5e17e19583c8af5ff0
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/25690
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/klnds/socklnd/socklnd.c

index 2b8854c..99f9781 100644 (file)
@@ -2348,20 +2348,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 +2780,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;