Whamcloud - gitweb
LU-5607 ptlrpc: restore posix_acl_xattr checks 33/11933/2
authorJohn L. Hammond <john.hammond@intel.com>
Mon, 15 Sep 2014 23:49:57 +0000 (18:49 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 24 Sep 2014 00:59:40 +0000 (00:59 +0000)
Restore the wiretest checks on posix_acl_xattr_entry and
posix_acl_xattr_header.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I3935ac2f8b7e894896949ff8a5c44fe6f78e1cae
Reviewed-on: http://review.whamcloud.com/11933
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 1a70959..e677be9 100644 (file)
@@ -50,8 +50,8 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
-         * running on Linux t 2.6.32-431.5.1.el6.lustre.x86_64 #1 SMP Wed Feb 12 11:01:08 CST 2014 x8
-         * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)  */
+         * running on Linux q 2.6.32-431.5.1.el6.lustre.x86_64 #1 SMP Wed Feb 12 11:01:08 CST 2014 x8
+         * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)  */
 
 
        /* Constants... */
@@ -4114,6 +4114,38 @@ void lustre_assert_wire_constants(void)
        CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000);
        CLASSERT(FIEMAP_EXTENT_NET == 0x80000000);
 
+#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));
+       LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0, "found %lld\n",
+                (long long)(int)offsetof(posix_acl_xattr_entry, e_tag));
+       LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2, "found %lld\n",
+                (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag));
+       LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2, "found %lld\n",
+                (long long)(int)offsetof(posix_acl_xattr_entry, e_perm));
+       LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2, "found %lld\n",
+                (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm));
+       LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4, "found %lld\n",
+                (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_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));
+       LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0, "found %lld\n",
+                (long long)(int)offsetof(posix_acl_xattr_header, a_version));
+       LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4, "found %lld\n",
+                (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
+       LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4, "found %lld\n",
+                (long long)(int)offsetof(posix_acl_xattr_header, a_entries));
+       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 /* CONFIG_FS_POSIX_ACL */
+
        /* Checks for struct link_ea_header */
        LASSERTF((int)sizeof(struct link_ea_header) == 24, "found %lld\n",
                 (long long)(int)sizeof(struct link_ea_header));
index 1d82f5a..cf030e9 100644 (file)
@@ -1789,6 +1789,45 @@ check_getinfo_fid2path(void)
        CHECK_MEMBER(getinfo_fid2path, gf_path[0]);
 }
 
+/* We don't control the definitions of posix_acl_xattr_{entry,header}
+ * and so we shouldn't have used them in our wire protocol. But it's
+ * too late now and so we emit checks against the *fixed* definitions
+ * below. See LU-5607. */
+
+typedef struct {
+       __u16                   e_tag;
+       __u16                   e_perm;
+       __u32                   e_id;
+} posix_acl_xattr_entry;
+
+typedef struct {
+       __u32                   a_version;
+       posix_acl_xattr_entry   a_entries[0];
+} posix_acl_xattr_header;
+
+static void
+check_posix_acl_xattr_entry(void)
+{
+       BLANK_LINE();
+       printf("#ifdef CONFIG_FS_POSIX_ACL\n");
+       CHECK_STRUCT_TYPEDEF(posix_acl_xattr_entry);
+       CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_tag);
+       CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_perm);
+       CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_id);
+       printf("#endif /* CONFIG_FS_POSIX_ACL */\n");
+}
+
+static void
+check_posix_acl_xattr_header(void)
+{
+       BLANK_LINE();
+       printf("#ifdef CONFIG_FS_POSIX_ACL\n");
+       CHECK_STRUCT_TYPEDEF(posix_acl_xattr_header);
+       CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_version);
+       CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_entries);
+       printf("#endif /* CONFIG_FS_POSIX_ACL */\n");
+}
+
 static void
 check_ll_user_fiemap(void)
 {
@@ -2498,6 +2537,8 @@ main(int argc, char **argv)
        check_getinfo_fid2path();
        check_ll_user_fiemap();
        check_ll_fiemap_extent();
+       check_posix_acl_xattr_entry();
+       check_posix_acl_xattr_header();
        check_link_ea_header();
        check_link_ea_entry();
        check_layout_intent();
index 248ccc6..e0e18dd 100644 (file)
@@ -62,8 +62,8 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
-         * running on Linux t 2.6.32-431.5.1.el6.lustre.x86_64 #1 SMP Wed Feb 12 11:01:08 CST 2014 x8
-         * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)  */
+         * running on Linux q 2.6.32-431.5.1.el6.lustre.x86_64 #1 SMP Wed Feb 12 11:01:08 CST 2014 x8
+         * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)  */
 
 
        /* Constants... */
@@ -4126,6 +4126,38 @@ void lustre_assert_wire_constants(void)
        CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000);
        CLASSERT(FIEMAP_EXTENT_NET == 0x80000000);
 
+#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));
+       LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0, "found %lld\n",
+                (long long)(int)offsetof(posix_acl_xattr_entry, e_tag));
+       LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2, "found %lld\n",
+                (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag));
+       LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2, "found %lld\n",
+                (long long)(int)offsetof(posix_acl_xattr_entry, e_perm));
+       LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2, "found %lld\n",
+                (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm));
+       LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4, "found %lld\n",
+                (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_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));
+       LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0, "found %lld\n",
+                (long long)(int)offsetof(posix_acl_xattr_header, a_version));
+       LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4, "found %lld\n",
+                (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
+       LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4, "found %lld\n",
+                (long long)(int)offsetof(posix_acl_xattr_header, a_entries));
+       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 /* CONFIG_FS_POSIX_ACL */
+
        /* Checks for struct link_ea_header */
        LASSERTF((int)sizeof(struct link_ea_header) == 24, "found %lld\n",
                 (long long)(int)sizeof(struct link_ea_header));