diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 6885d7cd094f5aa282522005b4c36324891b9343..f5b21c51c49c483cf0ed618abfa532a9c8010af0 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -238,28 +238,25 @@ lnet_find_net_locked(__u32 net) static void lnet_shuffle_seed(void) { static int seeded; - __u32 lnd_type, seed[2]; - struct timespec64 ts; struct lnet_ni *ni; if (seeded) return; - cfs_get_random_bytes(seed, sizeof(seed)); - /* * Nodes with small feet have little entropy * the NID for this node gives the most entropy in the low bits */ list_for_each_entry(ni, &the_lnet.ln_nis, ni_list) { - lnd_type = LNET_NETTYP(LNET_NIDNET(ni->ni_nid)); + __u32 lnd_type, seed; - if (lnd_type != LOLND) - seed[0] ^= (LNET_NIDADDR(ni->ni_nid) | lnd_type); + lnd_type = LNET_NETTYP(LNET_NIDNET(ni->ni_nid)); + if (lnd_type != LOLND) { + seed = (LNET_NIDADDR(ni->ni_nid) | lnd_type); + add_device_randomness(&seed, sizeof(seed)); + } } - ktime_get_ts64(&ts); - cfs_srand(ts.tv_sec ^ seed[0], ts.tv_nsec ^ seed[1]); seeded = 1; } diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index 10105339790e6c20079c88b751efa9359a58c6d0..9b0bb3541a84a8a95f2d26173a7a3cbaef87f6da 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -86,8 +86,7 @@ MODULE_ALIAS_FS("lustre"); static int __init lustre_init(void) { struct lnet_process_id lnet_id; - struct timespec64 ts; - int i, rc, seed[2]; + int i, rc; BUILD_BUG_ON(sizeof(LUSTRE_VOLATILE_HDR) != LUSTRE_VOLATILE_HDR_LEN + 1); @@ -126,22 +125,20 @@ static int __init lustre_init(void) goto out_debugfs; } - cfs_get_random_bytes(seed, sizeof(seed)); - /* 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[0] ^= LNET_NIDADDR(lnet_id.nid); + if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) { + seed = LNET_NIDADDR(lnet_id.nid); + add_device_randomness(&seed, sizeof(seed)); + } } - ktime_get_ts64(&ts); - cfs_srand(ts.tv_sec ^ seed[0], ts.tv_nsec ^ seed[1]); - rc = vvp_global_init(); if (rc != 0) goto out_sysfs; diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c index 71329adc0318c4879fd2b1dda8035be98b100541..d1b6c2f134d70f80f806bbb367f1c87aa334b82d 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c @@ -181,8 +181,6 @@ EXPORT_SYMBOL(class_handle_free_cb); int class_handle_init(void) { struct handle_bucket *bucket; - struct timespec64 ts; - int seed[2]; LASSERT(!handle_hash); @@ -198,11 +196,6 @@ int class_handle_init(void) spin_lock_init(&bucket->lock); } - /** bug 21430: add randomness to the initial base */ - cfs_get_random_bytes(seed, sizeof(seed)); - ktime_get_ts64(&ts); - cfs_srand(ts.tv_sec ^ seed[0], ts.tv_nsec ^ seed[1]); - cfs_get_random_bytes(&handle_base, sizeof(handle_base)); LASSERT(handle_base != 0ULL);