Merge tag 'kgdb-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt...
[linux-2.6-microblaze.git] / fs / f2fs / xattr.c
index 65afcc3..8159fae 100644 (file)
@@ -327,7 +327,7 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage,
        void *last_addr = NULL;
        nid_t xnid = F2FS_I(inode)->i_xattr_nid;
        unsigned int inline_size = inline_xattr_size(inode);
-       int err = 0;
+       int err;
 
        if (!xnid && !inline_size)
                return -ENODATA;
@@ -515,7 +515,7 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
                void *buffer, size_t buffer_size, struct page *ipage)
 {
        struct f2fs_xattr_entry *entry = NULL;
-       int error = 0;
+       int error;
        unsigned int size, len;
        void *base_addr = NULL;
        int base_size;
@@ -562,7 +562,7 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
        struct inode *inode = d_inode(dentry);
        struct f2fs_xattr_entry *entry;
        void *base_addr, *last_base_addr;
-       int error = 0;
+       int error;
        size_t rest = buffer_size;
 
        down_read(&F2FS_I(inode)->i_xattr_sem);
@@ -632,7 +632,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
        int found, newsize;
        size_t len;
        __u32 new_hsize;
-       int error = 0;
+       int error;
 
        if (name == NULL)
                return -EINVAL;
@@ -673,7 +673,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
                }
 
                if (value && f2fs_xattr_value_same(here, value, size))
-                       goto exit;
+                       goto same;
        } else if ((flags & XATTR_REPLACE)) {
                error = -ENODATA;
                goto exit;
@@ -738,17 +738,20 @@ static int __f2fs_setxattr(struct inode *inode, int index,
        if (error)
                goto exit;
 
-       if (is_inode_flag_set(inode, FI_ACL_MODE)) {
-               inode->i_mode = F2FS_I(inode)->i_acl_mode;
-               inode->i_ctime = current_time(inode);
-               clear_inode_flag(inode, FI_ACL_MODE);
-       }
        if (index == F2FS_XATTR_INDEX_ENCRYPTION &&
                        !strcmp(name, F2FS_XATTR_NAME_ENCRYPTION_CONTEXT))
                f2fs_set_encrypted_inode(inode);
        f2fs_mark_inode_dirty_sync(inode, true);
        if (!error && S_ISDIR(inode->i_mode))
                set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_CP);
+
+same:
+       if (is_inode_flag_set(inode, FI_ACL_MODE)) {
+               inode->i_mode = F2FS_I(inode)->i_acl_mode;
+               inode->i_ctime = current_time(inode);
+               clear_inode_flag(inode, FI_ACL_MODE);
+       }
+
 exit:
        kfree(base_addr);
        return error;