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
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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,
|
||||
};
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
if (!error) {
|
||||
struct reiserfs_transaction_handle th;
|
||||
size_t size = reiserfs_xattr_nblocks(inode,
|
||||
reiserfs_acl_size(clone->a_count));
|
||||
int depth;
|
||||
error = posix_acl_chmod(&acl, GFP_NOFS, inode->i_mode);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
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);
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user