diff mbox series

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

Message ID 20250513165640.185122-3-japo@linux.ibm.com
State Needs Review / ACK
Headers show
Series Fix NTFS-related failures in statmount02 and | expand

Checks

Context Check Description
ltpci/debian_stable_aarch64-linux-gnu-gcc_arm64 success success
ltpci/debian_stable_s390x-linux-gnu-gcc_s390x success success
ltpci/debian_stable_gcc fail failure
ltpci/debian_stable_powerpc64le-linux-gnu-gcc_ppc64el success success
ltpci/ubuntu_jammy_gcc fail failure
ltpci/debian_stable_gcc fail failure
ltpci/ubuntu_bionic_gcc fail failure
ltpci/debian_testing_gcc fail failure
ltpci/alpine_latest_gcc fail failure
ltpci/opensuse-leap_latest_gcc fail failure
ltpci/quay-io-centos-centos_stream9_gcc fail failure
ltpci/opensuse-archive_42-2_gcc fail failure
ltpci/debian_testing_clang fail failure
ltpci/debian_oldstable_gcc fail failure
ltpci/debian_oldstable_clang fail failure
ltpci/fedora_latest_clang fail failure

Commit Message

Jan Polensky May 13, 2025, 4:56 p.m. UTC
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(-)

Comments

Cyril Hrubis May 21, 2025, 9:45 a.m. UTC | #1
Hi!
> 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)
> 	...

This may be a bug in the LTP_SINGLE_FS_TYPE, because the test has
.skip_filesystems = {"fuse", NULL} in the tst_test structure, which
means that the test is not supposed to run on fuse.

> 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);

And this does not really work, since there is in-kernel ntfs driver as
well and in newer kernels it has supposedly read-write support too.

I guess that if we wanted to enable the test on fuse, we would have to
base this on check if the fs has been mounted by fuse. Maybe we need a
tst_is_fuse() function that would possibly parse /proc/mount or
something along that way.
diff mbox series

Patch

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)