Whamcloud - gitweb
LU-12937 utils: update wirecheck for new values 06/36706/5
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 7 Nov 2019 17:47:21 +0000 (10:47 -0700)
committerOleg Drokin <green@whamcloud.com>
Sat, 14 Dec 2019 05:57:14 +0000 (05:57 +0000)
Update the wirecheck.c file to handle changes that were made directly
in the wiretest.c files.  This allows the wiretrst.c file to be
regenerated properly without losing checks for new constants, and
fixes issues with some #defines that were changed to named enums.

Code under CONFIG_FS_POSIX_ACL in utils/wirecheck.c does not build in
userspace if the <linux/posix_acl_xattr.h> header is not available.
It should be enough that we are checking this in ptlrpc/wirecheck.c
since struct posix_acl_xattr_entry and posix_acl_xattr_header come
from the kernel anyway, so a userspace check is mostly redundant.

Test-Parameters: trivial
Fixes: 1fd63fcb045c ("LU-12090 utils: lfs rmfid")
Fixes: b4375f5fc66c ("LU-11444 ptlrpc: Add increasing XIDs CONNECT2 flag")
Fixes: 19b2bc9bbc25 ("LU-6142 lustre: introduce CONFIG_LUSTRE_FS_POSIX_ACL")
Fixes: 3611352b699c ("LU-11285 mdt: improve IBITS lock definitions")
Fixes: 68635c3d9b31 ("LU-11963 osd: Add nonrotational flag to statfs")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I4945d6e2e8d7f4f98530e6dafd43bcf93735a5b1
Reviewed-on: https://review.whamcloud.com/36706
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Artem Blagodarenko <c17828@cray.com>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wirehdr.c
lustre/utils/wiretest.c

index 79eb9c2..aa40cf6 100644 (file)
@@ -1948,20 +1948,20 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct obd_statfs, os_spare9));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare9) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare9));
                 (long long)(int)offsetof(struct obd_statfs, os_spare9));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare9) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare9));
-       LASSERTF(OS_STATE_DEGRADED == 0x1, "found %lld\n",
-                (long long)OS_STATE_DEGRADED);
-       LASSERTF(OS_STATE_READONLY == 0x2, "found %lld\n",
-                (long long)OS_STATE_READONLY);
-       LASSERTF(OS_STATE_NOPRECREATE == 0x4, "found %lld\n",
-                (long long)OS_STATE_NOPRECREATE);
-       LASSERTF(OS_STATE_ENOSPC == 0x20, "found %lld\n",
-                (long long)OS_STATE_ENOSPC);
-       LASSERTF(OS_STATE_ENOINO == 0x40, "found %lld\n",
-                (long long)OS_STATE_ENOINO);
-       LASSERTF(OS_STATE_SUM == 0x100, "found %lld\n",
-                (long long)OS_STATE_SUM);
-       LASSERTF(OS_STATE_NONROT == 0x200, "found %lld\n",
-                (long long)OS_STATE_NONROT);
+       LASSERTF(OS_STATE_DEGRADED == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_DEGRADED);
+       LASSERTF(OS_STATE_READONLY == 0x00000002UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_READONLY);
+       LASSERTF(OS_STATE_NOPRECREATE == 0x00000004UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_NOPRECREATE);
+       LASSERTF(OS_STATE_ENOSPC == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_ENOSPC);
+       LASSERTF(OS_STATE_ENOINO == 0x00000040UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_ENOINO);
+       LASSERTF(OS_STATE_SUM == 0x00000100UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_SUM);
+       LASSERTF(OS_STATE_NONROT == 0x00000200UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_NONROT);
 
        /* Checks for struct obd_ioobj */
        LASSERTF((int)sizeof(struct obd_ioobj) == 24, "found %lld\n",
 
        /* Checks for struct obd_ioobj */
        LASSERTF((int)sizeof(struct obd_ioobj) == 24, "found %lld\n",
@@ -2518,20 +2518,20 @@ void lustre_assert_wire_constants(void)
                (unsigned)LUSTRE_DIRECTIO_FL);
        LASSERTF(LUSTRE_INLINE_DATA_FL == 0x10000000UL, "found 0x%.8xUL\n",
                (unsigned)LUSTRE_INLINE_DATA_FL);
                (unsigned)LUSTRE_DIRECTIO_FL);
        LASSERTF(LUSTRE_INLINE_DATA_FL == 0x10000000UL, "found 0x%.8xUL\n",
                (unsigned)LUSTRE_INLINE_DATA_FL);
