* [PATCH 1/2] ext4/064 encryption + casefold feature combination WITHOUT dirdata
@ 2026-04-19 18:52 Artem Blagodarenko
2026-04-19 18:52 ` [PATCH 2/2] ext4/065 encryption + casefold + dirdata feature combination Artem Blagodarenko
2026-05-09 17:05 ` [PATCH 1/2] ext4/064 encryption + casefold feature combination WITHOUT dirdata Zorro Lang
0 siblings, 2 replies; 4+ messages in thread
From: Artem Blagodarenko @ 2026-04-19 18:52 UTC (permalink / raw)
To: fstests; +Cc: adilger.kernel, tytso, Artem Blagodarenko
From: Artem Blagodarenko <artem.blagodarenko@gmail.com>
This test verifies that files created in directories with both
encryption and case-insensitive (casefold) attributes work correctly.
See ext4/065 for the same test WITH dirdata feature enabled.
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
---
tests/ext4/064 | 154 +++++++++++++++++++++++++++++++++++++++++++++
tests/ext4/064.out | 17 +++++
2 files changed, 171 insertions(+)
create mode 100755 tests/ext4/064
create mode 100644 tests/ext4/064.out
diff --git a/tests/ext4/064 b/tests/ext4/064
new file mode 100755
index 00000000..6ad865a9
--- /dev/null
+++ b/tests/ext4/064
@@ -0,0 +1,154 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2026 The Lustre Collective. All Rights Reserved.
+# Author: Artem Blagodarenko <ablagodarenko@thelustrecollective.com>
+#
+# FS QA Test ext4/064
+#
+# Test ext4 encryption + casefold feature combination WITHOUT dirdata.
+# This test verifies that files created in directories with both
+# encryption and case-insensitive (casefold) attributes work correctly.
+# See ext4/065 for the same test WITH dirdata feature enabled.
+#
+. ./common/preamble
+_begin_fstest auto quick encrypt casefold
+
+# get standard environment and checks
+. ./common/filter
+. ./common/encrypt
+. ./common/casefold
+. ./common/attr
+
+_exclude_fs ext2
+_exclude_fs ext3
+
+_require_scratch_nocheck
+_require_encrypted_casefold
+_require_command "$CHATTR_PROG" chattr
+_require_command "$LSATTR_PROG" lsattr
+_require_xfs_io_command "set_encpolicy"
+_require_xfs_io_command "add_enckey"
+
+# Helper to add a v2 encryption key and set policy on a directory
+_setup_encrypted_casefold_dir()
+{
+ local dir=$1
+ local raw_key=$(_generate_raw_encryption_key)
+ local keyspec=$(_add_enckey $SCRATCH_MNT "$raw_key" | awk '{print $NF}')
+ _set_encpolicy $dir $keyspec
+ _casefold_set_attr $dir
+ echo $keyspec
+}
+
+# Create a filesystem with both encrypt and casefold features
+_scratch_mkfs -O encrypt,casefold &>>$seqres.full
+_scratch_mount
+
+# Test 1: Create an encrypted + casefolded directory and verify lookups work
+echo "Test 1: Basic encrypted casefold lookup"
+mkdir $SCRATCH_MNT/test1
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test1 > /dev/null
+
+# Create file with lowercase, lookup with uppercase
+echo "hello" > $SCRATCH_MNT/test1/testfile.txt
+if [ -f "$SCRATCH_MNT/test1/TESTFILE.TXT" ]; then
+ echo "Case-insensitive lookup works in encrypted dir"
+else
+ echo "FAIL: Case-insensitive lookup failed in encrypted dir"
+fi
+
+# Verify the exact name on disk is preserved
+if _casefold_check_exact_name "$SCRATCH_MNT/test1" "testfile.txt"; then
+ echo "Original filename preserved"
+else
+ echo "FAIL: Original filename not preserved"
+fi
+
+# Test 2: Create files with different case variations
+echo "Test 2: Conflicting names in encrypted casefold dir"
+mkdir $SCRATCH_MNT/test2
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test2 > /dev/null
+
+echo "first" > $SCRATCH_MNT/test2/MyFile.txt
+# This should fail or overwrite since "MYFILE.TXT" is equivalent
+echo "second" > $SCRATCH_MNT/test2/MYFILE.TXT 2>/dev/null
+content=$(cat $SCRATCH_MNT/test2/myfile.txt)
+echo "Content after writes: $content"
+
+# Test 3: Unicode normalization in encrypted casefold dir
+echo "Test 3: Unicode in encrypted casefold dir"
+mkdir $SCRATCH_MNT/test3
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test3 > /dev/null
+
+# Test with UTF-8 characters
+fr_file1=$(echo -e "cafe\xcc\x81.txt")
+fr_file2=$(echo -e "caf\xc3\xa9.txt")
+echo "french" > "$SCRATCH_MNT/test3/$fr_file1"
+if [ -f "$SCRATCH_MNT/test3/$fr_file2" ]; then
+ echo "Unicode normalization works in encrypted dir"
+else
+ echo "FAIL: Unicode normalization failed in encrypted dir"
+fi
+
+# Test 4: Directory operations in encrypted casefold dir
+echo "Test 4: Directory operations in encrypted casefold dir"
+mkdir $SCRATCH_MNT/test4
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test4 > /dev/null
+
+mkdir $SCRATCH_MNT/test4/SubDir
+if [ -d "$SCRATCH_MNT/test4/SUBDIR" ]; then
+ echo "Directory case-insensitive lookup works"
+else
+ echo "FAIL: Directory case-insensitive lookup failed"
+fi
+
+# Test 5: Verify inheritance of casefold+encryption in subdirectories
+echo "Test 5: Inheritance of attributes"
+mkdir $SCRATCH_MNT/test5
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test5 > /dev/null
+
+mkdir $SCRATCH_MNT/test5/child
+echo "data" > $SCRATCH_MNT/test5/child/file.txt
+if [ -f "$SCRATCH_MNT/test5/CHILD/FILE.TXT" ]; then
+ echo "Attributes inherited correctly"
+else
+ echo "FAIL: Attributes not inherited"
+fi
+
+# Test 6: Remove and recreate with different case
+echo "Test 6: Remove and recreate with different case"
+mkdir $SCRATCH_MNT/test6
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test6 > /dev/null
+
+echo "original" > $SCRATCH_MNT/test6/RemoveMe.txt
+rm $SCRATCH_MNT/test6/REMOVEME.TXT
+echo "recreated" > $SCRATCH_MNT/test6/REMOVEME.TXT
+if _casefold_check_exact_name "$SCRATCH_MNT/test6" "REMOVEME.TXT"; then
+ echo "Recreated file has new case"
+else
+ echo "FAIL: Recreated file case incorrect"
+fi
+
+# Test 7: Hard links in encrypted casefold dir
+echo "Test 7: Hard links in encrypted casefold dir"
+mkdir $SCRATCH_MNT/test7
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test7 > /dev/null
+
+echo "linkdata" > $SCRATCH_MNT/test7/original.txt
+ln $SCRATCH_MNT/test7/original.txt $SCRATCH_MNT/test7/hardlink.txt
+if [ -f "$SCRATCH_MNT/test7/HARDLINK.TXT" ]; then
+ echo "Hard link case-insensitive lookup works"
+else
+ echo "FAIL: Hard link case-insensitive lookup failed"
+fi
+
+# Cleanup and verify filesystem
+_scratch_unmount
+_check_scratch_fs
+
+echo "Encrypted casefold tests completed"
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/064.out b/tests/ext4/064.out
new file mode 100644
index 00000000..0197e51e
--- /dev/null
+++ b/tests/ext4/064.out
@@ -0,0 +1,17 @@
+QA output created by 064
+Test 1: Basic encrypted casefold lookup
+Case-insensitive lookup works in encrypted dir
+Original filename preserved
+Test 2: Conflicting names in encrypted casefold dir
+Content after writes: second
+Test 3: Unicode in encrypted casefold dir
+Unicode normalization works in encrypted dir
+Test 4: Directory operations in encrypted casefold dir
+Directory case-insensitive lookup works
+Test 5: Inheritance of attributes
+Attributes inherited correctly
+Test 6: Remove and recreate with different case
+Recreated file has new case
+Test 7: Hard links in encrypted casefold dir
+Hard link case-insensitive lookup works
+Encrypted casefold tests completed
--
2.43.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] ext4/065 encryption + casefold + dirdata feature combination
2026-04-19 18:52 [PATCH 1/2] ext4/064 encryption + casefold feature combination WITHOUT dirdata Artem Blagodarenko
@ 2026-04-19 18:52 ` Artem Blagodarenko
2026-05-09 17:42 ` Theodore Tso
2026-05-09 17:05 ` [PATCH 1/2] ext4/064 encryption + casefold feature combination WITHOUT dirdata Zorro Lang
1 sibling, 1 reply; 4+ messages in thread
From: Artem Blagodarenko @ 2026-04-19 18:52 UTC (permalink / raw)
To: fstests; +Cc: adilger.kernel, tytso, Artem Blagodarenko
From: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Test ext4 encryption + casefold + dirdata feature combination.
This test verifies that files created in directories with encryption,
case-insensitive (casefold), and dirdata attributes work correctly.
See ext4/064 for the same test WITHOUT dirdata feature.
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
---
tests/ext4/065 | 208 +++++++++++++++++++++++++++++++++++++++++++++
tests/ext4/065.out | 17 ++++
2 files changed, 225 insertions(+)
create mode 100755 tests/ext4/065
create mode 100644 tests/ext4/065.out
diff --git a/tests/ext4/065 b/tests/ext4/065
new file mode 100755
index 00000000..08863ac0
--- /dev/null
+++ b/tests/ext4/065
@@ -0,0 +1,208 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 The Lustre Collective. All Rights Reserved.
+# Author: Artem Blagodarenko <ablagodarenko@thelustrecollective.com>
+#
+# FS QA Test ext4/065
+#
+# Test ext4 encryption + casefold + dirdata feature combination.
+# This test verifies that files created in directories with encryption,
+# case-insensitive (casefold), and dirdata attributes work correctly.
+# See ext4/064 for the same test WITHOUT dirdata feature.
+#
+. ./common/preamble
+_begin_fstest auto quick encrypt casefold
+
+# get standard environment and checks
+. ./common/filter
+. ./common/encrypt
+. ./common/casefold
+. ./common/attr
+
+_exclude_fs ext2
+_exclude_fs ext3
+
+# Check if dirdata feature is supported and can be used with encrypt+casefold
+_require_scratch_dirdata()
+{
+ if test ! -f /sys/fs/ext4/features/dirdata ; then
+ _notrun "dirdata feature not supported by kernel"
+ fi
+
+ # Debug: log e2fsprogs tool paths and versions
+ echo "=== _require_scratch_dirdata debug info ===" >> $seqres.full
+ echo "E2FSCK_PROG: $E2FSCK_PROG" >> $seqres.full
+ echo "E2FSCK_PROG resolved: $(type -P e2fsck)" >> $seqres.full
+ echo "MKFS_EXT4_PROG: $MKFS_EXT4_PROG" >> $seqres.full
+ echo "fsck -t ext4 resolves to: $(type -P fsck.ext4)" >> $seqres.full
+ $E2FSCK_PROG -V >> $seqres.full 2>&1
+ $MKFS_EXT4_PROG -V >> $seqres.full 2>&1
+ echo "=== end debug info ===" >> $seqres.full
+
+ # Also verify that mkfs supports dirdata
+ if ! $MKFS_EXT4_PROG -O dirdata -n $SCRATCH_DEV &>>$seqres.full ; then
+ _notrun "mkfs.ext4 does not support dirdata feature"
+ fi
+
+ # Verify kernel can mount filesystem with encrypt+casefold+dirdata
+ echo "Running: _scratch_mkfs -O encrypt,casefold,dirdata" >> $seqres.full
+ if ! _scratch_mkfs -O encrypt,casefold,dirdata &>>$seqres.full ; then
+ _notrun "failed to create filesystem with encrypt+casefold+dirdata"
+ fi
+ if ! _try_scratch_mount &>>$seqres.full ; then
+ _notrun "kernel cannot mount filesystem with encrypt+casefold+dirdata"
+ fi
+ _scratch_unmount
+}
+
+_require_scratch_nocheck
+_require_encrypted_casefold
+_require_scratch_dirdata
+_require_command "$CHATTR_PROG" chattr
+_require_command "$LSATTR_PROG" lsattr
+_require_xfs_io_command "set_encpolicy"
+_require_xfs_io_command "add_enckey"
+
+# Helper to add a v2 encryption key and set policy on a directory
+_setup_encrypted_casefold_dir()
+{
+ local dir=$1
+ local raw_key=$(_generate_raw_encryption_key)
+ local keyspec=$(_add_enckey $SCRATCH_MNT "$raw_key" | awk '{print $NF}')
+ _set_encpolicy $dir $keyspec
+ _casefold_set_attr $dir
+ echo $keyspec
+}
+
+# Create a filesystem with encrypt, casefold, and dirdata features
+# Debug: log e2fsprogs tool paths and versions
+echo "=== e2fsprogs debug info ===" >> $seqres.full
+echo "E2FSCK_PROG: $E2FSCK_PROG" >> $seqres.full
+echo "E2FSCK_PROG resolved: $(type -P e2fsck)" >> $seqres.full
+echo "MKFS_EXT4_PROG: $MKFS_EXT4_PROG" >> $seqres.full
+echo "FSCK_OPTIONS: $FSCK_OPTIONS" >> $seqres.full
+echo "fsck -t ext4 resolves to: $(type -P fsck.ext4)" >> $seqres.full
+$E2FSCK_PROG -V >> $seqres.full 2>&1
+$MKFS_EXT4_PROG -V >> $seqres.full 2>&1
+echo "=== end e2fsprogs debug info ===" >> $seqres.full
+
+_scratch_mkfs -O encrypt,casefold,dirdata &>>$seqres.full
+_scratch_mount
+
+# Test 1: Create an encrypted + casefolded directory and verify lookups work
+echo "Test 1: Basic encrypted casefold lookup with dirdata"
+mkdir $SCRATCH_MNT/test1
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test1 > /dev/null
+
+# Create file with lowercase, lookup with uppercase
+echo "hello" > $SCRATCH_MNT/test1/testfile.txt
+if [ -f "$SCRATCH_MNT/test1/TESTFILE.TXT" ]; then
+ echo "Case-insensitive lookup works in encrypted dir"
+else
+ echo "FAIL: Case-insensitive lookup failed in encrypted dir"
+fi
+
+# Verify the exact name on disk is preserved
+if _casefold_check_exact_name "$SCRATCH_MNT/test1" "testfile.txt"; then
+ echo "Original filename preserved"
+else
+ echo "FAIL: Original filename not preserved"
+fi
+
+# Test 2: Create files with different case variations
+echo "Test 2: Conflicting names in encrypted casefold dir"
+mkdir $SCRATCH_MNT/test2
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test2 > /dev/null
+
+echo "first" > $SCRATCH_MNT/test2/MyFile.txt
+# This should fail or overwrite since "MYFILE.TXT" is equivalent
+echo "second" > $SCRATCH_MNT/test2/MYFILE.TXT 2>/dev/null
+content=$(cat $SCRATCH_MNT/test2/myfile.txt)
+echo "Content after writes: $content"
+
+# Test 3: Unicode normalization in encrypted casefold dir
+echo "Test 3: Unicode in encrypted casefold dir"
+mkdir $SCRATCH_MNT/test3
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test3 > /dev/null
+
+# Test with UTF-8 characters
+fr_file1=$(echo -e "cafe\xcc\x81.txt")
+fr_file2=$(echo -e "caf\xc3\xa9.txt")
+echo "french" > "$SCRATCH_MNT/test3/$fr_file1"
+if [ -f "$SCRATCH_MNT/test3/$fr_file2" ]; then
+ echo "Unicode normalization works in encrypted dir"
+else
+ echo "FAIL: Unicode normalization failed in encrypted dir"
+fi
+
+# Test 4: Directory operations in encrypted casefold dir
+echo "Test 4: Directory operations in encrypted casefold dir"
+mkdir $SCRATCH_MNT/test4
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test4 > /dev/null
+
+mkdir $SCRATCH_MNT/test4/SubDir
+if [ -d "$SCRATCH_MNT/test4/SUBDIR" ]; then
+ echo "Directory case-insensitive lookup works"
+else
+ echo "FAIL: Directory case-insensitive lookup failed"
+fi
+
+# Test 5: Verify inheritance of casefold+encryption in subdirectories
+echo "Test 5: Inheritance of attributes"
+mkdir $SCRATCH_MNT/test5
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test5 > /dev/null
+
+mkdir $SCRATCH_MNT/test5/child
+echo "data" > $SCRATCH_MNT/test5/child/file.txt
+if [ -f "$SCRATCH_MNT/test5/CHILD/FILE.TXT" ]; then
+ echo "Attributes inherited correctly"
+else
+ echo "FAIL: Attributes not inherited"
+fi
+
+# Test 6: Remove and recreate with different case
+echo "Test 6: Remove and recreate with different case"
+mkdir $SCRATCH_MNT/test6
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test6 > /dev/null
+
+echo "original" > $SCRATCH_MNT/test6/RemoveMe.txt
+rm $SCRATCH_MNT/test6/REMOVEME.TXT
+echo "recreated" > $SCRATCH_MNT/test6/REMOVEME.TXT
+if _casefold_check_exact_name "$SCRATCH_MNT/test6" "REMOVEME.TXT"; then
+ echo "Recreated file has new case"
+else
+ echo "FAIL: Recreated file case incorrect"
+fi
+
+# Test 7: Hard links in encrypted casefold dir
+echo "Test 7: Hard links in encrypted casefold dir"
+mkdir $SCRATCH_MNT/test7
+_setup_encrypted_casefold_dir $SCRATCH_MNT/test7 > /dev/null
+
+echo "linkdata" > $SCRATCH_MNT/test7/original.txt
+ln $SCRATCH_MNT/test7/original.txt $SCRATCH_MNT/test7/hardlink.txt
+if [ -f "$SCRATCH_MNT/test7/HARDLINK.TXT" ]; then
+ echo "Hard link case-insensitive lookup works"
+else
+ echo "FAIL: Hard link case-insensitive lookup failed"
+fi
+
+# Cleanup and verify filesystem
+_scratch_unmount
+
+# Debug: log e2fsprogs tool paths before _check_scratch_fs
+echo "=== e2fsprogs debug info (before _check_scratch_fs) ===" >> $seqres.full
+echo "E2FSCK_PROG: $E2FSCK_PROG" >> $seqres.full
+echo "E2FSCK_PROG resolved: $(type -P e2fsck)" >> $seqres.full
+echo "fsck -t ext4 resolves to: $(type -P fsck.ext4)" >> $seqres.full
+echo "FSCK_OPTIONS: $FSCK_OPTIONS" >> $seqres.full
+$E2FSCK_PROG -V >> $seqres.full 2>&1
+echo "=== end e2fsprogs debug info ===" >> $seqres.full
+
+_check_scratch_fs
+
+echo "Encrypted casefold tests with dirdata completed"
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/065.out b/tests/ext4/065.out
new file mode 100644
index 00000000..e771d884
--- /dev/null
+++ b/tests/ext4/065.out
@@ -0,0 +1,17 @@
+QA output created by 065
+Test 1: Basic encrypted casefold lookup with dirdata
+Case-insensitive lookup works in encrypted dir
+Original filename preserved
+Test 2: Conflicting names in encrypted casefold dir
+Content after writes: second
+Test 3: Unicode in encrypted casefold dir
+Unicode normalization works in encrypted dir
+Test 4: Directory operations in encrypted casefold dir
+Directory case-insensitive lookup works
+Test 5: Inheritance of attributes
+Attributes inherited correctly
+Test 6: Remove and recreate with different case
+Recreated file has new case
+Test 7: Hard links in encrypted casefold dir
+Hard link case-insensitive lookup works
+Encrypted casefold tests with dirdata completed
--
2.43.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] ext4/065 encryption + casefold + dirdata feature combination
2026-04-19 18:52 ` [PATCH 2/2] ext4/065 encryption + casefold + dirdata feature combination Artem Blagodarenko
@ 2026-05-09 17:42 ` Theodore Tso
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Tso @ 2026-05-09 17:42 UTC (permalink / raw)
To: Artem Blagodarenko; +Cc: fstests, adilger.kernel
On Sun, Apr 19, 2026 at 02:52:09PM -0400, Artem Blagodarenko wrote:
> From: Artem Blagodarenko <artem.blagodarenko@gmail.com>
>
> Test ext4 encryption + casefold + dirdata feature combination.
> This test verifies that files created in directories with encryption,
> case-insensitive (casefold), and dirdata attributes work correctly.
> See ext4/064 for the same test WITHOUT dirdata feature.
>
> Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Note that the dirdata feature patches have not landed, and I've
expressed concerns of this patch set[1].
[1] https://lore.kernel.org/all/20260418214359.GA58909@macsyma-wired.lan/
From manual code inspection, the dirdata patch was never changing how
the data was stored. So before we land the xfstests changes, could
you please add support in debugfs to set and get the dirdata stored
for a directory entry, and then change the test to actually _validate_
that when enabling encryption + casefold + dirdata, that the encrypted
hash is stored as a dirdata attribute?
Thanks,
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ext4/064 encryption + casefold feature combination WITHOUT dirdata
2026-04-19 18:52 [PATCH 1/2] ext4/064 encryption + casefold feature combination WITHOUT dirdata Artem Blagodarenko
2026-04-19 18:52 ` [PATCH 2/2] ext4/065 encryption + casefold + dirdata feature combination Artem Blagodarenko
@ 2026-05-09 17:05 ` Zorro Lang
1 sibling, 0 replies; 4+ messages in thread
From: Zorro Lang @ 2026-05-09 17:05 UTC (permalink / raw)
To: Artem Blagodarenko; +Cc: fstests, adilger.kernel, tytso, linux-ext4
On Sun, Apr 19, 2026 at 02:52:08PM -0400, Artem Blagodarenko wrote:
> From: Artem Blagodarenko <artem.blagodarenko@gmail.com>
>
> This test verifies that files created in directories with both
> encryption and case-insensitive (casefold) attributes work correctly.
> See ext4/065 for the same test WITH dirdata feature enabled.
>
> Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
> ---
> tests/ext4/064 | 154 +++++++++++++++++++++++++++++++++++++++++++++
> tests/ext4/064.out | 17 +++++
> 2 files changed, 171 insertions(+)
> create mode 100755 tests/ext4/064
> create mode 100644 tests/ext4/064.out
>
> diff --git a/tests/ext4/064 b/tests/ext4/064
> new file mode 100755
> index 00000000..6ad865a9
> --- /dev/null
> +++ b/tests/ext4/064
> @@ -0,0 +1,154 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Copyright (c) 2026 The Lustre Collective. All Rights Reserved.
> +# Author: Artem Blagodarenko <ablagodarenko@thelustrecollective.com>
> +#
> +# FS QA Test ext4/064
> +#
> +# Test ext4 encryption + casefold feature combination WITHOUT dirdata.
> +# This test verifies that files created in directories with both
> +# encryption and case-insensitive (casefold) attributes work correctly.
> +# See ext4/065 for the same test WITH dirdata feature enabled.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick encrypt casefold
> +
> +# get standard environment and checks
> +. ./common/filter
> +. ./common/encrypt
> +. ./common/casefold
> +. ./common/attr
> +
> +_exclude_fs ext2
> +_exclude_fs ext3
> +
> +_require_scratch_nocheck
> +_require_encrypted_casefold
Do you want to write a new helper names _require_encrypted_casefold? Or do you
mean _require_scratch_casefold at here?
CC ext4-list to get more review points.
Thanks,
Zorro
> +_require_command "$CHATTR_PROG" chattr
> +_require_command "$LSATTR_PROG" lsattr
> +_require_xfs_io_command "set_encpolicy"
> +_require_xfs_io_command "add_enckey"
> +
> +# Helper to add a v2 encryption key and set policy on a directory
> +_setup_encrypted_casefold_dir()
> +{
> + local dir=$1
> + local raw_key=$(_generate_raw_encryption_key)
> + local keyspec=$(_add_enckey $SCRATCH_MNT "$raw_key" | awk '{print $NF}')
> + _set_encpolicy $dir $keyspec
> + _casefold_set_attr $dir
> + echo $keyspec
> +}
> +
> +# Create a filesystem with both encrypt and casefold features
> +_scratch_mkfs -O encrypt,casefold &>>$seqres.full
> +_scratch_mount
> +
> +# Test 1: Create an encrypted + casefolded directory and verify lookups work
> +echo "Test 1: Basic encrypted casefold lookup"
> +mkdir $SCRATCH_MNT/test1
> +_setup_encrypted_casefold_dir $SCRATCH_MNT/test1 > /dev/null
> +
> +# Create file with lowercase, lookup with uppercase
> +echo "hello" > $SCRATCH_MNT/test1/testfile.txt
> +if [ -f "$SCRATCH_MNT/test1/TESTFILE.TXT" ]; then
> + echo "Case-insensitive lookup works in encrypted dir"
> +else
> + echo "FAIL: Case-insensitive lookup failed in encrypted dir"
> +fi
> +
> +# Verify the exact name on disk is preserved
> +if _casefold_check_exact_name "$SCRATCH_MNT/test1" "testfile.txt"; then
> + echo "Original filename preserved"
> +else
> + echo "FAIL: Original filename not preserved"
> +fi
> +
> +# Test 2: Create files with different case variations
> +echo "Test 2: Conflicting names in encrypted casefold dir"
> +mkdir $SCRATCH_MNT/test2
> +_setup_encrypted_casefold_dir $SCRATCH_MNT/test2 > /dev/null
> +
> +echo "first" > $SCRATCH_MNT/test2/MyFile.txt
> +# This should fail or overwrite since "MYFILE.TXT" is equivalent
> +echo "second" > $SCRATCH_MNT/test2/MYFILE.TXT 2>/dev/null
> +content=$(cat $SCRATCH_MNT/test2/myfile.txt)
> +echo "Content after writes: $content"
> +
> +# Test 3: Unicode normalization in encrypted casefold dir
> +echo "Test 3: Unicode in encrypted casefold dir"
> +mkdir $SCRATCH_MNT/test3
> +_setup_encrypted_casefold_dir $SCRATCH_MNT/test3 > /dev/null
> +
> +# Test with UTF-8 characters
> +fr_file1=$(echo -e "cafe\xcc\x81.txt")
> +fr_file2=$(echo -e "caf\xc3\xa9.txt")
> +echo "french" > "$SCRATCH_MNT/test3/$fr_file1"
> +if [ -f "$SCRATCH_MNT/test3/$fr_file2" ]; then
> + echo "Unicode normalization works in encrypted dir"
> +else
> + echo "FAIL: Unicode normalization failed in encrypted dir"
> +fi
> +
> +# Test 4: Directory operations in encrypted casefold dir
> +echo "Test 4: Directory operations in encrypted casefold dir"
> +mkdir $SCRATCH_MNT/test4
> +_setup_encrypted_casefold_dir $SCRATCH_MNT/test4 > /dev/null
> +
> +mkdir $SCRATCH_MNT/test4/SubDir
> +if [ -d "$SCRATCH_MNT/test4/SUBDIR" ]; then
> + echo "Directory case-insensitive lookup works"
> +else
> + echo "FAIL: Directory case-insensitive lookup failed"
> +fi
> +
> +# Test 5: Verify inheritance of casefold+encryption in subdirectories
> +echo "Test 5: Inheritance of attributes"
> +mkdir $SCRATCH_MNT/test5
> +_setup_encrypted_casefold_dir $SCRATCH_MNT/test5 > /dev/null
> +
> +mkdir $SCRATCH_MNT/test5/child
> +echo "data" > $SCRATCH_MNT/test5/child/file.txt
> +if [ -f "$SCRATCH_MNT/test5/CHILD/FILE.TXT" ]; then
> + echo "Attributes inherited correctly"
> +else
> + echo "FAIL: Attributes not inherited"
> +fi
> +
> +# Test 6: Remove and recreate with different case
> +echo "Test 6: Remove and recreate with different case"
> +mkdir $SCRATCH_MNT/test6
> +_setup_encrypted_casefold_dir $SCRATCH_MNT/test6 > /dev/null
> +
> +echo "original" > $SCRATCH_MNT/test6/RemoveMe.txt
> +rm $SCRATCH_MNT/test6/REMOVEME.TXT
> +echo "recreated" > $SCRATCH_MNT/test6/REMOVEME.TXT
> +if _casefold_check_exact_name "$SCRATCH_MNT/test6" "REMOVEME.TXT"; then
> + echo "Recreated file has new case"
> +else
> + echo "FAIL: Recreated file case incorrect"
> +fi
> +
> +# Test 7: Hard links in encrypted casefold dir
> +echo "Test 7: Hard links in encrypted casefold dir"
> +mkdir $SCRATCH_MNT/test7
> +_setup_encrypted_casefold_dir $SCRATCH_MNT/test7 > /dev/null
> +
> +echo "linkdata" > $SCRATCH_MNT/test7/original.txt
> +ln $SCRATCH_MNT/test7/original.txt $SCRATCH_MNT/test7/hardlink.txt
> +if [ -f "$SCRATCH_MNT/test7/HARDLINK.TXT" ]; then
> + echo "Hard link case-insensitive lookup works"
> +else
> + echo "FAIL: Hard link case-insensitive lookup failed"
> +fi
> +
> +# Cleanup and verify filesystem
> +_scratch_unmount
> +_check_scratch_fs
> +
> +echo "Encrypted casefold tests completed"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/ext4/064.out b/tests/ext4/064.out
> new file mode 100644
> index 00000000..0197e51e
> --- /dev/null
> +++ b/tests/ext4/064.out
> @@ -0,0 +1,17 @@
> +QA output created by 064
> +Test 1: Basic encrypted casefold lookup
> +Case-insensitive lookup works in encrypted dir
> +Original filename preserved
> +Test 2: Conflicting names in encrypted casefold dir
> +Content after writes: second
> +Test 3: Unicode in encrypted casefold dir
> +Unicode normalization works in encrypted dir
> +Test 4: Directory operations in encrypted casefold dir
> +Directory case-insensitive lookup works
> +Test 5: Inheritance of attributes
> +Attributes inherited correctly
> +Test 6: Remove and recreate with different case
> +Recreated file has new case
> +Test 7: Hard links in encrypted casefold dir
> +Hard link case-insensitive lookup works
> +Encrypted casefold tests completed
> --
> 2.43.5
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-09 17:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-19 18:52 [PATCH 1/2] ext4/064 encryption + casefold feature combination WITHOUT dirdata Artem Blagodarenko
2026-04-19 18:52 ` [PATCH 2/2] ext4/065 encryption + casefold + dirdata feature combination Artem Blagodarenko
2026-05-09 17:42 ` Theodore Tso
2026-05-09 17:05 ` [PATCH 1/2] ext4/064 encryption + casefold feature combination WITHOUT dirdata Zorro Lang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox