diff options
-rw-r--r-- | fs/btrfs/inode.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b7fa96f72ecd..8edcdf6910f7 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/mount.h> | 41 | #include <linux/mount.h> |
42 | #include <linux/btrfs.h> | 42 | #include <linux/btrfs.h> |
43 | #include <linux/blkdev.h> | 43 | #include <linux/blkdev.h> |
44 | #include <linux/posix_acl_xattr.h> | ||
44 | #include "compat.h" | 45 | #include "compat.h" |
45 | #include "ctree.h" | 46 | #include "ctree.h" |
46 | #include "disk-io.h" | 47 | #include "disk-io.h" |
@@ -56,6 +57,7 @@ | |||
56 | #include "free-space-cache.h" | 57 | #include "free-space-cache.h" |
57 | #include "inode-map.h" | 58 | #include "inode-map.h" |
58 | #include "backref.h" | 59 | #include "backref.h" |
60 | #include "hash.h" | ||
59 | 61 | ||
60 | struct btrfs_iget_args { | 62 | struct btrfs_iget_args { |
61 | u64 ino; | 63 | u64 ino; |
@@ -3300,8 +3302,17 @@ static noinline int acls_after_inode_item(struct extent_buffer *leaf, | |||
3300 | { | 3302 | { |
3301 | u32 nritems = btrfs_header_nritems(leaf); | 3303 | u32 nritems = btrfs_header_nritems(leaf); |
3302 | struct btrfs_key found_key; | 3304 | struct btrfs_key found_key; |
3305 | static u64 xattr_access = 0; | ||
3306 | static u64 xattr_default = 0; | ||
3303 | int scanned = 0; | 3307 | int scanned = 0; |
3304 | 3308 | ||
3309 | if (!xattr_access) { | ||
3310 | xattr_access = btrfs_name_hash(POSIX_ACL_XATTR_ACCESS, | ||
3311 | strlen(POSIX_ACL_XATTR_ACCESS)); | ||
3312 | xattr_default = btrfs_name_hash(POSIX_ACL_XATTR_DEFAULT, | ||
3313 | strlen(POSIX_ACL_XATTR_DEFAULT)); | ||
3314 | } | ||
3315 | |||
3305 | slot++; | 3316 | slot++; |
3306 | while (slot < nritems) { | 3317 | while (slot < nritems) { |
3307 | btrfs_item_key_to_cpu(leaf, &found_key, slot); | 3318 | btrfs_item_key_to_cpu(leaf, &found_key, slot); |
@@ -3311,8 +3322,11 @@ static noinline int acls_after_inode_item(struct extent_buffer *leaf, | |||
3311 | return 0; | 3322 | return 0; |
3312 | 3323 | ||
3313 | /* we found an xattr, assume we've got an acl */ | 3324 | /* we found an xattr, assume we've got an acl */ |
3314 | if (found_key.type == BTRFS_XATTR_ITEM_KEY) | 3325 | if (found_key.type == BTRFS_XATTR_ITEM_KEY) { |
3315 | return 1; | 3326 | if (found_key.offset == xattr_access || |
3327 | found_key.offset == xattr_default) | ||
3328 | return 1; | ||
3329 | } | ||
3316 | 3330 | ||
3317 | /* | 3331 | /* |
3318 | * we found a key greater than an xattr key, there can't | 3332 | * we found a key greater than an xattr key, there can't |