-       LASSERTF(MDS_INODELOCK_LOOKUP == 0x000001, "found 0x%.8x\n",
-               MDS_INODELOCK_LOOKUP);
-       LASSERTF(MDS_INODELOCK_UPDATE == 0x000002, "found 0x%.8x\n",
-               MDS_INODELOCK_UPDATE);
-       LASSERTF(MDS_INODELOCK_OPEN == 0x000004, "found 0x%.8x\n",
-               MDS_INODELOCK_OPEN);
-       LASSERTF(MDS_INODELOCK_LAYOUT == 0x000008, "found 0x%.8x\n",
-               MDS_INODELOCK_LAYOUT);
-       LASSERTF(MDS_INODELOCK_PERM == 0x000010, "found 0x%.8x\n",
-               MDS_INODELOCK_PERM);
-       LASSERTF(MDS_INODELOCK_XATTR == 0x000020, "found 0x%.8x\n",
-               MDS_INODELOCK_XATTR);
-       LASSERTF(MDS_INODELOCK_DOM == 0x000040, "found 0x%.8x\n",
-               MDS_INODELOCK_DOM);
+       LASSERTF(MDS_INODELOCK_LOOKUP == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_LOOKUP);
+       LASSERTF(MDS_INODELOCK_UPDATE == 0x00000002UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_UPDATE);
+       LASSERTF(MDS_INODELOCK_OPEN == 0x00000004UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_OPEN);
+       LASSERTF(MDS_INODELOCK_LAYOUT == 0x00000008UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_LAYOUT);
+       LASSERTF(MDS_INODELOCK_PERM == 0x00000010UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_PERM);
+       LASSERTF(MDS_INODELOCK_XATTR == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_XATTR);
+       LASSERTF(MDS_INODELOCK_DOM == 0x00000040UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_DOM);
 
        /* Checks for struct mdt_ioepoch */
        LASSERTF((int)sizeof(struct mdt_ioepoch) == 24, "found %lld\n",
 
        /* Checks for struct mdt_ioepoch */
        LASSERTF((int)sizeof(struct mdt_ioepoch) == 24, "found %lld\n",
@@ -4629,7 +4629,7 @@ void lustre_assert_wire_constants(void)
        BUILD_BUG_ON(FIEMAP_EXTENT_NO_DIRECT != 0x40000000);
        BUILD_BUG_ON(FIEMAP_EXTENT_NET != 0x80000000);
 
        BUILD_BUG_ON(FIEMAP_EXTENT_NO_DIRECT != 0x40000000);
        BUILD_BUG_ON(FIEMAP_EXTENT_NET != 0x80000000);
 
-#ifdef CONFIG_LUSTRE_FS_POSIX_ACL
+#ifdef CONFIG_FS_POSIX_ACL
        /* Checks for type posix_acl_xattr_entry */
        LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, "found %lld\n",
                 (long long)(int)sizeof(posix_acl_xattr_entry));
        /* Checks for type posix_acl_xattr_entry */
        LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, "found %lld\n",
                 (long long)(int)sizeof(posix_acl_xattr_entry));
@@ -4645,9 +4645,9 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(posix_acl_xattr_entry, e_id));
        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4, "found %lld\n",
                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id));
                 (long long)(int)offsetof(posix_acl_xattr_entry, e_id));
        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4, "found %lld\n",
                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id));
