aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/xattr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2013-12-20 08:16:48 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-01-25 23:58:21 -0500
commit702e5bc68ad2c02f1b12b53ef7093074af9d2441 (patch)
treeb88af8aafb7f8e166da41824cbffb99adf16f042 /fs/ocfs2/xattr.c
parentf2963d4551e7f500025d687586a25a09ea28941e (diff)
ocfs2: use generic posix ACL infrastructure
This contains some major refactoring for the create path so that inodes are created with the right mode to start with instead of fixing it up later. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ocfs2/xattr.c')
-rw-r--r--fs/ocfs2/xattr.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index f0a1326d9bba..185fa3b7f962 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -99,8 +99,8 @@ static struct ocfs2_xattr_def_value_root def_xv = {
99 99
100const struct xattr_handler *ocfs2_xattr_handlers[] = { 100const struct xattr_handler *ocfs2_xattr_handlers[] = {
101 &ocfs2_xattr_user_handler, 101 &ocfs2_xattr_user_handler,
102 &ocfs2_xattr_acl_access_handler, 102 &posix_acl_access_xattr_handler,
103 &ocfs2_xattr_acl_default_handler, 103 &posix_acl_default_xattr_handler,
104 &ocfs2_xattr_trusted_handler, 104 &ocfs2_xattr_trusted_handler,
105 &ocfs2_xattr_security_handler, 105 &ocfs2_xattr_security_handler,
106 NULL 106 NULL
@@ -109,9 +109,9 @@ const struct xattr_handler *ocfs2_xattr_handlers[] = {
109static const struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { 109static const struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = {
110 [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler, 110 [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler,
111 [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS] 111 [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS]
112 = &ocfs2_xattr_acl_access_handler, 112 = &posix_acl_access_xattr_handler,
113 [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT] 113 [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT]
114 = &ocfs2_xattr_acl_default_handler, 114 = &posix_acl_default_xattr_handler,
115 [OCFS2_XATTR_INDEX_TRUSTED] = &ocfs2_xattr_trusted_handler, 115 [OCFS2_XATTR_INDEX_TRUSTED] = &ocfs2_xattr_trusted_handler,
116 [OCFS2_XATTR_INDEX_SECURITY] = &ocfs2_xattr_security_handler, 116 [OCFS2_XATTR_INDEX_SECURITY] = &ocfs2_xattr_security_handler,
117}; 117};
@@ -7190,10 +7190,12 @@ out:
7190 */ 7190 */
7191int ocfs2_init_security_and_acl(struct inode *dir, 7191int ocfs2_init_security_and_acl(struct inode *dir,
7192 struct inode *inode, 7192 struct inode *inode,
7193 const struct qstr *qstr) 7193 const struct qstr *qstr,
7194 struct posix_acl *default_acl,
7195 struct posix_acl *acl)
7194{ 7196{
7195 int ret = 0;
7196 struct buffer_head *dir_bh = NULL; 7197 struct buffer_head *dir_bh = NULL;
7198 int ret = 0;
7197 7199
7198 ret = ocfs2_init_security_get(inode, dir, qstr, NULL); 7200 ret = ocfs2_init_security_get(inode, dir, qstr, NULL);
7199 if (ret) { 7201 if (ret) {
@@ -7207,9 +7209,10 @@ int ocfs2_init_security_and_acl(struct inode *dir,
7207 goto leave; 7209 goto leave;
7208 } 7210 }
7209 7211
7210 ret = ocfs2_init_acl(NULL, inode, dir, NULL, dir_bh, NULL, NULL); 7212 if (!ret && default_acl)
7211 if (ret) 7213 ret = ocfs2_iop_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
7212 mlog_errno(ret); 7214 if (!ret && acl)
7215 ret = ocfs2_iop_set_acl(inode, acl, ACL_TYPE_ACCESS);
7213 7216
7214 ocfs2_inode_unlock(dir, 0); 7217 ocfs2_inode_unlock(dir, 0);
7215 brelse(dir_bh); 7218 brelse(dir_bh);