[lustre-devel] [PATCH 3/8] staging: lustre: ksocklnd: use ktime_get_real_ns for ksnn_incarnation

James Simmons jsimmons at infradead.org
Sun Jun 24 14:53:47 PDT 2018


The value generated for ksnn_incarnation is used as a unique identifier.
Their exist a small chance that two nodes could end up with the same
value but if we use ktime_get_real_ns() instead the change is even less
so.

Signed-off-by: James Simmons <uja.ornl at yahoo.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-9019
Reviewed-on: https://review.whamcloud.com/25690
Reviewed-by: Doug Oucharek <dougso at me.com>
Reviewed-by: Olaf Weber <olaf at sgi.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin at intel.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index f01b34a..694f1d0 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -2369,15 +2369,6 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id)
 	module_put(THIS_MODULE);
 }
 
-static __u64
-ksocknal_new_incarnation(void)
-{
-	/* The incarnation number is the time this module loaded and it
-	 * identifies this particular instance of the socknal.
-	 */
-	return ktime_get_ns();
-}
-
 static int
 ksocknal_base_startup(void)
 {
@@ -2810,7 +2801,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id)
 		goto fail_0;
 
 	spin_lock_init(&net->ksnn_lock);
-	net->ksnn_incarnation = ksocknal_new_incarnation();
+	net->ksnn_incarnation = ktime_get_real_ns();
 	ni->ni_data = net;
 	ni->ni_peertimeout    = *ksocknal_tunables.ksnd_peertimeout;
 	ni->ni_maxtxcredits   = *ksocknal_tunables.ksnd_credits;
-- 
1.8.3.1



More information about the lustre-devel mailing list