public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: xiubli@redhat.com
To: fstests@vger.kernel.org
Cc: david@fromorbit.com, djwong@kernel.org, lhenriques@suse.de,
	ceph-devel@vger.kernel.org, jlayton@kernel.org,
	mchangir@redhat.com, Xiubo Li <xiubli@redhat.com>
Subject: [PATCH 2/2] encrypt: add ceph support
Date: Wed, 26 Oct 2022 15:04:18 +0800	[thread overview]
Message-ID: <20221026070418.259351-3-xiubli@redhat.com> (raw)
In-Reply-To: <20221026070418.259351-1-xiubli@redhat.com>

From: Xiubo Li <xiubli@redhat.com>

For ceph we couldn't use the mkfs to check whether the encryption
is support or not, we need to mount it first and then check the
'set_encpolicy', etc.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 common/encrypt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/common/encrypt b/common/encrypt
index fd620c41..e837c9de 100644
--- a/common/encrypt
+++ b/common/encrypt
@@ -153,6 +153,23 @@ _scratch_check_encrypted()
 		# erase the UBI volume; reformated automatically on next mount
 		$UBIUPDATEVOL_PROG ${SCRATCH_DEV} -t
 		;;
+	ceph)
+		# Try to mount the filesystem. We need to check whether the encryption
+		# is support or not via the ioctl cmd, such as 'set_encpolicy'.
+		if ! _try_scratch_mount &>>$seqres.full; then
+			_notrun "kernel is unaware of $FSTYP encryption feature," \
+				"or mkfs options are not compatible with encryption"
+		fi
+
+		mkdir $SCRATCH_MNT/tmpdir
+		if _set_encpolicy $SCRATCH_MNT/tmpdir 2>&1 >>$seqres.full | \
+			grep -Eq 'Inappropriate ioctl for device|Operation not supported'
+		then
+			_notrun "kernel does not support $FSTYP encryption"
+		fi
+		rmdir $SCRATCH_MNT/tmpdir
+		_scratch_unmount
+		;;
 	*)
 		_notrun "No encryption support for $FSTYP"
 		;;
-- 
2.31.1


  parent reply	other threads:[~2022-10-26  7:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  7:04 [PATCH 0/2] encrypt: add ceph support xiubli
2022-10-26  7:04 ` [PATCH 1/2] encrypt: rename _scratch_mkfs_encrypted to _scratch_check_encrypted xiubli
2022-10-26 14:04   ` Zorro Lang
2022-10-27  2:19     ` Xiubo Li
2022-10-26  7:04 ` xiubli [this message]
2022-10-26 14:12   ` [PATCH 2/2] encrypt: add ceph support Zorro Lang
2022-10-27  2:22     ` Xiubo Li

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=20221026070418.259351-3-xiubli@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=jlayton@kernel.org \
    --cc=lhenriques@suse.de \
    --cc=mchangir@redhat.com \
    /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