-#endif /* CONFIG_LUSTRE_FS_POSIX_ACL */
+#endif /* CONFIG_FS_POSIX_ACL */
 
 
-#ifdef CONFIG_LUSTRE_FS_POSIX_ACL
+#ifdef CONFIG_FS_POSIX_ACL
        /* Checks for type posix_acl_xattr_header */
        LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, "found %lld\n",
                 (long long)(int)sizeof(posix_acl_xattr_header));
        /* Checks for type posix_acl_xattr_header */
        LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, "found %lld\n",
                 (long long)(int)sizeof(posix_acl_xattr_header));
@@ -4661,7 +4661,7 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0, "found %lld\n",
                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
 #endif /* HAVE_STRUCT_POSIX_ACL_XATTR */
        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0, "found %lld\n",
                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
 #endif /* HAVE_STRUCT_POSIX_ACL_XATTR */
-#endif /* CONFIG_LUSTRE_FS_POSIX_ACL */
+#endif /* CONFIG_FS_POSIX_ACL */
 
        /* Checks for struct link_ea_header */
        LASSERTF((int)sizeof(struct link_ea_header) == 24, "found %lld\n",
 
        /* Checks for struct link_ea_header */
        LASSERTF((int)sizeof(struct link_ea_header) == 24, "found %lld\n",
index a4d6a4b..6696a5b 100644 (file)
@@ -608,6 +608,7 @@ check_obd_connect_data(void)
        CHECK_DEFINE_64X(OBD_CONNECT2_WBC_INTENTS);
        CHECK_DEFINE_64X(OBD_CONNECT2_LOCK_CONVERT);
        CHECK_DEFINE_64X(OBD_CONNECT2_ARCHIVE_ID_ARRAY);
        CHECK_DEFINE_64X(OBD_CONNECT2_WBC_INTENTS);
        CHECK_DEFINE_64X(OBD_CONNECT2_LOCK_CONVERT);
        CHECK_DEFINE_64X(OBD_CONNECT2_ARCHIVE_ID_ARRAY);
+       CHECK_DEFINE_64X(OBD_CONNECT2_INC_XID);
        CHECK_DEFINE_64X(OBD_CONNECT2_SELINUX_POLICY);
        CHECK_DEFINE_64X(OBD_CONNECT2_LSOM);
        CHECK_DEFINE_64X(OBD_CONNECT2_PCC);
        CHECK_DEFINE_64X(OBD_CONNECT2_SELINUX_POLICY);
        CHECK_DEFINE_64X(OBD_CONNECT2_LSOM);
        CHECK_DEFINE_64X(OBD_CONNECT2_PCC);
@@ -881,6 +882,14 @@ check_obd_statfs(void)
        CHECK_MEMBER(obd_statfs, os_spare7);
        CHECK_MEMBER(obd_statfs, os_spare8);
        CHECK_MEMBER(obd_statfs, os_spare9);
        CHECK_MEMBER(obd_statfs, os_spare7);
        CHECK_MEMBER(obd_statfs, os_spare8);
        CHECK_MEMBER(obd_statfs, os_spare9);
+
+       CHECK_VALUE_X(OS_STATE_DEGRADED);
+       CHECK_VALUE_X(OS_STATE_READONLY);
+       CHECK_VALUE_X(OS_STATE_NOPRECREATE);
+       CHECK_VALUE_X(OS_STATE_ENOSPC);
+       CHECK_VALUE_X(OS_STATE_ENOINO);
+       CHECK_VALUE_X(OS_STATE_SUM);
+       CHECK_VALUE_X(OS_STATE_NONROT);
 }
 
 static void
 }
 
 static void
@@ -1132,13 +1141,13 @@ check_mdt_body(void)
        CHECK_VALUE_X(LUSTRE_DIRECTIO_FL);
        CHECK_VALUE_X(LUSTRE_INLINE_DATA_FL);
 
        CHECK_VALUE_X(LUSTRE_DIRECTIO_FL);
        CHECK_VALUE_X(LUSTRE_INLINE_DATA_FL);
 
