Skip to content

Commit

Permalink
linux 6.2 compat: get_acl() got moved to get_inode_acl() in 6.2
Browse files Browse the repository at this point in the history
Linux 6.2 renamed the get_acl() operation to get_inode_acl() in
the inode_operations struct. This should fix Issue openzfs#14323.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes openzfs#14323
Closes openzfs#14331
  • Loading branch information
ckane authored and behlendorf committed Jan 6, 2023
1 parent 556ed09 commit 884a693
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
19 changes: 18 additions & 1 deletion config/kernel-acl.m4
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,18 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
.get_acl = get_acl_fn,
};
],[])
ZFS_LINUX_TEST_SRC([inode_operations_get_inode_acl], [
#include <linux/fs.h>
struct posix_acl *get_inode_acl_fn(struct inode *inode, int type,
bool rcu) { return NULL; }
static const struct inode_operations
iops __attribute__ ((unused)) = {
.get_inode_acl = get_inode_acl_fn,
};
],[])
])

AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
Expand All @@ -201,7 +213,12 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_ACL_RCU, 1, [iops->get_acl() takes rcu])
],[
ZFS_LINUX_TEST_ERROR([iops->get_acl()])
ZFS_LINUX_TEST_RESULT([inode_operations_get_inode_acl], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_INODE_ACL, 1, [has iops->get_inode_acl()])
],[
ZFS_LINUX_TEST_ERROR([iops->get_acl() or iops->get_inode_acl()])
])
])
])
])
Expand Down
2 changes: 1 addition & 1 deletion include/os/linux/zfs/sys/zpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern int zpl_set_acl(struct user_namespace *userns, struct inode *ip,
extern int zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type);
#endif /* HAVE_SET_ACL_USERNS */
#endif /* HAVE_SET_ACL */
#if defined(HAVE_GET_ACL_RCU)
#if defined(HAVE_GET_ACL_RCU) || defined(HAVE_GET_INODE_ACL)
extern struct posix_acl *zpl_get_acl(struct inode *ip, int type, bool rcu);
#elif defined(HAVE_GET_ACL)
extern struct posix_acl *zpl_get_acl(struct inode *ip, int type);
Expand Down
12 changes: 12 additions & 0 deletions module/os/linux/zfs/zpl_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,11 @@ const struct inode_operations zpl_inode_operations = {
#if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl,
#endif /* HAVE_SET_ACL */
#if defined(HAVE_GET_INODE_ACL)
.get_inode_acl = zpl_get_acl,
#else
.get_acl = zpl_get_acl,
#endif /* HAVE_GET_INODE_ACL */
#endif /* CONFIG_FS_POSIX_ACL */
};

Expand Down Expand Up @@ -816,7 +820,11 @@ const struct inode_operations zpl_dir_inode_operations = {
#if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl,
#endif /* HAVE_SET_ACL */
#if defined(HAVE_GET_INODE_ACL)
.get_inode_acl = zpl_get_acl,
#else
.get_acl = zpl_get_acl,
#endif /* HAVE_GET_INODE_ACL */
#endif /* CONFIG_FS_POSIX_ACL */
#ifdef HAVE_RENAME2_OPERATIONS_WRAPPER
},
Expand Down Expand Up @@ -859,6 +867,10 @@ const struct inode_operations zpl_special_inode_operations = {
#if defined(HAVE_SET_ACL)
.set_acl = zpl_set_acl,
#endif /* HAVE_SET_ACL */
#if defined(HAVE_GET_INODE_ACL)
.get_inode_acl = zpl_get_acl,
#else
.get_acl = zpl_get_acl,
#endif /* HAVE_GET_INODE_ACL */
#endif /* CONFIG_FS_POSIX_ACL */
};
2 changes: 1 addition & 1 deletion module/os/linux/zfs/zpl_xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ zpl_get_acl_impl(struct inode *ip, int type)
return (acl);
}

#if defined(HAVE_GET_ACL_RCU)
#if defined(HAVE_GET_ACL_RCU) || defined(HAVE_GET_INODE_ACL)
struct posix_acl *
zpl_get_acl(struct inode *ip, int type, bool rcu)
{
Expand Down

0 comments on commit 884a693

Please sign in to comment.