Skip to contentSkip to conversation

statx/statx04: Skip testing casefolded filesystems

PATCH In review Wei Gao via ltp 2 participants 14 messages Jul 1 – Jul 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 statx/statx04: Skip testing casefolded filesystems

On newer kernels (v7.1-rc1+), vfat and exfat implement fileattr_get to support reporting casefolding. This causes the FS_IOC_GETFLAGS ioctl to return success with FS_CASEFOLD_FL set, whereas on older kernels it returned ENOTTY.

Since FS_IOC_GETFLAGS succeeds, statx04 assumes standard writable inode attributes (append, immutable, nodump) are supported on these filesystems. However, they are not, causing the statx() attribute check to fail with TFAIL.

Fix this by checking if the retrieved flags contain FS_CASEFOLD_FL, and if so, skip the test with TCONF. Additionally, define FS_CASEFOLD_FL in include/lapi/fs.h for compatibility with older user-space headers.

This addresses the failures introduced by the following upstream Linux kernel commits:
- 27e0b573dd4a ("exfat: Implement fileattr_get for case sensitivity")
- c92db2ca72fe ("fat: Implement fileattr_get for case sensitivity")

---
 include/lapi/fs.h                         |  4 ++++
 testcases/kernel/syscalls/statx/statx04.c | 10 ++++++++++
 2 files changed, 14 insertions(+)
