diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-10-28 00:12:09 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-10-28 00:38:21 -0400 |
commit | b8b60e1a65893728ca868493cb4c4b64b55e7f9c (patch) | |
tree | 8ddbb5ef30fcf2295e4e264234629e2cce220ad8 /fs/f2fs/acl.c | |
parent | 4625d6aac2d00a18f7bcc15bffe41e9de3a25332 (diff) |
f2fs: clean up acl flow for better readability
This patch cleans up a couple of acl codes.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/acl.c')
-rw-r--r-- | fs/f2fs/acl.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index b7826ec1b470..f1a697584651 100644 --- a/fs/f2fs/acl.c +++ b/fs/f2fs/acl.c | |||
@@ -262,8 +262,8 @@ static int f2fs_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
262 | 262 | ||
263 | int f2fs_init_acl(struct inode *inode, struct inode *dir) | 263 | int f2fs_init_acl(struct inode *inode, struct inode *dir) |
264 | { | 264 | { |
265 | struct posix_acl *acl = NULL; | ||
266 | struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); | 265 | struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); |
266 | struct posix_acl *acl = NULL; | ||
267 | int error = 0; | 267 | int error = 0; |
268 | 268 | ||
269 | if (!S_ISLNK(inode->i_mode)) { | 269 | if (!S_ISLNK(inode->i_mode)) { |
@@ -276,19 +276,19 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir) | |||
276 | inode->i_mode &= ~current_umask(); | 276 | inode->i_mode &= ~current_umask(); |
277 | } | 277 | } |
278 | 278 | ||
279 | if (test_opt(sbi, POSIX_ACL) && acl) { | 279 | if (!test_opt(sbi, POSIX_ACL) || !acl) |
280 | goto cleanup; | ||
280 | 281 | ||
281 | if (S_ISDIR(inode->i_mode)) { | 282 | if (S_ISDIR(inode->i_mode)) { |
282 | error = f2fs_set_acl(inode, ACL_TYPE_DEFAULT, acl); | 283 | error = f2fs_set_acl(inode, ACL_TYPE_DEFAULT, acl); |
283 | if (error) | 284 | if (error) |
284 | goto cleanup; | 285 | goto cleanup; |
285 | } | ||
286 | error = posix_acl_create(&acl, GFP_KERNEL, &inode->i_mode); | ||
287 | if (error < 0) | ||
288 | return error; | ||
289 | if (error > 0) | ||
290 | error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl); | ||
291 | } | 286 | } |
287 | error = posix_acl_create(&acl, GFP_KERNEL, &inode->i_mode); | ||
288 | if (error < 0) | ||
289 | return error; | ||
290 | if (error > 0) | ||
291 | error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl); | ||
292 | cleanup: | 292 | cleanup: |
293 | posix_acl_release(acl); | 293 | posix_acl_release(acl); |
294 | return error; | 294 | return error; |
@@ -313,6 +313,7 @@ int f2fs_acl_chmod(struct inode *inode) | |||
313 | error = posix_acl_chmod(&acl, GFP_KERNEL, mode); | 313 | error = posix_acl_chmod(&acl, GFP_KERNEL, mode); |
314 | if (error) | 314 | if (error) |
315 | return error; | 315 | return error; |
316 | |||
316 | error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl); | 317 | error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl); |
317 | posix_acl_release(acl); | 318 | posix_acl_release(acl); |
318 | return error; | 319 | return error; |