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 <ryan@iXsystems.com>
This commit is contained in:
parent
39b4adf91d
commit
de35ac0d1e
|
@ -106,7 +106,12 @@ zpl_chmod_acl(struct inode *ip)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_FS_POSIX_ACL */
|
#endif /* CONFIG_FS_POSIX_ACL */
|
||||||
|
|
||||||
|
#if defined(HAVE_IOPS_PERMISSION_USERNS)
|
||||||
|
extern int zpl_permission(struct user_namespace *userns, struct inode *ip,
|
||||||
|
int mask);
|
||||||
|
#else
|
||||||
extern int zpl_permission(struct inode *ip, int mask);
|
extern int zpl_permission(struct inode *ip, int mask);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern xattr_handler_t *zpl_xattr_handlers[];
|
extern xattr_handler_t *zpl_xattr_handlers[];
|
||||||
|
|
||||||
|
|
|
@ -1483,7 +1483,11 @@ static xattr_handler_t zpl_xattr_acl_default_handler = {
|
||||||
#endif /* CONFIG_FS_POSIX_ACL */
|
#endif /* CONFIG_FS_POSIX_ACL */
|
||||||
|
|
||||||
int
|
int
|
||||||
|
#if defined(HAVE_IOPS_PERMISSION_USERNS)
|
||||||
|
zpl_permission(struct user_namespace *userns, struct inode *ip, int mask)
|
||||||
|
#else
|
||||||
zpl_permission(struct inode *ip, int mask)
|
zpl_permission(struct inode *ip, int mask)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int to_check = 0, i, ret;
|
int to_check = 0, i, ret;
|
||||||
cred_t *cr = NULL;
|
cred_t *cr = NULL;
|
||||||
|
@ -1496,7 +1500,11 @@ zpl_permission(struct inode *ip, int mask)
|
||||||
*/
|
*/
|
||||||
if ((ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_NFSV4) ||
|
if ((ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_NFSV4) ||
|
||||||
((ITOZ(ip)->z_pflags & ZFS_ACL_TRIVIAL && GENERIC_MASK(mask)))) {
|
((ITOZ(ip)->z_pflags & ZFS_ACL_TRIVIAL && GENERIC_MASK(mask)))) {
|
||||||
|
#if defined(HAVE_IOPS_PERMISSION_USERNS)
|
||||||
|
return (generic_permission(userns, ip, mask));
|
||||||
|
#else
|
||||||
return (generic_permission(ip, mask));
|
return (generic_permission(ip, mask));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(mask2zfs); i++) {
|
for (i = 0; i < ARRAY_SIZE(mask2zfs); i++) {
|
||||||
|
@ -1510,7 +1518,11 @@ zpl_permission(struct inode *ip, int mask)
|
||||||
* NFSv4 ACE. Pass back to default kernel permissions check.
|
* NFSv4 ACE. Pass back to default kernel permissions check.
|
||||||
*/
|
*/
|
||||||
if (to_check == 0) {
|
if (to_check == 0) {
|
||||||
|
#if defined(HAVE_IOPS_PERMISSION_USERNS)
|
||||||
|
return (generic_permission(userns, ip, mask));
|
||||||
|
#else
|
||||||
return (generic_permission(ip, mask));
|
return (generic_permission(ip, mask));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue