Whamcloud - gitweb
LU-12514 LNet: get entropy from nid when nid set. 59/47159/2
authorMr. NeilBrown <neilb@suse.de>
Wed, 27 Apr 2022 18:33:57 +0000 (14:33 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Jun 2022 05:59:13 +0000 (05:59 +0000)
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 <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-on: https://review.whamcloud.com/47159
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/api-ni.c
lustre/llite/super25.c

index ec5bf53..1af3c56 100644 (file)
@@ -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,
index 1cd850e..4dc69e3 100644 (file)
@@ -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);