mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Linux 4.7 compat: fix zpl_get_acl returns invalid acl pointer
Starting from Linux 4.7, get_acl will set acl cache pointer to temporary sentinel value before calling i_op->get_acl. Therefore we can't compare against ACL_NOT_CACHED and return. Since from Linux 3.14, get_acl already check the cache for us, so we disable this in zpl_get_acl. Linux 4.7 also does set_cached_acl for us so we disable it in zpl_get_acl. Signed-off-by: Chunwei Chen <david.chen@osnexus.com> Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #4944 Closes #4946
This commit is contained in:
committed by
Brian Behlendorf
parent
88c4c7a067
commit
afb6c031e8
@@ -1017,9 +1017,16 @@ zpl_get_acl(struct inode *ip, int type)
|
||||
char *name;
|
||||
int size;
|
||||
|
||||
/*
|
||||
* As of Linux 3.14, the kernel get_acl will check this for us.
|
||||
* Also as of Linux 4.7, comparing against ACL_NOT_CACHED is wrong
|
||||
* as the kernel get_acl will set it to temporary sentinel value.
|
||||
*/
|
||||
#ifndef HAVE_KERNEL_GET_ACL_HANDLE_CACHE
|
||||
acl = get_cached_acl(ip, type);
|
||||
if (acl != ACL_NOT_CACHED)
|
||||
return (acl);
|
||||
#endif
|
||||
|
||||
switch (type) {
|
||||
case ACL_TYPE_ACCESS:
|
||||
@@ -1049,8 +1056,11 @@ zpl_get_acl(struct inode *ip, int type)
|
||||
if (size > 0)
|
||||
kmem_free(value, size);
|
||||
|
||||
/* As of Linux 4.7, the kernel get_acl will set this for us */
|
||||
#ifndef HAVE_KERNEL_GET_ACL_HANDLE_CACHE
|
||||
if (!IS_ERR(acl))
|
||||
zpl_set_cached_acl(ip, type, acl);
|
||||
#endif
|
||||
|
||||
return (acl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user