Skip to content

Commit 18f1333

Browse files
Ryan MoellerRyan Moeller
authored andcommitted
Make zpl_permission work with 5.12+ kernels
The "permission" inode operation takes a new `struct user_namespace *` parameter starting in Linux 5.12. Add a configure check and adapt accordingly. Signed-off-by: Ryan Moeller <[email protected]>
1 parent 2794c46 commit 18f1333

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

include/os/linux/zfs/sys/zpl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ zpl_chmod_acl(struct inode *ip)
9191
}
9292
#endif /* CONFIG_FS_POSIX_ACL */
9393

94+
#if defined(HAVE_IOPS_PERMISSION_USERNS)
95+
extern int zpl_permission(struct user_namespace *userns, struct inode *ip,
96+
int mask);
97+
#else
9498
extern int zpl_permission(struct inode *ip, int mask);
99+
#endif
95100

96101
extern xattr_handler_t *zpl_xattr_handlers[];
97102

module/os/linux/zfs/zpl_xattr.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,11 @@ static xattr_handler_t zpl_xattr_acl_default_handler = {
14491449
#endif /* CONFIG_FS_POSIX_ACL */
14501450

14511451
int
1452+
#if defined(HAVE_IOPS_PERMISSION_USERNS)
1453+
zpl_permission(struct user_namespace *userns, struct inode *ip, int mask)
1454+
#else
14521455
zpl_permission(struct inode *ip, int mask)
1456+
#endif
14531457
{
14541458
int to_check = 0, i, ret;
14551459
cred_t *cr = NULL;
@@ -1462,7 +1466,11 @@ zpl_permission(struct inode *ip, int mask)
14621466
*/
14631467
if ((ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_NFSV4) ||
14641468
((ITOZ(ip)->z_pflags & ZFS_ACL_TRIVIAL && GENERIC_MASK(mask)))) {
1469+
#if defined(HAVE_IOPS_PERMISSION_USERNS)
1470+
return (generic_permission(userns, ip, mask));
1471+
#else
14651472
return (generic_permission(ip, mask));
1473+
#endif
14661474
}
14671475

14681476
for (i = 0; i < ARRAY_SIZE(mask2zfs); i++) {
@@ -1476,7 +1484,11 @@ zpl_permission(struct inode *ip, int mask)
14761484
* NFSv4 ACE. Pass back to default kernel permissions check.
14771485
*/
14781486
if (to_check == 0) {
1487+
#if defined(HAVE_IOPS_PERMISSION_USERNS)
1488+
return (generic_permission(userns, ip, mask));
1489+
#else
14791490
return (generic_permission(ip, mask));
1491+
#endif
14801492
}
14811493

14821494
/*

0 commit comments

Comments
 (0)