-       CHECK_DEFINE_X(MDS_INODELOCK_LOOKUP);
-       CHECK_DEFINE_X(MDS_INODELOCK_UPDATE);
-       CHECK_DEFINE_X(MDS_INODELOCK_OPEN);
-       CHECK_DEFINE_X(MDS_INODELOCK_LAYOUT);
-       CHECK_DEFINE_X(MDS_INODELOCK_PERM);
-       CHECK_DEFINE_X(MDS_INODELOCK_XATTR);
-       CHECK_DEFINE_X(MDS_INODELOCK_DOM);
+       CHECK_VALUE_X(MDS_INODELOCK_LOOKUP);
+       CHECK_VALUE_X(MDS_INODELOCK_UPDATE);
+       CHECK_VALUE_X(MDS_INODELOCK_OPEN);
+       CHECK_VALUE_X(MDS_INODELOCK_LAYOUT);
+       CHECK_VALUE_X(MDS_INODELOCK_PERM);
+       CHECK_VALUE_X(MDS_INODELOCK_XATTR);
+       CHECK_VALUE_X(MDS_INODELOCK_DOM);
 }
 
 static void
 }
 
 static void
@@ -2682,6 +2691,7 @@ main(int argc, char **argv)
        CHECK_VALUE(MDS_HSM_CT_REGISTER);
        CHECK_VALUE(MDS_HSM_CT_UNREGISTER);
        CHECK_VALUE(MDS_SWAP_LAYOUTS);
        CHECK_VALUE(MDS_HSM_CT_REGISTER);
        CHECK_VALUE(MDS_HSM_CT_UNREGISTER);
        CHECK_VALUE(MDS_SWAP_LAYOUTS);
+       CHECK_VALUE(MDS_RMFID);
        CHECK_VALUE(MDS_LAST_OPC);
 
        CHECK_VALUE(REINT_SETATTR);
        CHECK_VALUE(MDS_LAST_OPC);
 
        CHECK_VALUE(REINT_SETATTR);
index b2cb77c..cb0aa1b 100644 (file)
 #ifdef HAVE_SERVER_SUPPORT
 #include <linux/lustre/lustre_lfsck_user.h>
 #include <linux/lustre/lustre_disk.h>
 #ifdef HAVE_SERVER_SUPPORT
 #include <linux/lustre/lustre_lfsck_user.h>
 #include <linux/lustre/lustre_disk.h>
-#endif
+#ifdef CONFIG_FS_POSIX_ACL
+#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
+#include <linux/posix_acl_xattr.h>
+# define posix_acl_xattr_header struct posix_acl_xattr_header
+# define posix_acl_xattr_entry  struct posix_acl_xattr_entry
+#endif /* HAVE_STRUCT_POSIX_ACL_XATTR */
+#endif /* CONFIG_FS_POSIX_ACL */
+#endif /* HAVE_SERVER_SUPPORT */
 #include <linux/lustre/lustre_cfg.h>
 
 #define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
 #include <linux/lustre/lustre_cfg.h>
 
 #define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
index 6d30541..7f5967b 100644 (file)
 #ifdef HAVE_SERVER_SUPPORT
 #include <linux/lustre/lustre_lfsck_user.h>
 #include <linux/lustre/lustre_disk.h>
 #ifdef HAVE_SERVER_SUPPORT
 #include <linux/lustre/lustre_lfsck_user.h>
 #include <linux/lustre/lustre_disk.h>
-#endif
+#ifdef CONFIG_FS_POSIX_ACL
+#include <linux/posix_acl_xattr.h>
+#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
+# define posix_acl_xattr_header struct posix_acl_xattr_header
+# define posix_acl_xattr_entry  struct posix_acl_xattr_entry
+#endif /* HAVE_STRUCT_POSIX_ACL_XATTR */
+#endif /* CONFIG_FS_POSIX_ACL */
+#endif /* HAVE_SERVER_SUPPORT */
 #include <linux/lustre/lustre_cfg.h>
 
 #define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
 #include <linux/lustre/lustre_cfg.h>
 
 #define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
