From: Mr. NeilBrown Date: Wed, 27 Apr 2022 18:33:57 +0000 (-0400) Subject: LU-12514 LNet: get entropy from nid when nid set. X-Git-Tag: 2.15.51~132 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ab0a6a9a066a7b175ff48b9b679ba0fb59416f9b LU-12514 LNet: get entropy from nid when nid set. When the 'lustre' module is loaded, it gets a list of net devices and uses the node ids to add entropy to the prng. This means that the network interfaces need to be configured before the module is loaded, which prevents the module from being compiled into a monolithic kernel. So move this entropy addition to the moment when the interface is imported to LNet and the node id is first known. Linux-commit: 9f0e4c2b823b0cf5744a448d3b23cd618b86db41 Change-Id: I1c9b4f9a5c01de5b14188ccd9330b51eeafd43ac Signed-off-by: Mr. NeilBrown Signed-off-by: Greg Kroah-Hartman Reviewed-on: https://review.whamcloud.com/47159 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index ec5bf53..1af3c56 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -2563,6 +2563,11 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_lnd_tunables *tun) lnet_ni_tq_credits(ni) * ni->ni_ncpts); atomic_set(&ni->ni_healthv, LNET_MAX_HEALTH_VALUE); + /* Nodes with small feet have little entropy. The NID for this + * node gives the most entropy in the low bits. + */ + add_device_randomness(&ni->ni_nid, sizeof(ni->ni_nid)); + CDEBUG(D_LNI, "Added LNI %s [%d/%d/%d/%d]\n", libcfs_nidstr(&ni->ni_nid), ni->ni_net->net_tunables.lct_peer_tx_credits, diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 1cd850e..4dc69e3 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -219,8 +219,7 @@ MODULE_ALIAS_FS("lustre"); static int __init lustre_init(void) { - struct lnet_processid lnet_id; - int i, rc; + int rc; unsigned long lustre_inode_cache_flags; BUILD_BUG_ON(sizeof(LUSTRE_VOLATILE_HDR) != @@ -260,15 +259,6 @@ static int __init lustre_init(void) if (rc) GOTO(out_cache, rc); - /* Nodes with small feet have little entropy. The NID for this - * node gives the most entropy in the low bits. */ - for (i = 0;; i++) { - if (LNetGetId(i, &lnet_id) == -ENOENT) - break; - - add_device_randomness(&lnet_id.nid, sizeof(lnet_id.nid)); - } - rc = vvp_global_init(); if (rc != 0) GOTO(out_tunables, rc);