diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 81 |
3 files changed, 44 insertions, 42 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 370b190a09d..89f98e9a024 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1943,7 +1943,8 @@ int nfs_permission(struct inode *inode, int mask) | |||
1943 | case S_IFREG: | 1943 | case S_IFREG: |
1944 | /* NFSv4 has atomic_open... */ | 1944 | /* NFSv4 has atomic_open... */ |
1945 | if (nfs_server_capable(inode, NFS_CAP_ATOMIC_OPEN) | 1945 | if (nfs_server_capable(inode, NFS_CAP_ATOMIC_OPEN) |
1946 | && (mask & MAY_OPEN)) | 1946 | && (mask & MAY_OPEN) |
1947 | && !(mask & MAY_EXEC)) | ||
1947 | goto out; | 1948 | goto out; |
1948 | break; | 1949 | break; |
1949 | case S_IFDIR: | 1950 | case S_IFDIR: |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 1215a4f50cd..3567fb9e3fb 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -448,13 +448,11 @@ int remove_save_link(struct inode *inode, int truncate) | |||
448 | static void reiserfs_kill_sb(struct super_block *s) | 448 | static void reiserfs_kill_sb(struct super_block *s) |
449 | { | 449 | { |
450 | if (REISERFS_SB(s)) { | 450 | if (REISERFS_SB(s)) { |
451 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
452 | if (REISERFS_SB(s)->xattr_root) { | 451 | if (REISERFS_SB(s)->xattr_root) { |
453 | d_invalidate(REISERFS_SB(s)->xattr_root); | 452 | d_invalidate(REISERFS_SB(s)->xattr_root); |
454 | dput(REISERFS_SB(s)->xattr_root); | 453 | dput(REISERFS_SB(s)->xattr_root); |
455 | REISERFS_SB(s)->xattr_root = NULL; | 454 | REISERFS_SB(s)->xattr_root = NULL; |
456 | } | 455 | } |
457 | #endif | ||
458 | if (REISERFS_SB(s)->priv_root) { | 456 | if (REISERFS_SB(s)->priv_root) { |
459 | d_invalidate(REISERFS_SB(s)->priv_root); | 457 | d_invalidate(REISERFS_SB(s)->priv_root); |
460 | dput(REISERFS_SB(s)->priv_root); | 458 | dput(REISERFS_SB(s)->priv_root); |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 2237e10c7c7..8e7deb0e696 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 */ | ||
689 | struct 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 | ||
886 | int 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 | |||
903 | static int create_privroot(struct dentry *dentry) | 874 | static 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 | ||
897 | int __init reiserfs_xattr_register_handlers(void) { return 0; } | ||
898 | void reiserfs_xattr_unregister_handlers(void) {} | ||
899 | static int create_privroot(struct dentry *dentry) { return 0; } | ||
900 | #endif | ||
901 | |||
902 | /* Actual operations that are exported to VFS-land */ | ||
903 | struct 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 | |||
925 | static int xattr_mount_check(struct super_block *s) | 918 | static 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 | 937 | int reiserfs_permission(struct inode *inode, int mask) |
945 | int __init reiserfs_xattr_register_handlers(void) { return 0; } | 938 | { |
946 | void 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 */ |
950 | static int | 957 | static 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; |