@@ -48,6 +48,7 @@
#include <linux/fsnotify.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
+#include <linux/blk-crypto.h>
#include "ext4.h"
#include "ext4_extents.h" /* Needed for trace points definition */
@@ -5466,6 +5467,17 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
"the device does not support discard");
}
+#ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
+ if (sb->s_flags & SB_INLINECRYPT) {
+ struct request_queue *q = bdev_get_queue(sb->s_bdev);
+
+ if (!blk_crypto_supported(q)) {
+ ext4_msg(sb, KERN_WARNING,
+ "mounting with \"inlinecrypt\" option, but the device does not support inlinecrypt");
+ sb->s_flags &= ~SB_INLINECRYPT;
+ }
+ }
+#endif
+
if (es->s_error_count)
mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */
Notify when mount filesystem with -o inlinecrypt option, but the device not support inlinecrypt. Signed-off-by: Fengnan Chang <changfengnan@vivo.com> --- fs/ext4/super.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)