opp: Call the missing clk_put() on error
[linux-2.6-microblaze.git] / fs / f2fs / namei.c
index 84e4bbc..6edb1ab 100644 (file)
@@ -28,6 +28,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
        nid_t ino;
        struct inode *inode;
        bool nid_free = false;
+       bool encrypt = false;
        int xattr_size = 0;
        int err;
 
@@ -69,13 +70,17 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
                F2FS_I(inode)->i_projid = make_kprojid(&init_user_ns,
                                                        F2FS_DEF_PROJID);
 
+       err = fscrypt_prepare_new_inode(dir, inode, &encrypt);
+       if (err)
+               goto fail_drop;
+
        err = dquot_initialize(inode);
        if (err)
                goto fail_drop;
 
        set_inode_flag(inode, FI_NEW_INODE);
 
-       if (f2fs_may_encrypt(dir, inode))
+       if (encrypt)
                f2fs_set_encrypted_inode(inode);
 
        if (f2fs_sb_has_extra_attr(sbi)) {
@@ -492,6 +497,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
        }
 
        err = f2fs_prepare_lookup(dir, dentry, &fname);
+       generic_set_encrypted_ci_d_ops(dentry);
        if (err == -ENOENT)
                goto out_splice;
        if (err)
@@ -707,7 +713,7 @@ out_f2fs_handle_failed_inode:
        f2fs_handle_failed_inode(inode);
 out_free_encrypted_link:
        if (disk_link.name != (unsigned char *)symname)
-               kvfree(disk_link.name);
+               kfree(disk_link.name);
        return err;
 }