All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/556: add a check to make sure ext4 supports encrypted casefolding
@ 2021-06-21 16:49 Theodore Ts'o
  2021-06-21 17:00 ` Darrick J. Wong
  2021-06-21 17:37 ` Eric Biggers
  0 siblings, 2 replies; 4+ messages in thread
From: Theodore Ts'o @ 2021-06-21 16:49 UTC (permalink / raw)
  To: fstests; +Cc: Theodore Ts'o

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-21 18:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 16:49 [PATCH] generic/556: add a check to make sure ext4 supports encrypted casefolding Theodore Ts'o
2021-06-21 17:00 ` Darrick J. Wong
2021-06-21 17:37 ` Eric Biggers
2022-04-21 18:01   ` Eric Biggers

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.