diff options
author | Yan, Zheng <zheng.yan@oracle.com> | 2009-11-12 04:35:27 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-12-17 12:33:34 -0500 |
commit | f34f57a3ab4e73304d78c125682f1a53cd3975f2 (patch) | |
tree | 359aff6491d3e92b3901ea78dc164d41209d3eea /fs/btrfs/acl.c | |
parent | 8082510e7124cc50d728f1b875639cb4e22312cc (diff) |
Btrfs: Pass transaction handle to security and ACL initialization functions
Pass transaction handle down to security and ACL initialization
functions, so we can avoid starting nested transactions
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/acl.c')
-rw-r--r-- | fs/btrfs/acl.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 361604244271..1898f8555f06 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -94,7 +94,8 @@ static int btrfs_xattr_get_acl(struct inode *inode, int type, | |||
94 | /* | 94 | /* |
95 | * Needs to be called with fs_mutex held | 95 | * Needs to be called with fs_mutex held |
96 | */ | 96 | */ |
97 | static int btrfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) | 97 | static int btrfs_set_acl(struct btrfs_trans_handle *trans, |
98 | struct inode *inode, struct posix_acl *acl, int type) | ||
98 | { | 99 | { |
99 | int ret, size = 0; | 100 | int ret, size = 0; |
100 | const char *name; | 101 | const char *name; |
@@ -140,8 +141,7 @@ static int btrfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
140 | goto out; | 141 | goto out; |
141 | } | 142 | } |
142 | 143 | ||
143 | ret = __btrfs_setxattr(inode, name, value, size, 0); | 144 | ret = __btrfs_setxattr(trans, inode, name, value, size, 0); |
144 | |||
145 | out: | 145 | out: |
146 | kfree(value); | 146 | kfree(value); |
147 | 147 | ||
@@ -154,7 +154,7 @@ out: | |||
154 | static int btrfs_xattr_set_acl(struct inode *inode, int type, | 154 | static int btrfs_xattr_set_acl(struct inode *inode, int type, |
155 | const void *value, size_t size) | 155 | const void *value, size_t size) |
156 | { | 156 | { |
157 | int ret = 0; | 157 | int ret; |
158 | struct posix_acl *acl = NULL; | 158 | struct posix_acl *acl = NULL; |
159 | 159 | ||
160 | if (value) { | 160 | if (value) { |
@@ -167,7 +167,7 @@ static int btrfs_xattr_set_acl(struct inode *inode, int type, | |||
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | ret = btrfs_set_acl(inode, acl, type); | 170 | ret = btrfs_set_acl(NULL, inode, acl, type); |
171 | 171 | ||
172 | posix_acl_release(acl); | 172 | posix_acl_release(acl); |
173 | 173 | ||
@@ -221,7 +221,8 @@ int btrfs_check_acl(struct inode *inode, int mask) | |||
221 | * stuff has been fixed to work with that. If the locking stuff changes, we | 221 | * stuff has been fixed to work with that. If the locking stuff changes, we |
222 | * need to re-evaluate the acl locking stuff. | 222 | * need to re-evaluate the acl locking stuff. |
223 | */ | 223 | */ |
224 | int btrfs_init_acl(struct inode *inode, struct inode *dir) | 224 | int btrfs_init_acl(struct btrfs_trans_handle *trans, |
225 | struct inode *inode, struct inode *dir) | ||
225 | { | 226 | { |
226 | struct posix_acl *acl = NULL; | 227 | struct posix_acl *acl = NULL; |
227 | int ret = 0; | 228 | int ret = 0; |
@@ -246,7 +247,8 @@ int btrfs_init_acl(struct inode *inode, struct inode *dir) | |||
246 | mode_t mode; | 247 | mode_t mode; |
247 | 248 | ||
248 | if (S_ISDIR(inode->i_mode)) { | 249 | if (S_ISDIR(inode->i_mode)) { |
249 | ret = btrfs_set_acl(inode, acl, ACL_TYPE_DEFAULT); | 250 | ret = btrfs_set_acl(trans, inode, acl, |
251 | ACL_TYPE_DEFAULT); | ||
250 | if (ret) | 252 | if (ret) |
251 | goto failed; | 253 | goto failed; |
252 | } | 254 | } |
@@ -261,7 +263,7 @@ int btrfs_init_acl(struct inode *inode, struct inode *dir) | |||
261 | inode->i_mode = mode; | 263 | inode->i_mode = mode; |
262 | if (ret > 0) { | 264 | if (ret > 0) { |
263 | /* we need an acl */ | 265 | /* we need an acl */ |
264 | ret = btrfs_set_acl(inode, clone, | 266 | ret = btrfs_set_acl(trans, inode, clone, |
265 | ACL_TYPE_ACCESS); | 267 | ACL_TYPE_ACCESS); |
266 | } | 268 | } |
267 | } | 269 | } |
@@ -294,7 +296,7 @@ int btrfs_acl_chmod(struct inode *inode) | |||
294 | 296 | ||
295 | ret = posix_acl_chmod_masq(clone, inode->i_mode); | 297 | ret = posix_acl_chmod_masq(clone, inode->i_mode); |
296 | if (!ret) | 298 | if (!ret) |
297 | ret = btrfs_set_acl(inode, clone, ACL_TYPE_ACCESS); | 299 | ret = btrfs_set_acl(NULL, inode, clone, ACL_TYPE_ACCESS); |
298 | 300 | ||
299 | posix_acl_release(clone); | 301 | posix_acl_release(clone); |
300 | 302 | ||
@@ -320,7 +322,8 @@ int btrfs_acl_chmod(struct inode *inode) | |||
320 | return 0; | 322 | return 0; |
321 | } | 323 | } |
322 | 324 | ||
323 | int btrfs_init_acl(struct inode *inode, struct inode *dir) | 325 | int btrfs_init_acl(struct btrfs_trans_handle *trans, |
326 | struct inode *inode, struct inode *dir) | ||
324 | { | 327 | { |
325 | return 0; | 328 | return 0; |
326 | } | 329 | } |