Commit 9f0e4c2b authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

staging: lustre: 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.
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2e20a07f
...@@ -1214,6 +1214,7 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf) ...@@ -1214,6 +1214,7 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf)
struct lnet_lnd *lnd; struct lnet_lnd *lnd;
struct lnet_tx_queue *tq; struct lnet_tx_queue *tq;
int i; int i;
u32 seed;
lnd_type = LNET_NETTYP(LNET_NIDNET(ni->ni_nid)); lnd_type = LNET_NETTYP(LNET_NIDNET(ni->ni_nid));
...@@ -1352,6 +1353,12 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf) ...@@ -1352,6 +1353,12 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf)
tq->tq_credits = lnet_ni_tq_credits(ni); tq->tq_credits = lnet_ni_tq_credits(ni);
} }
/* Nodes with small feet have little entropy. The NID for this
* node gives the most entropy in the low bits.
*/
seed = LNET_NIDADDR(ni->ni_nid);
add_device_randomness(&seed, sizeof(seed));
CDEBUG(D_LNI, "Added LNI %s [%d/%d/%d/%d]\n", CDEBUG(D_LNI, "Added LNI %s [%d/%d/%d/%d]\n",
libcfs_nid2str(ni->ni_nid), ni->ni_peertxcredits, libcfs_nid2str(ni->ni_nid), ni->ni_peertxcredits,
lnet_ni_tq_credits(ni) * LNET_CPT_NUMBER, lnet_ni_tq_credits(ni) * LNET_CPT_NUMBER,
......
...@@ -85,8 +85,7 @@ MODULE_ALIAS_FS("lustre"); ...@@ -85,8 +85,7 @@ MODULE_ALIAS_FS("lustre");
static int __init lustre_init(void) static int __init lustre_init(void)
{ {
struct lnet_process_id lnet_id; int rc;
int i, rc;
BUILD_BUG_ON(sizeof(LUSTRE_VOLATILE_HDR) != BUILD_BUG_ON(sizeof(LUSTRE_VOLATILE_HDR) !=
LUSTRE_VOLATILE_HDR_LEN + 1); LUSTRE_VOLATILE_HDR_LEN + 1);
...@@ -125,20 +124,6 @@ static int __init lustre_init(void) ...@@ -125,20 +124,6 @@ static int __init lustre_init(void)
goto out_debugfs; goto out_debugfs;
} }
/* Nodes with small feet have little entropy. The NID for this
* node gives the most entropy in the low bits
*/
for (i = 0;; i++) {
u32 seed;
if (LNetGetId(i, &lnet_id) == -ENOENT)
break;
if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) {
seed = LNET_NIDADDR(lnet_id.nid);
add_device_randomness(&seed, sizeof(seed));
}
}
rc = vvp_global_init(); rc = vvp_global_init();
if (rc != 0) if (rc != 0)
goto out_sysfs; goto out_sysfs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment