From d05fee1919911e56f6ef7eb018c90ae19fa415aa Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 14 Jun 2019 21:21:15 -0400 Subject: [PATCH] LU-9859 libcfs: replace cfs_get_random_bytes calls with get_random_byte() The cfs_get_random_bytes() interface adds nothing of value to get_random_byte() (which it uses internally). So just use the standard interface. Linux-commit: e904f839cdb04d1b314753a83a6e58146e315c66 Change-Id: I48e153d7658f0f616afe4e884faeb09c2dbdcd03 Signed-off-by: NeilBrown Signed-off-by: Greg Kroah-Hartman Reviewed-on: https://review.whamcloud.com/35234 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Shaun Tancheff Reviewed-by: Andreas Dilger Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin --- contrib/scripts/spelling.txt | 1 + lustre/lod/lod_object.c | 2 +- lustre/obdclass/lustre_handles.c | 4 +++- lustre/ptlrpc/client.c | 4 +++- lustre/ptlrpc/gss/gss_krb5_mech.c | 5 +++-- lustre/ptlrpc/gss/gss_svc_upcall.c | 3 ++- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/contrib/scripts/spelling.txt b/contrib/scripts/spelling.txt index 9d9da6c..14c07ba 100644 --- a/contrib/scripts/spelling.txt +++ b/contrib/scripts/spelling.txt @@ -22,6 +22,7 @@ cfs_atomic_sub||atomic_sub cfs_atomic_sub_and_test||atomic_sub_and_test cfs_atomic_sub_return||atomic_sub_return cfs_atomic_t||atomic_t +cfs_get_random_bytes/get_random_bytes cfs_hash_bd_t||struct cfs_hash_bd cfs_hash_bucket_t||struct cfs_hash_bucket cfs_hash_cond_arg_t||struct cfs_hash_cond_arg diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 50b40b8..789a4a1 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -6555,7 +6555,7 @@ static int lod_declare_update_rdonly(const struct lu_env *env, if (lo->ldo_layout_gen > (LCME_ID_MAX >> 1)) { __u32 layout_version; - cfs_get_random_bytes(&layout_version, sizeof(layout_version)); + get_random_bytes(&layout_version, sizeof(layout_version)); lo->ldo_layout_gen = layout_version & 0xffff; } diff --git a/lustre/obdclass/lustre_handles.c b/lustre/obdclass/lustre_handles.c index fabd20b..6122f34 100644 --- a/lustre/obdclass/lustre_handles.c +++ b/lustre/obdclass/lustre_handles.c @@ -36,6 +36,8 @@ #define DEBUG_SUBSYSTEM S_CLASS +#include + #include #include #include @@ -215,7 +217,7 @@ int class_handle_init(void) spin_lock_init(&bucket->lock); } - cfs_get_random_bytes(&handle_base, sizeof(handle_base)); + get_random_bytes(&handle_base, sizeof(handle_base)); LASSERT(handle_base != 0ULL); return 0; diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index a0eade5..bc983ac 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -35,6 +35,8 @@ #define DEBUG_SUBSYSTEM S_RPC #include +#include + #include #include #include @@ -3334,7 +3336,7 @@ void ptlrpc_init_xid(void) spin_lock_init(&ptlrpc_last_xid_lock); if (now < YEAR_2004) { - cfs_get_random_bytes(&ptlrpc_last_xid, sizeof(ptlrpc_last_xid)); + get_random_bytes(&ptlrpc_last_xid, sizeof(ptlrpc_last_xid)); ptlrpc_last_xid >>= 2; ptlrpc_last_xid |= (1ULL << 61); } else { diff --git a/lustre/ptlrpc/gss/gss_krb5_mech.c b/lustre/ptlrpc/gss/gss_krb5_mech.c index 4f4e0f2..39ef0c2 100644 --- a/lustre/ptlrpc/gss/gss_krb5_mech.c +++ b/lustre/ptlrpc/gss/gss_krb5_mech.c @@ -51,6 +51,7 @@ #define DEBUG_SUBSYSTEM S_SEC #include #include +#include #include #include #include @@ -987,7 +988,7 @@ __u32 gss_wrap_kerberos(struct gss_ctx *gctx, fill_krb5_header(kctx, khdr, 1); /* generate confounder */ - cfs_get_random_bytes(conf, ke->ke_conf_size); + get_random_bytes(conf, ke->ke_conf_size); /* get encryption blocksize. note kc_keye might not associated with * a tfm, currently only for arcfour-hmac */ @@ -1160,7 +1161,7 @@ __u32 gss_wrap_bulk_kerberos(struct gss_ctx *gctx, fill_krb5_header(kctx, khdr, 1); /* generate confounder */ - cfs_get_random_bytes(conf, ke->ke_conf_size); + get_random_bytes(conf, ke->ke_conf_size); /* get encryption blocksize. note kc_keye might not associated with * a tfm, currently only for arcfour-hmac */ diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index bc9f269..6392e76 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -1088,7 +1089,7 @@ int __init gss_init_svc_upcall(void) * sequence number checking, thus no chance to sent error notification * back to clients. */ - cfs_get_random_bytes(&__ctx_index, sizeof(__ctx_index)); + get_random_bytes(&__ctx_index, sizeof(__ctx_index)); rc = _cache_register_net(&rsi_cache, &init_net); if (rc != 0) -- 1.8.3.1