All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: fstests@vger.kernel.org
Cc: "Theodore Ts'o" <tytso@mit.edu>
Subject: [PATCH] generic/556: add a check to make sure ext4 supports encrypted casefolding
Date: Mon, 21 Jun 2021 12:49:01 -0400	[thread overview]
Message-ID: <20210621164901.1809010-1-tytso@mit.edu> (raw)

Some older kernels support ext4 file systems with encryption enabled,
and with casefold enabled, but not file systems have both encryption
*and* casefolding enabled.  On those kernels, generic/556 will fail.
Fortunately, we can test if ext4 supports encrypted casefold via the
presence of /sys/fs/ext4/features/encrypted_casefold.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 common/casefold   | 17 +++++++++++++++++
 tests/generic/556 |  1 +
 2 files changed, 18 insertions(+)

diff --git a/common/casefold b/common/casefold
index 9172d818..7b76b986 100644
--- a/common/casefold
+++ b/common/casefold
@@ -43,6 +43,23 @@ _require_scratch_casefold()
 	_require_command "$LSATTR_PROG" lsattr
 }
 
+_require_encrypted_casefold ()
+{
+    case $FSTYP in
+	ext4)
+	    if test ! -f /sys/fs/ext4/features/casefold ; then
+		_notrun "casefolding not supported"
+	    fi
+	    if test ! -f /sys/fs/ext4/features/encryption ; then
+		_notrun "file system encryption not supported"
+	    fi
+	    if test ! -f /sys/fs/ext4/features/encrypted_casefold ; then
+		_notrun "encrypted casefolding not supported"
+	    fi
+	    ;;
+	esac
+}
+
 _scratch_mkfs_casefold()
 {
 	case $FSTYP in
diff --git a/tests/generic/556 b/tests/generic/556
index 3145188c..7916a08e 100755
--- a/tests/generic/556
+++ b/tests/generic/556
@@ -16,6 +16,7 @@ status=1 # failure is thea default
 . ./common/attr
 
 _supported_fs generic
+_require_encrypted_casefold
 _require_scratch_nocheck
 _require_scratch_casefold
 _require_symlinks
-- 
2.31.0


             reply	other threads:[~2021-06-21 16:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 16:49 Theodore Ts'o [this message]
2021-06-21 17:00 ` [PATCH] generic/556: add a check to make sure ext4 supports encrypted casefolding Darrick J. Wong
2021-06-21 17:37 ` Eric Biggers
2022-04-21 18:01   ` Eric Biggers

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=20210621164901.1809010-1-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=fstests@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.