diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/acl.c | 21 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 2 | ||||
-rw-r--r-- | fs/btrfs/export.c | 4 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 17 |
4 files changed, 28 insertions, 16 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 2222d161c7b6..6ae2c8cac9d5 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -185,18 +185,23 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, | |||
185 | return ret; | 185 | return ret; |
186 | } | 186 | } |
187 | 187 | ||
188 | int btrfs_check_acl(struct inode *inode, int mask) | 188 | int btrfs_check_acl(struct inode *inode, int mask, unsigned int flags) |
189 | { | 189 | { |
190 | struct posix_acl *acl; | ||
191 | int error = -EAGAIN; | 190 | int error = -EAGAIN; |
192 | 191 | ||
193 | acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS); | 192 | if (flags & IPERM_FLAG_RCU) { |
193 | if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) | ||
194 | error = -ECHILD; | ||
194 | 195 | ||
195 | if (IS_ERR(acl)) | 196 | } else { |
196 | return PTR_ERR(acl); | 197 | struct posix_acl *acl; |
197 | if (acl) { | 198 | acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS); |
198 | error = posix_acl_permission(inode, acl, mask); | 199 | if (IS_ERR(acl)) |
199 | posix_acl_release(acl); | 200 | return PTR_ERR(acl); |
201 | if (acl) { | ||
202 | error = posix_acl_permission(inode, acl, mask); | ||
203 | posix_acl_release(acl); | ||
204 | } | ||
200 | } | 205 | } |
201 | 206 | ||
202 | return error; | 207 | return error; |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index af52f6d7a4d8..a142d204b526 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2544,7 +2544,7 @@ int btrfs_sync_fs(struct super_block *sb, int wait); | |||
2544 | 2544 | ||
2545 | /* acl.c */ | 2545 | /* acl.c */ |
2546 | #ifdef CONFIG_BTRFS_FS_POSIX_ACL | 2546 | #ifdef CONFIG_BTRFS_FS_POSIX_ACL |
2547 | int btrfs_check_acl(struct inode *inode, int mask); | 2547 | int btrfs_check_acl(struct inode *inode, int mask, unsigned int flags); |
2548 | #else | 2548 | #else |
2549 | #define btrfs_check_acl NULL | 2549 | #define btrfs_check_acl NULL |
2550 | #endif | 2550 | #endif |
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 659f532d26a0..0ccf9a8afcdf 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
@@ -110,7 +110,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid, | |||
110 | 110 | ||
111 | dentry = d_obtain_alias(inode); | 111 | dentry = d_obtain_alias(inode); |
112 | if (!IS_ERR(dentry)) | 112 | if (!IS_ERR(dentry)) |
113 | dentry->d_op = &btrfs_dentry_operations; | 113 | d_set_d_op(dentry, &btrfs_dentry_operations); |
114 | return dentry; | 114 | return dentry; |
115 | fail: | 115 | fail: |
116 | srcu_read_unlock(&fs_info->subvol_srcu, index); | 116 | srcu_read_unlock(&fs_info->subvol_srcu, index); |
@@ -225,7 +225,7 @@ static struct dentry *btrfs_get_parent(struct dentry *child) | |||
225 | key.offset = 0; | 225 | key.offset = 0; |
226 | dentry = d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL)); | 226 | dentry = d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL)); |
227 | if (!IS_ERR(dentry)) | 227 | if (!IS_ERR(dentry)) |
228 | dentry->d_op = &btrfs_dentry_operations; | 228 | d_set_d_op(dentry, &btrfs_dentry_operations); |
229 | return dentry; | 229 | return dentry; |
230 | fail: | 230 | fail: |
231 | btrfs_free_path(path); | 231 | btrfs_free_path(path); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 72f31ecb5c90..a0ff46a47895 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4084,7 +4084,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
4084 | int index; | 4084 | int index; |
4085 | int ret; | 4085 | int ret; |
4086 | 4086 | ||
4087 | dentry->d_op = &btrfs_dentry_operations; | 4087 | d_set_d_op(dentry, &btrfs_dentry_operations); |
4088 | 4088 | ||
4089 | if (dentry->d_name.len > BTRFS_NAME_LEN) | 4089 | if (dentry->d_name.len > BTRFS_NAME_LEN) |
4090 | return ERR_PTR(-ENAMETOOLONG); | 4090 | return ERR_PTR(-ENAMETOOLONG); |
@@ -4127,7 +4127,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
4127 | return inode; | 4127 | return inode; |
4128 | } | 4128 | } |
4129 | 4129 | ||
4130 | static int btrfs_dentry_delete(struct dentry *dentry) | 4130 | static int btrfs_dentry_delete(const struct dentry *dentry) |
4131 | { | 4131 | { |
4132 | struct btrfs_root *root; | 4132 | struct btrfs_root *root; |
4133 | 4133 | ||
@@ -6495,6 +6495,13 @@ struct inode *btrfs_alloc_inode(struct super_block *sb) | |||
6495 | return inode; | 6495 | return inode; |
6496 | } | 6496 | } |
6497 | 6497 | ||
6498 | static void btrfs_i_callback(struct rcu_head *head) | ||
6499 | { | ||
6500 | struct inode *inode = container_of(head, struct inode, i_rcu); | ||
6501 | INIT_LIST_HEAD(&inode->i_dentry); | ||
6502 | kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); | ||
6503 | } | ||
6504 | |||
6498 | void btrfs_destroy_inode(struct inode *inode) | 6505 | void btrfs_destroy_inode(struct inode *inode) |
6499 | { | 6506 | { |
6500 | struct btrfs_ordered_extent *ordered; | 6507 | struct btrfs_ordered_extent *ordered; |
@@ -6564,7 +6571,7 @@ void btrfs_destroy_inode(struct inode *inode) | |||
6564 | inode_tree_del(inode); | 6571 | inode_tree_del(inode); |
6565 | btrfs_drop_extent_cache(inode, 0, (u64)-1, 0); | 6572 | btrfs_drop_extent_cache(inode, 0, (u64)-1, 0); |
6566 | free: | 6573 | free: |
6567 | kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); | 6574 | call_rcu(&inode->i_rcu, btrfs_i_callback); |
6568 | } | 6575 | } |
6569 | 6576 | ||
6570 | int btrfs_drop_inode(struct inode *inode) | 6577 | int btrfs_drop_inode(struct inode *inode) |
@@ -7204,11 +7211,11 @@ static int btrfs_set_page_dirty(struct page *page) | |||
7204 | return __set_page_dirty_nobuffers(page); | 7211 | return __set_page_dirty_nobuffers(page); |
7205 | } | 7212 | } |
7206 | 7213 | ||
7207 | static int btrfs_permission(struct inode *inode, int mask) | 7214 | static int btrfs_permission(struct inode *inode, int mask, unsigned int flags) |
7208 | { | 7215 | { |
7209 | if ((BTRFS_I(inode)->flags & BTRFS_INODE_READONLY) && (mask & MAY_WRITE)) | 7216 | if ((BTRFS_I(inode)->flags & BTRFS_INODE_READONLY) && (mask & MAY_WRITE)) |
7210 | return -EACCES; | 7217 | return -EACCES; |
7211 | return generic_permission(inode, mask, btrfs_check_acl); | 7218 | return generic_permission(inode, mask, flags, btrfs_check_acl); |
7212 | } | 7219 | } |
7213 | 7220 | ||
7214 | static const struct inode_operations btrfs_dir_inode_operations = { | 7221 | static const struct inode_operations btrfs_dir_inode_operations = { |