include/lapi/fs.h +4 -0
index 471ad0a25..0e2ed6e2d 100644
@@ -69,6 +69,10 @@ struct fsxattr {
 # define FS_VERITY_FL	   0x00100000 /* Verity protected inode */
 #endif
 
+#ifndef FS_CASEFOLD_FL
+# define FS_CASEFOLD_FL    0x40000000 /* Folder is case insensitive */
+#endif
+
 #ifndef FS_XFLAG_APPEND
 # define FS_XFLAG_APPEND	0x00000010	/* all writes append */
 #endif
testcases/kernel/syscalls/statx/statx04.c +10 -0
index af30a200e..a4b663d2c 100644
@@ -91,6 +91,16 @@ static void setup(void)
 	if (TST_RET)
 		tst_brk(TBROK | TTERRNO, "Unexpected ioctl() error");
 
+	/*
+	 * On newer kernels (v7.1-rc1+), vfat and exfat implement fileattr_get
+	 * to support reporting casefolding, which causes FS_IOC_GETFLAGS to
+	 * return success with FS_CASEFOLD_FL. However, they do not support
+	 * standard writable inode attributes (append, immutable, nodump).
+	 * Check FS_CASEFOLD_FL to gracefully skip them.
+	 */
+	if (i & FS_CASEFOLD_FL)
+		tst_brk(TCONF, "Casefolded directories/filesystems are not supported for this test");
+
 	for (i = 0, expected_mask = 0; i < ARRAY_SIZE(attr_list); i++)
 		expected_mask |= attr_list[i].attr;
 
Signature · 5 lines
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Wei,

Quoted 1 line · Wei Gao

statx/statx04: Skip testing casefolded filesystems

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Wei Gao via ltp

Hi Wei,

this patch is not correct. We need to filter out via expected_marks the unsupported inode attributes only for exfat and vfat, not blindly TBROK when casefolder attributes are supported.

   if (!strcmp(tst_device->fs_type, "vfat") || !strcmp(tst_device->fs_type, "exfat"))
       expected_mask &= ~(STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP);

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 2 lines
   if (!strcmp(tst_device->fs_type, "vfat") || !strcmp(tst_device->fs_type, "exfat"))
       expected_mask &= ~(STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP);

One more thing: this is a snippet. Remember that we also need to filter out the right kernel version, which is the v7.1 at this point, since it has been released.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

O

Quoted 2 lines · Andrea Cervesato via ltp
Quoted 2 lines
   if (!strcmp(tst_device->fs_type, "vfat") || !strcmp(tst_device->fs_type, "exfat"))
       expected_mask &= ~(STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP);

I guess we also need exclude STATX_ATTR_COMPRESSED?
expected_mask &= ~(STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | STATX_ATTR_NODUMP | STATX_ATTR_COMPRESSED);

But when we do this, meaning the test runs but verifies nothing, just TCONF is more clean.

Quoted 4 lines

One more thing: this is a snippet. Remember that we also need to filter out the right kernel version, which is the v7.1 at this point, since it has been released.

Adding a kernel version check with tst_kvercmp(7, 1, 0) is redundant here. Here is why:

On kernels < v7.1:
vfat/exfat do not support FS_IOC_GETFLAGS at all. The ioctl() call fails with ENOTTY, and the test is immediately skipped with TCONF at the beginning of setup():

if (TST_RET == -1 && TST_ERR == ENOTTY)

	tst_brk(TCONF | TTERRNO, "Inode attributes not supported");

So i suggest we just give fix like following, do you agree?
if (!strcmp(tst_device->fs_type, "vfat") || !strcmp(tst_device->fs_type, "exfat"))

     tst_brk(TCONF, "vfat and exfat filesystems do not support standard attributes");
Quoted 8 lines

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
Quoted 3 lines

So i suggest we just give fix like following, do you agree?
if (!strcmp(tst_device->fs_type, "vfat") || !strcmp(tst_device->fs_type, "exfat"))

     tst_brk(TCONF, "vfat and exfat filesystems do not support standard attributes");

yes you are right, let's just skip this test for those two FS in this case.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

PATCH v2 1/1 statx/statx04: Skip vfat and exfat filesystems

In reply to Wei Gao via ltp

On newer kernels (v7.1-rc1+), vfat and exfat implement fileattr_get to support reporting casefolding. This causes the FS_IOC_GETFLAGS ioctl to return success, whereas on older kernels it returned ENOTTY.

Since FS_IOC_GETFLAGS succeeds, statx04 assumes standard writable inode attributes (append, immutable, nodump) are supported on these filesystems. However, they are not, causing the statx() attribute check to fail with TFAIL.

Fix this by checking if the filesystem type is vfat or exfat and skipping the test with TCONF.

This addresses the failures introduced by the following upstream Linux kernel commits:
- 27e0b573dd4a ("exfat: Implement fileattr_get for case sensitivity")
- c92db2ca72fe ("fat: Implement fileattr_get for case sensitivity")

---
 testcases/kernel/syscalls/statx/statx04.c | 9 +++++++++
 1 file changed, 9 insertions(+)
testcases/kernel/syscalls/statx/statx04.c +9 -0
index af30a200e..b2a2ac9cc 100644
@@ -91,6 +91,15 @@ static void setup(void)
 	if (TST_RET)
 		tst_brk(TBROK | TTERRNO, "Unexpected ioctl() error");
 
+	/*
+	 * On newer kernels (v7.1-rc1+), vfat and exfat implement fileattr_get
+	 * to support reporting casefolding, which causes FS_IOC_GETFLAGS to
+	 * return success. However, they do not support standard writable inode
+	 * attributes (append, immutable, nodump). Skip them.
+	 */
+	if (!strcmp(tst_device->fs_type, "vfat") || !strcmp(tst_device->fs_type, "exfat"))
+		tst_brk(TCONF, "vfat and exfat do not support standard attributes");
+
 	for (i = 0, expected_mask = 0; i < ARRAY_SIZE(attr_list); i++)
 		expected_mask |= attr_list[i].attr;
 
Signature · 5 lines
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

Re: [LTP] statx/statx04: Skip vfat and exfat filesystems

Hi Wei,

Quoted 1 line · Wei Gao

statx/statx04: Skip vfat and exfat filesystems

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

Re: [LTP] [PATCH v2] statx/statx04: Skip vfat and exfat filesystems

In reply to Wei Gao via ltp

Hi,

Quoted 29 lines · Wei Gao via ltp

On newer kernels (v7.1-rc1+), vfat and exfat implement fileattr_get to support reporting casefolding. This causes the FS_IOC_GETFLAGS ioctl to return success, whereas on older kernels it returned ENOTTY.

Since FS_IOC_GETFLAGS succeeds, statx04 assumes standard writable inode attributes (append, immutable, nodump) are supported on these filesystems. However, they are not, causing the statx() attribute check to fail with TFAIL.

Fix this by checking if the filesystem type is vfat or exfat and skipping the test with TCONF.

This addresses the failures introduced by the following upstream Linux kernel commits:
- 27e0b573dd4a ("exfat: Implement fileattr_get for case sensitivity")
- c92db2ca72fe ("fat: Implement fileattr_get for case sensitivity")

---
  testcases/kernel/syscalls/statx/statx04.c | 9 +++++++++
  1 file changed, 9 insertions(+)
testcases/kernel/syscalls/statx/statx04.c +0 -0
index af30a200e..b2a2ac9cc 100644
@@ -91,6 +91,15 @@ static void setup(void)
  	if (TST_RET)
  		tst_brk(TBROK | TTERRNO, "Unexpected ioctl() error");

testcases/kernel/syscalls/statx/statx04.c static void setup(void) · line 102

Quoted 10 lines
testcases/kernel/syscalls/statx/statx04.c +9 -0
 
+	/*
+	 * On newer kernels (v7.1-rc1+), vfat and exfat implement fileattr_get
+	 * to support reporting casefolding, which causes FS_IOC_GETFLAGS to
+	 * return success. However, they do not support standard writable inode
+	 * attributes (append, immutable, nodump). Skip them.
+	 */
+	if (!strcmp(tst_device->fs_type, "vfat") || !strcmp(tst_device->fs_type, "exfat"))
+		tst_brk(TCONF, "vfat and exfat do not support standard attributes");
+

If we are skipping irrespective of kernel version, why not use '.skip_filesystems', that also avoids formatting and mounting. We can also add these two kernel commits in the test documentation and maybe also in '.tags'.

testcases/kernel/syscalls/statx/statx04.c static void setup(void) · line 105

Quoted 3 lines
testcases/kernel/syscalls/statx/statx04.c +0 -0
  	for (i = 0, expected_mask = 0; i < ARRAY_SIZE(attr_list); i++)
  		expected_mask |= attr_list[i].attr;
 

Regards,
Avinesh

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw

PATCH v3 1/1 statx/statx04: Skip vfat and exfat filesystems

In reply to Wei Gao via ltp

On newer kernels (v7.2-rc1+), vfat and exfat implement fileattr_get to support reporting casefolding. This causes the FS_IOC_GETFLAGS ioctl to return success, whereas on older kernels it returned ENOTTY.

Since FS_IOC_GETFLAGS succeeds, statx04 assumes standard writable inode attributes (append, immutable, nodump) are supported on these filesystems. However, they are not, causing the statx() attribute check to fail with TFAIL.

This addresses the failures introduced by the following upstream Linux kernel commits:
- 27e0b573dd4a ("exfat: Implement fileattr_get for case sensitivity")
- c92db2ca726f ("fat: Implement fileattr_get for case sensitivity")

---
 testcases/kernel/syscalls/statx/statx04.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
testcases/kernel/syscalls/statx/statx04.c +20 -0
index af30a200e..c029cd06e 100644
@@ -47,6 +47,22 @@
  *
  *  mm/shmem: support FS_IOC_[SG]ETFLAGS in tmpfs
  *
+ * vfat and exfat are skipped because they do not support standard writable
+ * attributes (append, immutable, nodump) even though newer kernels support
+ * casefolding which causes FS_IOC_GETFLAGS to succeed since the following commits:
+ *
+ *  commit 27e0b573dd4aa927670fbfd84732e569fde72078
+ *  Author: Chuck Lever <[email protected]>
+ *  Date:   Thu May 7 04:52:57 2026 -0400
+ *
+ *  exfat: Implement fileattr_get for case sensitivity
+ *
+ *  commit c92db2ca726fe61a66580d30ecff8c192a791935
+ *  Author: Chuck Lever <[email protected]>
+ *  Date:   Thu May 7 04:52:56 2026 -0400
+ *
+ *  fat: Implement fileattr_get for case sensitivity
+ *
  */
 
 #define _GNU_SOURCE
@@ -133,6 +149,8 @@ static struct tst_test test = {
 	.skip_filesystems = (const char *const[]) {
 		"fuse",
 		"ntfs",
+		"vfat",
+		"exfat",
 		NULL
 	},
 	.tags = (const struct tst_tag[]) {
@@ -141,6 +159,8 @@ static struct tst_test test = {
 		{"linux-git", "04a87e347282"},
 		{"linux-git", "5f955f26f3d4"},
 		{"linux-git", "e408e695f5f1"},
+		{"linux-git", "27e0b573dd4a"},
+		{"linux-git", "c92db2ca726f"},
 		{}
 	},
 };
Signature · 5 lines
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw

Re: [LTP] statx/statx04: Skip vfat and exfat filesystems

Hi Wei,

Quoted 1 line · Wei Gao

statx/statx04: Skip vfat and exfat filesystems

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp