[LTP] [RFC PATCH v1 2/2] statmount06.c: Fix incorrect fs_type assumption NTFS->FUSEBLK

Jan Polensky japo@linux.ibm.com
Tue May 13 18:56:40 CEST 2025


The test incorrectly assumed that a volume mounted with "fuseblk" would report
its fs_type as "ntfs" via statmount, which contradicts the actual mount options
used and the resulting fs_type "fuseblk".

Old behavior:

	sudo LTP_SINGLE_FS_TYPE=ntfs strace -e trace=mount,statmount -o log.log -s 128 -f ./statmount06
	...
	statmount06.c:42: TFAIL: st_mount->str + st_mount->fs_type (fuseblk) != tst_device->fs_type (ntfs)
	...

Relevant log excerpt:

	111740 mount("/dev/zero", "/tmp/mountbWjYuf", "ntfs", 0, NULL) = -1 ENODEV (No such device)
	111749 mount("/dev/loop9", "/tmp/LTP_stai6UG2H/mntpoint", "fuseblk", 0, "allow_other,blksize=4096,fd=4,rootmode=40000,user_id=0,group_id=0") = 0
	111752 statmount({size=24, mnt_id=0x80003ab9, param=STATMOUNT_FS_TYPE}, {size=521, mask=STATMOUNT_FS_TYPE, fs_type="fuseblk"}, 1024, 0) = 0

Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
 testcases/kernel/syscalls/statmount/statmount06.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/statmount/statmount06.c b/testcases/kernel/syscalls/statmount/statmount06.c
index fe41d5b87e7f..dedf9bba14f9 100644
--- a/testcases/kernel/syscalls/statmount/statmount06.c
+++ b/testcases/kernel/syscalls/statmount/statmount06.c
@@ -28,6 +28,8 @@ static struct statmount *st_mount;
 
 static void run(void)
 {
+	const char *expected_fs_type;
+
 	memset(st_mount, 0, SM_SIZE);
 
 	TST_EXP_PASS(statmount(root_id,	STATMOUNT_FS_TYPE, st_mount,
@@ -37,7 +39,11 @@ static void run(void)
 		return;
 
 	TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_FS_TYPE);
-	TST_EXP_EQ_STR(st_mount->str + st_mount->fs_type, tst_device->fs_type);
+	if (!strcmp(tst_device->fs_type, "ntfs"))
+		expected_fs_type = "fuseblk";
+	else
+		expected_fs_type = tst_device->fs_type;
+	TST_EXP_EQ_STR(st_mount->str + st_mount->fs_type, expected_fs_type);
 }
 
 static void setup(void)
-- 
2.49.0



More information about the ltp mailing list