reiserfs: fixup perms when xattrs are disabled
authorJeff Mahoney <jeffm@suse.com>
Sun, 17 May 2009 05:02:03 +0000 (01:02 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 17 May 2009 18:45:45 +0000 (11:45 -0700)
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: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/reiserfs/xattr.c
include/linux/reiserfs_xattr.h

index 628075c..8e7deb0 100644 (file)
@@ -871,23 +871,6 @@ static int reiserfs_check_acl(struct inode *inode, int mask)
        return error;
 }
 
        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;
 static int create_privroot(struct dentry *dentry)
 {
        int err;
@@ -951,6 +934,25 @@ static int xattr_mount_check(struct super_block *s)
        return 0;
 }
 
        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)
 /* 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)
index cdedc01..99928dc 100644 (file)
@@ -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_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)
 
 #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);
                      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);
 
 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_listxattr NULL
 #define reiserfs_removexattr NULL
 
-#define reiserfs_permission NULL
-
 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
 {
 }
 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
 {
 }