aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/refcounttree.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/refcounttree.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/refcounttree.c')
-rw-r--r--fs/ocfs2/refcounttree.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 55767e1ba724..6ba4bcbc4796 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -46,6 +46,7 @@
46#include <linux/quotaops.h> 46#include <linux/quotaops.h>
47#include <linux/namei.h> 47#include <linux/namei.h>
48#include <linux/mount.h> 48#include <linux/mount.h>
49#include <linux/posix_acl.h>
49 50
50struct ocfs2_cow_context { 51struct ocfs2_cow_context {
51 struct inode *inode; 52 struct inode *inode;
@@ -4268,11 +4269,20 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir,
4268 struct inode *inode = old_dentry->d_inode; 4269 struct inode *inode = old_dentry->d_inode;
4269 struct buffer_head *old_bh = NULL; 4270 struct buffer_head *old_bh = NULL;
4270 struct inode *new_orphan_inode = NULL; 4271 struct inode *new_orphan_inode = NULL;
4272 struct posix_acl *default_acl, *acl;
4273 umode_t mode;
4271 4274
4272 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) 4275 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)))
4273 return -EOPNOTSUPP; 4276 return -EOPNOTSUPP;
4274 4277
4275 error = ocfs2_create_inode_in_orphan(dir, inode->i_mode, 4278 mode = inode->i_mode;
4279 error = posix_acl_create(dir, &mode, &default_acl, &acl);
4280 if (error) {
4281 mlog_errno(error);
4282 goto out;
4283 }
4284
4285 error = ocfs2_create_inode_in_orphan(dir, mode,
4276 &new_orphan_inode); 4286 &new_orphan_inode);
4277 if (error) { 4287 if (error) {
4278 mlog_errno(error); 4288 mlog_errno(error);
@@ -4303,11 +4313,16 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir,
4303 /* If the security isn't preserved, we need to re-initialize them. */ 4313 /* If the security isn't preserved, we need to re-initialize them. */
4304 if (!preserve) { 4314 if (!preserve) {
4305 error = ocfs2_init_security_and_acl(dir, new_orphan_inode, 4315 error = ocfs2_init_security_and_acl(dir, new_orphan_inode,
4306 &new_dentry->d_name); 4316 &new_dentry->d_name,
4317 default_acl, acl);
4307 if (error) 4318 if (error)
4308 mlog_errno(error); 4319 mlog_errno(error);
4309 } 4320 }
4310out: 4321out:
4322 if (default_acl)
4323 posix_acl_release(default_acl);
4324 if (acl)
4325 posix_acl_release(acl);
4311 if (!error) { 4326 if (!error) {
4312 error = ocfs2_mv_orphaned_inode_to_new(dir, new_orphan_inode, 4327 error = ocfs2_mv_orphaned_inode_to_new(dir, new_orphan_inode,
4313 new_dentry); 4328 new_dentry);