Whamcloud - gitweb
LU-4423 lnet: Better cookie gen 82/24682/6
authorTina Ruchandani <ruchandani.tina@gmail.com>
Thu, 5 Jan 2017 14:53:30 +0000 (09:53 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 24 Jan 2017 05:23:34 +0000 (05:23 +0000)
commit2be59ff6bffdbaece48d35cd678bc9ee28ddf4f3
treefdbeb31f8ff76996164cbe8c50294ad6f34b3815
parent8a13ffb4a1eafff18cb891fdc812afaf09136f29
LU-4423 lnet: Better cookie gen

api-ni.c uses do_gettimeofday to get a 'cookie' or timestamp.
This patch replaces it with ktime_get_ns for the following reasons:

1. ktime_get_ns returns a __u64 which is safer than 'struct timeval'
   which will overflow on 32-bit systems in year 2038 and beyond.
2. Improved resolution: nsecs instead of usecs.
3. Reduced compute: ktime_get_ns is faster than the multiply/add
   combination used in this function

Linux-commit: 9056be30542bfff51190bdda67088f319cf4c9f5

Drop unneeded wrapper function Remove the function
lnet_create_interface_cookie() and replace its call
with the function ktime_get_ns().

Linux-commit: 7bcd831b8579212303ec7c30e975432b914493dc

The ln_interface_cookie is used to ensure that a node can tell whether
the following sequence of events has happened:

node sends GET or PUT to peer
node is rebooted
peer sends REPLY or ACK to node

The ln_interface_cookie is set once, when LNet starts, and remains
unchanged afterwards. To avoid accidentally obtaining the same cookie
after a reboot, the code generated ths cookie using ktime_get_ns().
Once generated, the value of the cookie is not interpreted, only
compared for equality. Olaf Weber reported that due to the use of
ktime_get_ns() a small chance exist of generating a cookie of identical
value across reboots. Using ktime_get_real_ns() removes any chance of
this from happening.

Change-Id: I159a0ff2573afb87f279a8e8f282b0ac076d9bf3
Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/24682
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Olaf Weber <olaf@sgi.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/linux/linux-time.h
lnet/lnet/api-ni.c