提交 b83674c0 编写于 作者: J Jeff Mahoney 提交者: Linus Torvalds

reiserfs: fixup perms when xattrs are disabled

This adds CONFIG_REISERFS_FS_XATTR protection from reiserfs_permission.

This is needed to avoid warnings during file deletions and chowns with
xattrs disabled.
Signed-off-by: NJeff Mahoney <jeffm@suse.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 ceb5edc4
......@@ -871,23 +871,6 @@ static int reiserfs_check_acl(struct inode *inode, int mask)
return error;
}
int reiserfs_permission(struct inode *inode, int mask)
{
/*
* We don't do permission checks on the internal objects.
* Permissions are determined by the "owning" object.
*/
if (IS_PRIVATE(inode))
return 0;
/*
* Stat data v1 doesn't support ACLs.
*/
if (get_inode_sd_version(inode) == STAT_DATA_V1)
return generic_permission(inode, mask, NULL);
else
return generic_permission(inode, mask, reiserfs_check_acl);
}
static int create_privroot(struct dentry *dentry)
{
int err;
......@@ -951,6 +934,25 @@ static int xattr_mount_check(struct super_block *s)
return 0;
}
int reiserfs_permission(struct inode *inode, int mask)
{
/*
* We don't do permission checks on the internal objects.
* Permissions are determined by the "owning" object.
*/
if (IS_PRIVATE(inode))
return 0;
#ifdef CONFIG_REISERFS_FS_XATTR
/*
* Stat data v1 doesn't support ACLs.
*/
if (get_inode_sd_version(inode) != STAT_DATA_V1)
return generic_permission(inode, mask, reiserfs_check_acl);
#endif
return generic_permission(inode, mask, NULL);
}
/* This will catch lookups from the fs root to .reiserfs_priv */
static int
xattr_lookup_poison(struct dentry *dentry, struct qstr *q1, struct qstr *name)
......
......@@ -41,6 +41,7 @@ int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
int reiserfs_lookup_privroot(struct super_block *sb);
int reiserfs_delete_xattrs(struct inode *inode);
int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
int reiserfs_permission(struct inode *inode, int mask);
#ifdef CONFIG_REISERFS_FS_XATTR
#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
......@@ -50,7 +51,6 @@ int reiserfs_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
int reiserfs_removexattr(struct dentry *dentry, const char *name);
int reiserfs_permission(struct inode *inode, int mask);
int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
......@@ -117,8 +117,6 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
#define reiserfs_listxattr NULL
#define reiserfs_removexattr NULL
#define reiserfs_permission NULL
static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
{
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册