summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-04-27 10:49:53 -0400
committerChris Mason <chris.mason@oracle.com>2009-04-27 13:18:26 -0400
commit7b1a14bbb0e547aaa4d30cc376e6c8c12539ab0f (patch)
tree80b75191277afe05201fab3e3d1bc50884444626 /fs/btrfs/inode.c
parent21380931eb4da4e29ac663d0221581282cbba208 (diff)
downloadlinux-3.10-7b1a14bbb0e547aaa4d30cc376e6c8c12539ab0f.tar.gz
linux-3.10-7b1a14bbb0e547aaa4d30cc376e6c8c12539ab0f.tar.bz2
linux-3.10-7b1a14bbb0e547aaa4d30cc376e6c8c12539ab0f.zip
Btrfs: fix acl caching
Linus noticed the btrfs code to cache acls wasn't properly caching a NULL acl when the inode didn't have any acls. This meant the common case of no acls resulted in expensive btree searches every time the kernel checked permissions (which is quite often). This is a modified version of Linus' original patch: Properly set initial acl fields to BTRFS_ACL_NOT_CACHED in the inode. This forces an acl lookup when permission checks are done. Fix btrfs_get_acl to avoid lookups and locking when the inode acls fields are set to null. Fix btrfs_get_acl to use the right return value from __btrfs_getxattr when deciding to cache a NULL acl. It was storing a NULL acl when __btrfs_getxattr return -ENOENT, but __btrfs_getxattr was actually returning -ENODATA for this case. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 98bd5069d54..dc812ec551f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3047,8 +3047,8 @@ static noinline void init_btrfs_i(struct inode *inode)
{
struct btrfs_inode *bi = BTRFS_I(inode);
- bi->i_acl = NULL;
- bi->i_default_acl = NULL;
+ bi->i_acl = BTRFS_ACL_NOT_CACHED;
+ bi->i_default_acl = BTRFS_ACL_NOT_CACHED;
bi->generation = 0;
bi->sequence = 0;