From e1a0f602a60855d90c7947b06fb248d66e178945 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Mon, 13 Jan 2020 12:37:44 +0300 Subject: [PATCH] LU-13127 libcfs: make noise to console if CRC32 is missing if CRC32 support is disabled in the kernel by mistake, then early replies don't work and the actual cause isn't obvious. the patch also adds a check at configure to ensure that target kernel support CRC32 crypto function. Change-Id: I17999ae89eaf6c4fb7c7db12200e2092cc6afea8 Signed-off-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/37214 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons --- libcfs/autoconf/lustre-libcfs.m4 | 15 +++++++++++++++ libcfs/libcfs/linux-crypto.c | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index a46d3f8..4db29eb 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -1164,6 +1164,20 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # LIBCFS_CACHE_DETAIL_WRITERS # +# LIBCFS_CONFIG_CRYPTO_CRC32 +# +# The kernel must support CONFIG_CRYPTO_CRC32 to RPC checksumming +# +AC_DEFUN([LIBCFS_CONFIG_CRYPTO_CRC32], [ +LB_CHECK_CONFIG_IM([CRYPTO_CRC32], [], + [AC_MSG_ERROR([ + +Lustre requires that CONFIG_CRYPTO_CRC32 is enabled in your kernel. +])]) +]) # LIBCFS_CONFIG_CRYPTO_CRC32 + + +# # LIBCFS_PROG_LINUX # # LibCFS linux kernel checks @@ -1172,6 +1186,7 @@ AC_DEFUN([LIBCFS_PROG_LINUX], [ AC_MSG_NOTICE([LibCFS kernel checks ==============================================================================]) LIBCFS_CONFIG_PANIC_DUMPLOG +LIBCFS_CONFIG_CRYPTO_CRC32 # 3.11 LIBCFS_KTIME_GET_TS64 diff --git a/libcfs/libcfs/linux-crypto.c b/libcfs/libcfs/linux-crypto.c index 928117e..bcacaa3 100644 --- a/libcfs/libcfs/linux-crypto.c +++ b/libcfs/libcfs/linux-crypto.c @@ -100,8 +100,9 @@ static int cfs_crypto_hash_alloc(enum cfs_crypto_hash_alg hash_alg, CRYPTO_ALG_ASYNC); } if (IS_ERR(tfm)) { - CDEBUG(D_INFO, "Failed to alloc crypto hash %s\n", - (*type)->cht_name); + CDEBUG_LIMIT(PTR_ERR(tfm) == -ENOMEM ? D_ERROR : D_INFO, + "Failed to alloc crypto hash %s: rc = %d\n", + (*type)->cht_name, (int)PTR_ERR(tfm)); return PTR_ERR(tfm); } -- 1.8.3.1