Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144233
b: refs/heads/master
c: 7b1a14b
h: refs/heads/master
i:
  144231: b047737
v: v3
  • Loading branch information
Chris Mason committed Apr 27, 2009
1 parent a1466ca commit f2c779d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 21380931eb4da4e29ac663d0221581282cbba208
refs/heads/master: 7b1a14bbb0e547aaa4d30cc376e6c8c12539ab0f
18 changes: 13 additions & 5 deletions trunk/fs/btrfs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,20 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
return ERR_PTR(-EINVAL);
}

/* Handle the cached NULL acl case without locking */
acl = ACCESS_ONCE(*p_acl);
if (!acl)
return acl;

spin_lock(&inode->i_lock);
if (*p_acl != BTRFS_ACL_NOT_CACHED)
acl = posix_acl_dup(*p_acl);
acl = *p_acl;
if (acl != BTRFS_ACL_NOT_CACHED)
acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);

if (acl)
if (acl != BTRFS_ACL_NOT_CACHED)
return acl;


size = __btrfs_getxattr(inode, name, "", 0);
if (size > 0) {
value = kzalloc(size, GFP_NOFS);
Expand All @@ -80,9 +85,12 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
btrfs_update_cached_acl(inode, p_acl, acl);
}
kfree(value);
} else if (size == -ENOENT) {
} else if (size == -ENOENT || size == -ENODATA || size == 0) {
/* FIXME, who returns -ENOENT? I think nobody */
acl = NULL;
btrfs_update_cached_acl(inode, p_acl, acl);
} else {
acl = ERR_PTR(-EIO);
}

return acl;
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f2c779d

Please sign in to comment.