Whamcloud - gitweb
LU-12511 build: make fscrypt detection work for native client 49/58949/3
authorJames Simmons <jsimmons@infradead.org>
Fri, 25 Apr 2025 00:03:18 +0000 (20:03 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 21 May 2025 05:16:38 +0000 (05:16 +0000)
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 <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58949
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
config/lustre-core.m4

index 25eab06..ee5a456 100644 (file)
@@ -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 <strings.h>
        #include <linux/fscrypt.h>
-],[
-       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.])