aboutsummaryrefslogtreecommitdiff
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 12:53:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 12:53:15 -0700
commit0003230e8200699860f0b10af524dc47bf8aecad (patch)
tree8addb0c889b32111d6973c46cd3d0a5b5c17606c /fs/reiserfs
parent4b478cedcdc1b2d131170f22bd3f916e53472f52 (diff)
parent4e34e719e457f2e031297175410fc0bd4016a085 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: fs: take the ACL checks to common code bury posix_acl_..._masq() variants kill boilerplates around posix_acl_create_masq() generic_acl: no need to clone acl just to push it to set_cached_acl() kill boilerplate around posix_acl_chmod_masq() reiserfs: cache negative ACLs for v1 stat format xfs: cache negative ACLs if there is no attribute fork 9p: do no return 0 from ->check_acl without actually checking vfs: move ACL cache lookup into generic code CIFS: Fix oops while mounting with prefixpath xfs: Fix wrong return value of xfs_file_aio_write fix devtmpfs race caam: don't pass bogus S_IFCHR to debugfs_create_...() get rid of create_proc_entry() abuses - proc_mkdir() is there for purpose asus-wmi: ->is_visible() can't return negative fix jffs2 ACLs on big-endian with 16bit mode_t 9p: close ACL leaks ocfs2_init_acl(): fix a leak VFS : mount lock scalability for internal mounts
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/file.c2
-rw-r--r--fs/reiserfs/inode.c5
-rw-r--r--fs/reiserfs/namei.c6
-rw-r--r--fs/reiserfs/xattr.c27
-rw-r--r--fs/reiserfs/xattr_acl.c71
5 files changed, 34 insertions, 77 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index c7156dc39ce..ace635053a3 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -319,5 +319,5 @@ const struct inode_operations reiserfs_file_inode_operations = {
.listxattr = reiserfs_listxattr,
.removexattr = reiserfs_removexattr,
.permission = reiserfs_permission,
- .check_acl = reiserfs_check_acl,
+ .get_acl = reiserfs_get_acl,
};
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 2922b90ceac..9b0d4b78b4f 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1475,6 +1475,11 @@ void reiserfs_read_locked_inode(struct inode *inode,
reiserfs_check_path(&path_to_sd); /* init inode should be relsing */
+ /*
+ * Stat data v1 doesn't support ACLs.
+ */
+ if (get_inode_sd_version(inode) == STAT_DATA_V1)
+ cache_no_acl(inode);
}
/**
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 551f1b79dbc..ef392324bbf 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -1529,7 +1529,7 @@ const struct inode_operations reiserfs_dir_inode_operations = {
.listxattr = reiserfs_listxattr,
.removexattr = reiserfs_removexattr,
.permission = reiserfs_permission,
- .check_acl = reiserfs_check_acl,
+ .get_acl = reiserfs_get_acl,
};
/*
@@ -1546,7 +1546,7 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
.listxattr = reiserfs_listxattr,
.removexattr = reiserfs_removexattr,
.permission = reiserfs_permission,
- .check_acl = reiserfs_check_acl,
+ .get_acl = reiserfs_get_acl,
};
@@ -1560,5 +1560,5 @@ const struct inode_operations reiserfs_special_inode_operations = {
.listxattr = reiserfs_listxattr,
.removexattr = reiserfs_removexattr,
.permission = reiserfs_permission,
- .check_acl = reiserfs_check_acl,
+ .get_acl = reiserfs_get_acl,
};
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 6938d8c68d6..6bc346c160e 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -867,33 +867,6 @@ out:
return err;
}
-int reiserfs_check_acl(struct inode *inode, int mask)
-{
- struct posix_acl *acl;
- int error = -EAGAIN; /* do regular unix permission checks by default */
-
- /*
- * Stat data v1 doesn't support ACLs.
- */
- if (get_inode_sd_version(inode) == STAT_DATA_V1)
- return -EAGAIN;
-
- if (mask & MAY_NOT_BLOCK)
- return -ECHILD;
-
- acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
-
- if (acl) {
- if (!IS_ERR(acl)) {
- error = posix_acl_permission(inode, acl, mask);
- posix_acl_release(acl);
- } else if (PTR_ERR(acl) != -ENODATA)
- error = PTR_ERR(acl);
- }
-
- return error;
-}
-
static int create_privroot(struct dentry *dentry)
{
int err;
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index 3dc38f1206f..7362cf4c946 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -354,9 +354,7 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
return PTR_ERR(acl);
if (acl) {
- struct posix_acl *acl_copy;
mode_t mode = inode->i_mode;
- int need_acl;
/* Copy the default ACL to the default ACL of a new directory */
if (S_ISDIR(inode->i_mode)) {
@@ -368,29 +366,15 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
/* Now we reconcile the new ACL and the mode,
potentially modifying both */
- acl_copy = posix_acl_clone(acl, GFP_NOFS);
- if (!acl_copy) {
- err = -ENOMEM;
- goto cleanup;
- }
+ err = posix_acl_create(&acl, GFP_NOFS, &mode);
+ if (err < 0)
+ return err;
- need_acl = posix_acl_create_masq(acl_copy, &mode);
- if (need_acl >= 0) {
- if (mode != inode->i_mode) {
- inode->i_mode = mode;
- }
+ inode->i_mode = mode;
- /* If we need an ACL.. */
- if (need_acl > 0) {
- err = reiserfs_set_acl(th, inode,
- ACL_TYPE_ACCESS,
- acl_copy);
- if (err)
- goto cleanup_copy;
- }
- }
- cleanup_copy:
- posix_acl_release(acl_copy);
+ /* If we need an ACL.. */
+ if (err > 0)
+ err = reiserfs_set_acl(th, inode, ACL_TYPE_ACCESS, acl);
cleanup:
posix_acl_release(acl);
} else {
@@ -445,7 +429,10 @@ int reiserfs_cache_default_acl(struct inode *inode)
int reiserfs_acl_chmod(struct inode *inode)
{
- struct posix_acl *acl, *clone;
+ struct reiserfs_transaction_handle th;
+ struct posix_acl *acl;
+ size_t size;
+ int depth;
int error;
if (S_ISLNK(inode->i_mode))
@@ -463,30 +450,22 @@ int reiserfs_acl_chmod(struct inode *inode)
return 0;
if (IS_ERR(acl))
return PTR_ERR(acl);
- clone = posix_acl_clone(acl, GFP_NOFS);
- posix_acl_release(acl);
- if (!clone)
- return -ENOMEM;
- error = posix_acl_chmod_masq(clone, inode->i_mode);
+ error = posix_acl_chmod(&acl, GFP_NOFS, inode->i_mode);
+ if (error)
+ return error;
+
+ size = reiserfs_xattr_nblocks(inode, reiserfs_acl_size(acl->a_count));
+ depth = reiserfs_write_lock_once(inode->i_sb);
+ error = journal_begin(&th, inode->i_sb, size * 2);
if (!error) {
- struct reiserfs_transaction_handle th;
- size_t size = reiserfs_xattr_nblocks(inode,
- reiserfs_acl_size(clone->a_count));
- int depth;
-
- depth = reiserfs_write_lock_once(inode->i_sb);
- error = journal_begin(&th, inode->i_sb, size * 2);
- if (!error) {
- int error2;
- error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS,
- clone);
- error2 = journal_end(&th, inode->i_sb, size * 2);
- if (error2)
- error = error2;
- }
- reiserfs_write_unlock_once(inode->i_sb, depth);
+ int error2;
+ error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS, acl);
+ error2 = journal_end(&th, inode->i_sb, size * 2);
+ if (error2)
+ error = error2;
}
- posix_acl_release(clone);
+ reiserfs_write_unlock_once(inode->i_sb, depth);
+ posix_acl_release(acl);
return error;
}