summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2016-08-08 17:26:21 -0700
committerNed Bass <[email protected]>2016-09-05 16:07:08 -0700
commit26e2bfa7705bf45f8675b80a7ddfbcb29cddf8fa (patch)
treeaf3110635d7d3aae77befea4d70249dc35e16d22 /module/zfs
parent97a1bbd4ea422c8dbd03dc0577402ba6742da566 (diff)
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 <[email protected]> Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #4944 Closes #4946
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zpl_xattr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c
index abe150267..fb1b61bd2 100644
--- a/module/zfs/zpl_xattr.c
+++ b/module/zfs/zpl_xattr.c
@@ -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);
}