Commit b8b60e1a authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: clean up acl flow for better readability

This patch cleans up a couple of acl codes.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
parent 4625d6aa
...@@ -262,8 +262,8 @@ static int f2fs_set_acl(struct inode *inode, int type, struct posix_acl *acl) ...@@ -262,8 +262,8 @@ static int f2fs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
int f2fs_init_acl(struct inode *inode, struct inode *dir) int f2fs_init_acl(struct inode *inode, struct inode *dir)
{ {
struct posix_acl *acl = NULL;
struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
struct posix_acl *acl = NULL;
int error = 0; int error = 0;
if (!S_ISLNK(inode->i_mode)) { if (!S_ISLNK(inode->i_mode)) {
...@@ -276,7 +276,8 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir) ...@@ -276,7 +276,8 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir)
inode->i_mode &= ~current_umask(); inode->i_mode &= ~current_umask();
} }
if (test_opt(sbi, POSIX_ACL) && acl) { if (!test_opt(sbi, POSIX_ACL) || !acl)
goto cleanup;
if (S_ISDIR(inode->i_mode)) { if (S_ISDIR(inode->i_mode)) {
error = f2fs_set_acl(inode, ACL_TYPE_DEFAULT, acl); error = f2fs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
...@@ -288,7 +289,6 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir) ...@@ -288,7 +289,6 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir)
return error; return error;
if (error > 0) if (error > 0)
error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl); error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl);
}
cleanup: cleanup:
posix_acl_release(acl); posix_acl_release(acl);
return error; return error;
...@@ -313,6 +313,7 @@ int f2fs_acl_chmod(struct inode *inode) ...@@ -313,6 +313,7 @@ int f2fs_acl_chmod(struct inode *inode)
error = posix_acl_chmod(&acl, GFP_KERNEL, mode); error = posix_acl_chmod(&acl, GFP_KERNEL, mode);
if (error) if (error)
return error; return error;
error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl); error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl);
posix_acl_release(acl); posix_acl_release(acl);
return error; return error;
......
...@@ -36,9 +36,9 @@ struct f2fs_acl_header { ...@@ -36,9 +36,9 @@ struct f2fs_acl_header {
#ifdef CONFIG_F2FS_FS_POSIX_ACL #ifdef CONFIG_F2FS_FS_POSIX_ACL
extern struct posix_acl *f2fs_get_acl(struct inode *inode, int type); extern struct posix_acl *f2fs_get_acl(struct inode *, int);
extern int f2fs_acl_chmod(struct inode *inode); extern int f2fs_acl_chmod(struct inode *);
extern int f2fs_init_acl(struct inode *inode, struct inode *dir); extern int f2fs_init_acl(struct inode *, struct inode *);
#else #else
#define f2fs_check_acl NULL #define f2fs_check_acl NULL
#define f2fs_get_acl NULL #define f2fs_get_acl NULL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment