From: Fengnan Chang <changfengnan@vivo.com>
To: jaegeuk@kernel.org, chao@kernel.org, tytso@mit.edu,
adilger.kernel@dilger.ca, axboe@kernel.dk
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-ext4@vger.kernel.org, linux-block@vger.kernel.org,
Fengnan Chang <changfengnan@vivo.com>
Subject: [PATCH 3/3] ext4: notify when device not supprt inlinecrypt
Date: Mon, 18 Apr 2022 14:33:12 +0800 [thread overview]
Message-ID: <20220418063312.63181-3-changfengnan@vivo.com> (raw)
In-Reply-To: <20220418063312.63181-1-changfengnan@vivo.com>
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(+)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 81749eaddf4c..f91454d3a877 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -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 */
--
2.32.0
prev parent reply other threads:[~2022-04-18 6:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 6:33 [PATCH 1/3] blk-crypto: introduce blk_crypto_supported Fengnan Chang
2022-04-18 6:33 ` [PATCH 2/3] f2fs: notify when device not supprt inlinecrypt Fengnan Chang
2022-04-18 7:22 ` Eric Biggers
2022-04-18 7:34 ` 常凤楠
2022-04-18 22:27 ` Eric Biggers
2022-04-18 22:43 ` Theodore Ts'o
2022-04-19 3:14 ` 常凤楠
2022-04-19 3:18 ` Eric Biggers
2022-04-19 3:22 ` 常凤楠
2022-04-18 6:33 ` Fengnan Chang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220418063312.63181-3-changfengnan@vivo.com \
--to=changfengnan@vivo.com \
--cc=adilger.kernel@dilger.ca \
--cc=axboe@kernel.dk \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox