fscrypt: updates on 4.15-rc4
Cherry-picked from origin/upstream-f2fs-stable-linux-4.9.y:
743205fbb952 fscrypt: move to generic async completion
f1eb0c0b51a5 crypto: introduce crypto wait for async op
e0af083add9b fscrypt: lock mutex before checking for bounce page pool
9e48a9fd98ba fscrypt: new helper function - fscrypt_prepare_setattr()
ec822ff8b5e5 fscrypt: new helper function - fscrypt_prepare_lookup()
98fe83a195e7 fscrypt: new helper function - fscrypt_prepare_rename()
f52187025917 fscrypt: new helper function - fscrypt_prepare_link()
d61dffbd4f3e fscrypt: new helper function - fscrypt_file_open()
5190ed0766fe fscrypt: new helper function - fscrypt_require_key()
8814204af9c1 fscrypt: remove unneeded empty fscrypt_operations structs
8745aa36e439 fscrypt: remove ->is_encrypted()
d750ec720f4d fscrypt: switch from ->is_encrypted() to IS_ENCRYPTED()
685285b0b3d9 fs, fscrypt: add an S_ENCRYPTED inode flag
1617929c3bea fscrypt: clean up include file mess
a0471ef4ed35 fscrypt: fix dereference of NULL user_key_payload
e77e7df06084 fscrypt: make ->dummy_context() return bool
Change-Id: I23f36bfd059c0c576608221e7e1135535646cc5d
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6c8f2bd..0440bef 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1130,7 +1130,8 @@
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);
}
@@ -1151,7 +1152,10 @@
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)
@@ -1166,7 +1170,7 @@
return res;
}
-static int ext4_dummy_context(struct inode *inode)
+static bool ext4_dummy_context(struct inode *inode)
{
return DUMMY_ENCRYPTION_ENABLED(EXT4_SB(inode->i_sb));
}
@@ -1182,14 +1186,9 @@
.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
@@ -3919,7 +3918,9 @@
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))