Merge 4.14.94 into android-4.14-p
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / fs / ext4 / super.c
index d0049064f62fdeb927744df7b8fc7cd282ab173c..040fd63286941f7f3411a529b8e8486fd5060893 100644 (file)
@@ -1105,9 +1105,7 @@ void ext4_clear_inode(struct inode *inode)
                jbd2_free_inode(EXT4_I(inode)->jinode);
                EXT4_I(inode)->jinode = NULL;
        }
-#ifdef CONFIG_EXT4_FS_ENCRYPTION
-       fscrypt_put_encryption_info(inode, NULL);
-#endif
+       fscrypt_put_encryption_info(inode);
 }
 
 static struct inode *ext4_nfs_get_inode(struct super_block *sb,
@@ -1227,7 +1225,8 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,
                        ext4_clear_inode_state(inode,
                                        EXT4_STATE_MAY_INLINE_DATA);
                        /*
-                        * Update inode->i_flags - e.g. S_DAX may get disabled
+                        * Update inode->i_flags - S_ENCRYPTED will be enabled,
+                        * S_DAX may be disabled
                         */
                        ext4_set_inode_flags(inode);
                }
@@ -1252,7 +1251,10 @@ retry:
                                    ctx, len, 0);
        if (!res) {
                ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT);
-               /* Update inode->i_flags - e.g. S_DAX may get disabled */
+               /*
+                * Update inode->i_flags - S_ENCRYPTED will be enabled,
+                * S_DAX may be disabled
+                */
                ext4_set_inode_flags(inode);
                res = ext4_mark_inode_dirty(handle, inode);
                if (res)
@@ -1283,14 +1285,9 @@ static const struct fscrypt_operations ext4_cryptops = {
        .get_context            = ext4_get_context,
        .set_context            = ext4_set_context,
        .dummy_context          = ext4_dummy_context,
-       .is_encrypted           = ext4_encrypted_inode,
        .empty_dir              = ext4_empty_dir,
        .max_namelen            = ext4_max_namelen,
 };
-#else
-static const struct fscrypt_operations ext4_cryptops = {
-       .is_encrypted           = ext4_encrypted_inode,
-};
 #endif
 
 #ifdef CONFIG_QUOTA
@@ -4118,7 +4115,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_op = &ext4_sops;
        sb->s_export_op = &ext4_export_ops;
        sb->s_xattr = ext4_xattr_handlers;
+#ifdef CONFIG_EXT4_FS_ENCRYPTION
        sb->s_cop = &ext4_cryptops;
+#endif
 #ifdef CONFIG_QUOTA
        sb->dq_op = &ext4_quota_operations;
        if (ext4_has_feature_quota(sb))