Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-10371

Kernel >= 4.8 has no posix_acl_xattr_entry a_entries[0]

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.11.0, Lustre 2.10.3
    • Lustre 2.10.1
    • Debian 9 Stretch (4.9.65-3)
    • 3
    • 9223372036854775807

    Description

      Compiling on Kernel >= 4.8 results in error

      error: ‘struct posix_acl_xattr_header’ has no member named ‘a_entries’
      
      
      
      

      due to Linux Kernel commit  2211d5ba5c6c4e972ba6dbc912b2897425ea6621

      ...
      -typedef struct {
      +struct posix_acl_xattr_header {
              __le32                  a_version;
      -       posix_acl_xattr_entry   a_entries[0];
      -} posix_acl_xattr_header;
      +};
      ...
      
      
      

      where the a_entries[0] was removed. There exists in already a check for this structure

      #
      # LC_STRUCT_POSIX_ACL_XATTR
      #
      # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
      # posix_acl: xattr representation cleanups
      #
      AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
      LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
      struct_posix_acl_xattr, [
              #include <linux/fs.h>
              #include <linux/posix_acl_xattr.h>
      ],[
              struct posix_acl_xattr_header *h = NULL;
              struct posix_acl_xattr_entry  *e;
              e = (void *)(h + 1);
      ],[
              AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
                      [struct posix_acl_xattr_{header,entry} defined])
      ])
      ]) # LC_STRUCT_POSIX_ACL_XATTR
      
      

      so let's use the check for fixing it e.g. as follows:

      diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c
      index 40e3d55..01a5220 100644
      --- a/lustre/ptlrpc/wiretest.c
      +++ b/lustre/ptlrpc/wiretest.c
      @@ -4548,10 +4548,12 @@ void lustre_assert_wire_constants(void)
                       (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));
      +#ifndef HAVE_STRUCT_POSIX_ACL_XATTR
              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 /* HAVE_STRUCT_POSIX_ACL_XATTR */
       #endif /* CONFIG_FS_POSIX_ACL */
      
      

      Attachments

        Activity

          People

            thomas.stibor Thomas Stibor
            thomas.stibor Thomas Stibor
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: