Whamcloud - gitweb
LU-16739 uapi: make lustre_disk.h buildable in user land 41/50641/12
authorJames Simmons <jsimmons@infradead.org>
Wed, 26 Apr 2023 15:12:48 +0000 (11:12 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 9 May 2023 05:47:18 +0000 (05:47 +0000)
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 <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50641
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_nodemap.h
lustre/include/uapi/linux/lustre/lustre_disk.h
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/ptlrpc/nodemap_storage.c
lustre/utils/gss/sk_utils.h

index bfb29e7..8ff20e6 100644 (file)
@@ -30,7 +30,7 @@
 #ifndef _LUSTRE_NODEMAP_H
 #define _LUSTRE_NODEMAP_H
 
-#include <uapi/linux/lustre/lustre_idl.h>
+#include <uapi/linux/lustre/lustre_disk.h>
 
 #define LUSTRE_NODEMAP_NAME "nodemap"
 
index 3f02430..94978ff 100644 (file)
@@ -42,6 +42,7 @@
  */
 #include <linux/types.h>
 #include <linux/uuid.h>
+#include <linux/lnet/lnet-types.h> /* 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' */
index 6bffc36..0ace06f 100644 (file)
@@ -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
index 73a6f31..48f305f 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/types.h>
 #include <uapi/linux/lnet/lnet-types.h>
 #include <uapi/linux/lustre/lustre_idl.h>
+#include <uapi/linux/lustre/lustre_disk.h>
 #include <dt_object.h>
 #include <lu_object.h>
 #include <lustre_net.h>
index 43d04c6..0fb3af3 100644 (file)
@@ -34,6 +34,7 @@
 #include <keyutils.h>
 #endif
 #include <linux/lustre/lustre_idl.h>
+#include <linux/lustre/lustre_disk.h>
 #include <openssl/dh.h>
 #include <openssl/evp.h>
 #include <openssl/hmac.h>