From 69525467166c2557834b1150ce3982ecfb47e811 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 24 Apr 2025 20:03:18 -0400 Subject: [PATCH] LU-12511 build: make fscrypt detection work for native client The current code when built against the native client fails to detect fscrypt so no support is built into the tools. This patch makes the LC_FSCRUPT_SUPPORT test against the fscrypt UAPI header to see if its at a level we can support natively. Test-Parameters: trivial Change-Id: Ic65f9dca637edd9194acbcf90e02da9681b26ab0 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58949 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Timothy Day Reviewed-by: Oleg Drokin --- config/lustre-core.m4 | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/config/lustre-core.m4 b/config/lustre-core.m4 index 25eab06..ee5a456 100644 --- a/config/lustre-core.m4 +++ b/config/lustre-core.m4 @@ -2995,21 +2995,27 @@ AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [ ]) ]) # LC_LM_COMPARE_OWNER_EXISTS -# -# LC_FSCRYPT_SUPPORT -# -# 5.4 introduced fscrypt encryption policies v2 -# AC_DEFUN([LC_FSCRYPT_SUPPORT], [ -LB_CHECK_COMPILE([for fscrypt in-kernel support], -fscrypt_support, [ - #define __FS_HAS_ENCRYPTION 0 +saved_flags="$CFLAGS" +CFLAGS="-Werror" +AC_MSG_CHECKING([for fscrypt in-kernel support]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + #include #include -],[ - fscrypt_ioctl_get_policy_ex(NULL, NULL); -],[ + + int main(void) { + struct fscrypt_policy_v2 policy; + + bzero(&policy, sizeof(policy)); + return 0; + } +])],[ has_fscrypt_support="yes" + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) ]) +CFLAGS="$saved_flags" ]) # LC_FSCRYPT_SUPPORT used by LC_CONFIG_CRYPTO # @@ -5898,7 +5904,7 @@ AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno], [ ) LC_IS_ENCRYPTED LC_FSCRYPT_SUPPORT]) -AS_IF([test "x$enable_crypto" = xin-kernel], [ +AS_IF([test "x$enable_crypto" = xin-kernel -o "x$enable_modules" = xno -a "x$enable_dist" = xno], [ AS_IF([test "x$has_fscrypt_support" = xyes], [ AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via in-kernel fscrypt])], [ AC_MSG_ERROR([Lustre client crypto cannot be enabled via in-kernel fscrypt.]) -- 1.8.3.1