1 From: Tiger Yang <tiger.yang@oracle.com>
2 Date: Fri, 14 Nov 2008 11:17:18 +0800
3 Subject: ocfs2: add ocfs2_check_acl
6 This function is used to enhance permission checking with POSIX ACLs.
8 Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
9 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
11 fs/ocfs2/acl.c | 15 +++++++++++++++
12 fs/ocfs2/acl.h | 10 ++++++++++
13 fs/ocfs2/file.c | 3 ++-
14 3 files changed, 27 insertions(+), 1 deletions(-)
16 diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
17 index 62d0faa..a6a2bf6 100644
20 @@ -230,6 +230,21 @@ static int ocfs2_set_acl(handle_t *handle,
24 +int ocfs2_check_acl(struct inode *inode, int mask)
26 + struct posix_acl *acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
29 + return PTR_ERR(acl);
31 + int ret = posix_acl_permission(inode, acl, mask);
32 + posix_acl_release(acl);
39 static size_t ocfs2_xattr_list_acl_access(struct inode *inode,
42 diff --git a/fs/ocfs2/acl.h b/fs/ocfs2/acl.h
43 index 1b39f3e..fef10f1 100644
46 @@ -26,4 +26,14 @@ struct ocfs2_acl_entry {
50 +#ifdef CONFIG_OCFS2_FS_POSIX_ACL
52 +extern int ocfs2_check_acl(struct inode *, int);
54 +#else /* CONFIG_OCFS2_FS_POSIX_ACL*/
56 +#define ocfs2_check_acl NULL
58 +#endif /* CONFIG_OCFS2_FS_POSIX_ACL*/
60 #endif /* OCFS2_ACL_H */
61 diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
62 index 3605491..7bad7d9 100644
71 #include "buffer_head_io.h"
73 @@ -1035,7 +1036,7 @@ int ocfs2_permission(struct inode *inode, int mask)
77 - ret = generic_permission(inode, mask, NULL);
78 + ret = generic_permission(inode, mask, ocfs2_check_acl);
80 ocfs2_inode_unlock(inode, 0);