From 5a6725d19d4037026d7cab2442b0c639d1511e5d Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 26 Apr 2023 11:12:48 -0400 Subject: [PATCH] LU-16739 uapi: make lustre_disk.h buildable in user land The rbac work introduced a regression that makes lustre_disk.h UAPI header no longer buildable in user land. This is causing sanity test 400b to fail with: lustre_disk.h:266:18: error: 'LUSTRE_NODEMAP_NAME_LENGTH' undeclared here (not in a function) char ncr_name[LUSTRE_NODEMAP_NAME_LENGTH + 1]; ^~~~~~~~~~~~~~~~~~~~~~~~~~ lustre_disk.h:267:20: error: 'ncr_flags' is narrower than values of its type [-Werror] enum nm_flag_bits ncr_flags:8; ^~~~~~~~~ lustre_disk.h:267:20: error: field 'ncr_flags' has incomplete type lustre_disk.h:268:21: error: 'ncr_flags2' is narrower than values of its type [-Werror] enum nm_flag2_bits ncr_flags2:8; ^~~~~~~~~~ lustre_disk.h:268:21: error: field 'ncr_flags2' has incomplete type lustre_disk.h:277:2: error: unknown type name 'lnet_nid_t' lnet_nid_t nrr_start_nid; ^~~~~~~~~~ lustre/lustre_disk.h:278:2: error: unknown type name 'lnet_nid_t' lnet_nid_t nrr_end_nid; ^~~~~~~~~~ To fix this move several pieces of nodemap handling from lustre_idl.h to lustre_disk.h. The git commit 5e6a51787fef20b849682d8c49ec9c2beed5c373 for Linux kernel version 6.2.0-rc5 made guid_t only available for kernel code. The only UAPI data structure left is uuid_le. Thankfully MCE requires this otherwise even uuid_le would be removed. We will need to keep an eye on this. Test-Parameters: trivial testlist=sanity envdefinitions=ONLY=400b Fixes: 5e48ffca322 ("LU-16524 nodemap: add rbac property to nodemap") Change-Id: I4b962572ec2bf76159a17807c564390ded00d630 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50641 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Arshad Hussain Reviewed-by: Sebastien Buisson Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin --- lustre/include/lustre_nodemap.h | 2 +- lustre/include/uapi/linux/lustre/lustre_disk.h | 21 ++++++++++++++++++++- lustre/include/uapi/linux/lustre/lustre_idl.h | 17 ----------------- lustre/ptlrpc/nodemap_storage.c | 1 + lustre/utils/gss/sk_utils.h | 1 + 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/lustre/include/lustre_nodemap.h b/lustre/include/lustre_nodemap.h index bfb29e7..8ff20e6 100644 --- a/lustre/include/lustre_nodemap.h +++ b/lustre/include/lustre_nodemap.h @@ -30,7 +30,7 @@ #ifndef _LUSTRE_NODEMAP_H #define _LUSTRE_NODEMAP_H -#include +#include #define LUSTRE_NODEMAP_NAME "nodemap" diff --git a/lustre/include/uapi/linux/lustre/lustre_disk.h b/lustre/include/uapi/linux/lustre/lustre_disk.h index 3f02430..94978ff 100644 --- a/lustre/include/uapi/linux/lustre/lustre_disk.h +++ b/lustre/include/uapi/linux/lustre/lustre_disk.h @@ -42,6 +42,7 @@ */ #include #include +#include /* for lnet_nid_t */ /****************** on-disk files ********************/ @@ -254,6 +255,24 @@ enum nodemap_idx_type { NODEMAP_GLOBAL_IDX = 15, /* stores nodemap activation status */ }; +#define LUSTRE_NODEMAP_NAME_LENGTH 16 + +/* lu_nodemap flags */ +enum nm_flag_bits { + NM_FL_ALLOW_ROOT_ACCESS = 0x1, + NM_FL_TRUST_CLIENT_IDS = 0x2, + NM_FL_DENY_UNKNOWN = 0x4, + NM_FL_MAP_UID = 0x8, + NM_FL_MAP_GID = 0x10, + NM_FL_ENABLE_AUDIT = 0x20, + NM_FL_FORBID_ENCRYPT = 0x40, + NM_FL_MAP_PROJID = 0x80, +}; + +enum nm_flag2_bits { + NM_FL2_READONLY_MOUNT = 0x1, +}; + /* Nodemap records, uses 32 byte record length. * New nodemap config records can be added into NODEMAP_CLUSTER_IDX * with a new nk_cluster_subid value, as long as the records are @@ -388,7 +407,7 @@ enum scrub_param { }; struct scrub_file { - guid_t sf_uuid; /* 128-bit uuid for volume */ + uuid_le sf_uuid; /* 128-bit uuid for volume */ __u64 sf_flags; /* see 'enum scrub_flags' */ __u32 sf_magic; /* SCRUB_MAGIC_V1/V2 */ __u16 sf_status; /* see 'enum scrub_status' */ diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 6bffc36..0ace06f 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -3674,23 +3674,6 @@ struct llog_update_record { SELINUX_POLICY_VER_LEN + \ SELINUX_POLICY_HASH_LEN + 3) -#define LUSTRE_NODEMAP_NAME_LENGTH 16 - -/* lu_nodemap flags */ -enum nm_flag_bits { - NM_FL_ALLOW_ROOT_ACCESS = 0x1, - NM_FL_TRUST_CLIENT_IDS = 0x2, - NM_FL_DENY_UNKNOWN = 0x4, - NM_FL_MAP_UID = 0x8, - NM_FL_MAP_GID = 0x10, - NM_FL_ENABLE_AUDIT = 0x20, - NM_FL_FORBID_ENCRYPT = 0x40, - NM_FL_MAP_PROJID = 0x80, -}; -enum nm_flag2_bits { - NM_FL2_READONLY_MOUNT = 0x1, -}; - /** enums containing the types of ids contained in a nodemap * kept so other modules (mgs, mdt, etc) can define the type * of search easily diff --git a/lustre/ptlrpc/nodemap_storage.c b/lustre/ptlrpc/nodemap_storage.c index 73a6f31..48f305f 100644 --- a/lustre/ptlrpc/nodemap_storage.c +++ b/lustre/ptlrpc/nodemap_storage.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include diff --git a/lustre/utils/gss/sk_utils.h b/lustre/utils/gss/sk_utils.h index 43d04c6..0fb3af3 100644 --- a/lustre/utils/gss/sk_utils.h +++ b/lustre/utils/gss/sk_utils.h @@ -34,6 +34,7 @@ #include #endif #include +#include #include #include #include -- 1.8.3.1