@@ -1971,6 +1978,20 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct obd_statfs, os_spare9));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare9) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare9));
                 (long long)(int)offsetof(struct obd_statfs, os_spare9));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare9) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare9));
+       LASSERTF(OS_STATE_DEGRADED == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_DEGRADED);
+       LASSERTF(OS_STATE_READONLY == 0x00000002UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_READONLY);
+       LASSERTF(OS_STATE_NOPRECREATE == 0x00000004UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_NOPRECREATE);
+       LASSERTF(OS_STATE_ENOSPC == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_ENOSPC);
+       LASSERTF(OS_STATE_ENOINO == 0x00000040UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_ENOINO);
+       LASSERTF(OS_STATE_SUM == 0x00000100UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_SUM);
+       LASSERTF(OS_STATE_NONROT == 0x00000200UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_NONROT);
 
        /* Checks for struct obd_ioobj */
        LASSERTF((int)sizeof(struct obd_ioobj) == 24, "found %lld\n",
 
        /* Checks for struct obd_ioobj */
        LASSERTF((int)sizeof(struct obd_ioobj) == 24, "found %lld\n",
@@ -2527,20 +2548,20 @@ void lustre_assert_wire_constants(void)
                (unsigned)LUSTRE_DIRECTIO_FL);
        LASSERTF(LUSTRE_INLINE_DATA_FL == 0x10000000UL, "found 0x%.8xUL\n",
                (unsigned)LUSTRE_INLINE_DATA_FL);
                (unsigned)LUSTRE_DIRECTIO_FL);
        LASSERTF(LUSTRE_INLINE_DATA_FL == 0x10000000UL, "found 0x%.8xUL\n",
                (unsigned)LUSTRE_INLINE_DATA_FL);
-       LASSERTF(MDS_INODELOCK_LOOKUP == 0x000001, "found 0x%.8x\n",
-               MDS_INODELOCK_LOOKUP);
-       LASSERTF(MDS_INODELOCK_UPDATE == 0x000002, "found 0x%.8x\n",
-               MDS_INODELOCK_UPDATE);
-       LASSERTF(MDS_INODELOCK_OPEN == 0x000004, "found 0x%.8x\n",
-               MDS_INODELOCK_OPEN);
-       LASSERTF(MDS_INODELOCK_LAYOUT == 0x000008, "found 0x%.8x\n",
-               MDS_INODELOCK_LAYOUT);
-       LASSERTF(MDS_INODELOCK_PERM == 0x000010, "found 0x%.8x\n",
-               MDS_INODELOCK_PERM);
-       LASSERTF(MDS_INODELOCK_XATTR == 0x000020, "found 0x%.8x\n",
-               MDS_INODELOCK_XATTR);
-       LASSERTF(MDS_INODELOCK_DOM == 0x000040, "found 0x%.8x\n",
-               MDS_INODELOCK_DOM);
+       LASSERTF(MDS_INODELOCK_LOOKUP == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_LOOKUP);
+       LASSERTF(MDS_INODELOCK_UPDATE == 0x00000002UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_UPDATE);
+       LASSERTF(MDS_INODELOCK_OPEN == 0x00000004UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_OPEN);
+       LASSERTF(MDS_INODELOCK_LAYOUT == 0x00000008UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_LAYOUT);
+       LASSERTF(MDS_INODELOCK_PERM == 0x00000010UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_PERM);
+       LASSERTF(MDS_INODELOCK_XATTR == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_XATTR);
+       LASSERTF(MDS_INODELOCK_DOM == 0x00000040UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_DOM);
 
        /* Checks for struct mdt_ioepoch */
        LASSERTF((int)sizeof(struct mdt_ioepoch) == 24, "found %lld\n",
 
        /* Checks for struct mdt_ioepoch */
        LASSERTF((int)sizeof(struct mdt_ioepoch) == 24, "found %lld\n",