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

Cyril Hrubis chrubis@suse.cz
Wed May 21 11:45:31 CEST 2025


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.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list