[LU-10371] Kernel >= 4.8 has no posix_acl_xattr_entry a_entries[0] Created: 12/Dec/17  Updated: 08/Jan/18  Resolved: 22/Dec/17

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.10.1
Fix Version/s: Lustre 2.11.0, Lustre 2.10.3

Type: Bug Priority: Minor
Reporter: Thomas Stibor Assignee: Thomas Stibor
Resolution: Fixed Votes: 0
Labels: patch
Environment:

Debian 9 Stretch (4.9.65-3)


Epic/Theme: patch
Severity: 3
Rank (Obsolete): 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 */



 Comments   
Comment by Gerrit Updater [ 12/Dec/17 ]

Thomas Stibor (t.stibor@gsi.de) uploaded a new patch: https://review.whamcloud.com/30495
Subject: LU-10371 ptlrpc: check for posix_acl a_entries
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 7f1ba9e03a428cb0deb8dc90a80606928109aab4

Comment by James A Simmons [ 12/Dec/17 ]

I saw they finally actually remove a_entries in kernel 4.13

Comment by Gerrit Updater [ 22/Dec/17 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/30495/
Subject: LU-10371 ptlrpc: check for posix_acl a_entries
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 429ad0e18eccd7261011ee2c7c193b822747e732

Comment by Peter Jones [ 22/Dec/17 ]

Landed for 2.11

Comment by Gerrit Updater [ 02/Jan/18 ]

Minh Diep (minh.diep@intel.com) uploaded a new patch: https://review.whamcloud.com/30691
Subject: LU-10371 ptlrpc: check for posix_acl a_entries
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: 37bc792558b3020ff1fba914e0b8780373c6f556

Comment by Gerrit Updater [ 08/Jan/18 ]

John L. Hammond (john.hammond@intel.com) merged in patch https://review.whamcloud.com/30691/
Subject: LU-10371 ptlrpc: check for posix_acl a_entries
Project: fs/lustre-release
Branch: b2_10
Current Patch Set:
Commit: d3ea5a422f15a50b0705dd3049b5af390ae4bc4b

Generated at Sat Feb 10 02:34:27 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.