Whamcloud - gitweb
LU-13127 libcfs: make noise to console if CRC32 is missing 14/37214/9
authorAlex Zhuravlev <bzzz@whamcloud.com>
Mon, 13 Jan 2020 09:37:44 +0000 (12:37 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 14 Apr 2020 08:08:59 +0000 (08:08 +0000)
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 <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/37214
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
libcfs/autoconf/lustre-libcfs.m4
libcfs/libcfs/linux-crypto.c

index a46d3f8..4db29eb 100644 (file)
@@ -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
index 928117e..bcacaa3 100644 (file)
@@ -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);
        }