aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/xattr.c')
-rw-r--r--fs/reiserfs/xattr.c81
1 files changed, 42 insertions, 39 deletions
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 2237e10c7c7c..8e7deb0e6964 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -123,7 +123,9 @@ static struct dentry *open_xa_root(struct super_block *sb, int flags)
123 mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR); 123 mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR);
124 124
125 xaroot = dget(REISERFS_SB(sb)->xattr_root); 125 xaroot = dget(REISERFS_SB(sb)->xattr_root);
126 if (!xaroot->d_inode) { 126 if (!xaroot)
127 xaroot = ERR_PTR(-ENODATA);
128 else if (!xaroot->d_inode) {
127 int err = -ENODATA; 129 int err = -ENODATA;
128 if (xattr_may_create(flags)) 130 if (xattr_may_create(flags))
129 err = xattr_mkdir(privroot->d_inode, xaroot, 0700); 131 err = xattr_mkdir(privroot->d_inode, xaroot, 0700);
@@ -685,20 +687,6 @@ out:
685 return err; 687 return err;
686} 688}
687 689
688/* Actual operations that are exported to VFS-land */
689struct xattr_handler *reiserfs_xattr_handlers[] = {
690 &reiserfs_xattr_user_handler,
691 &reiserfs_xattr_trusted_handler,
692#ifdef CONFIG_REISERFS_FS_SECURITY
693 &reiserfs_xattr_security_handler,
694#endif
695#ifdef CONFIG_REISERFS_FS_POSIX_ACL
696 &reiserfs_posix_acl_access_handler,
697 &reiserfs_posix_acl_default_handler,
698#endif
699 NULL
700};
701
702/* 690/*
703 * In order to implement different sets of xattr operations for each xattr 691 * In order to implement different sets of xattr operations for each xattr
704 * prefix with the generic xattr API, a filesystem should create a 692 * prefix with the generic xattr API, a filesystem should create a
@@ -883,23 +871,6 @@ static int reiserfs_check_acl(struct inode *inode, int mask)
883 return error; 871 return error;
884} 872}
885 873
886int reiserfs_permission(struct inode *inode, int mask)
887{
888 /*
889 * We don't do permission checks on the internal objects.
890 * Permissions are determined by the "owning" object.
891 */
892 if (IS_PRIVATE(inode))
893 return 0;
894 /*
895 * Stat data v1 doesn't support ACLs.
896 */
897 if (get_inode_sd_version(inode) == STAT_DATA_V1)
898 return generic_permission(inode, mask, NULL);
899 else
900 return generic_permission(inode, mask, reiserfs_check_acl);
901}
902
903static int create_privroot(struct dentry *dentry) 874static int create_privroot(struct dentry *dentry)
904{ 875{
905 int err; 876 int err;
@@ -922,6 +893,28 @@ static int create_privroot(struct dentry *dentry)
922 return 0; 893 return 0;
923} 894}
924 895
896#else
897int __init reiserfs_xattr_register_handlers(void) { return 0; }
898void reiserfs_xattr_unregister_handlers(void) {}
899static int create_privroot(struct dentry *dentry) { return 0; }
900#endif
901
902/* Actual operations that are exported to VFS-land */
903struct xattr_handler *reiserfs_xattr_handlers[] = {
904#ifdef CONFIG_REISERFS_FS_XATTR
905 &reiserfs_xattr_user_handler,
906 &reiserfs_xattr_trusted_handler,
907#endif
908#ifdef CONFIG_REISERFS_FS_SECURITY
909 &reiserfs_xattr_security_handler,
910#endif
911#ifdef CONFIG_REISERFS_FS_POSIX_ACL
912 &reiserfs_posix_acl_access_handler,
913 &reiserfs_posix_acl_default_handler,
914#endif
915 NULL
916};
917
925static int xattr_mount_check(struct super_block *s) 918static int xattr_mount_check(struct super_block *s)
926{ 919{
927 /* We need generation numbers to ensure that the oid mapping is correct 920 /* We need generation numbers to ensure that the oid mapping is correct
@@ -941,10 +934,24 @@ static int xattr_mount_check(struct super_block *s)
941 return 0; 934 return 0;
942} 935}
943 936
944#else 937int reiserfs_permission(struct inode *inode, int mask)
945int __init reiserfs_xattr_register_handlers(void) { return 0; } 938{
946void reiserfs_xattr_unregister_handlers(void) {} 939 /*
940 * We don't do permission checks on the internal objects.
941 * Permissions are determined by the "owning" object.
942 */
943 if (IS_PRIVATE(inode))
944 return 0;
945
946#ifdef CONFIG_REISERFS_FS_XATTR
947 /*
948 * Stat data v1 doesn't support ACLs.
949 */
950 if (get_inode_sd_version(inode) != STAT_DATA_V1)
951 return generic_permission(inode, mask, reiserfs_check_acl);
947#endif 952#endif
953 return generic_permission(inode, mask, NULL);
954}
948 955
949/* This will catch lookups from the fs root to .reiserfs_priv */ 956/* This will catch lookups from the fs root to .reiserfs_priv */
950static int 957static int
@@ -992,7 +999,6 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags)
992 int err = 0; 999 int err = 0;
993 struct dentry *privroot = REISERFS_SB(s)->priv_root; 1000 struct dentry *privroot = REISERFS_SB(s)->priv_root;
994 1001
995#ifdef CONFIG_REISERFS_FS_XATTR
996 err = xattr_mount_check(s); 1002 err = xattr_mount_check(s);
997 if (err) 1003 if (err)
998 goto error; 1004 goto error;
@@ -1023,14 +1029,11 @@ error:
1023 clear_bit(REISERFS_XATTRS_USER, &(REISERFS_SB(s)->s_mount_opt)); 1029 clear_bit(REISERFS_XATTRS_USER, &(REISERFS_SB(s)->s_mount_opt));
1024 clear_bit(REISERFS_POSIXACL, &(REISERFS_SB(s)->s_mount_opt)); 1030 clear_bit(REISERFS_POSIXACL, &(REISERFS_SB(s)->s_mount_opt));
1025 } 1031 }
1026#endif
1027 1032
1028 /* The super_block MS_POSIXACL must mirror the (no)acl mount option. */ 1033 /* The super_block MS_POSIXACL must mirror the (no)acl mount option. */
1029#ifdef CONFIG_REISERFS_FS_POSIX_ACL
1030 if (reiserfs_posixacl(s)) 1034 if (reiserfs_posixacl(s))
1031 s->s_flags |= MS_POSIXACL; 1035 s->s_flags |= MS_POSIXACL;
1032 else 1036 else
1033#endif
1034 s->s_flags &= ~MS_POSIXACL; 1037 s->s_flags &= ~MS_POSIXACL;
1035 1038
1036 return err; 1039 return err;