[LTP] [PATCH] syscalls: file_attr05: skip ntfs filesystem
Matt Ochs
mochs@nvidia.com
Fri Apr 10 18:42:02 CEST 2026
> On Apr 10, 2026, at 05:04, Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
>>> When I run the test I see:
>>>
>>> ...
>>> tst_supported_fs_types.c:165: TINFO: Skipping FUSE based ntfs as requested by the test
>>> ...
>>>
>>> So likely something else is at play here. Are you sure you are dealing
>>> with a fuse based ntfs or with the kernel based implementation?
>>>
>>
>> On Ubuntu, ntfs3 is available as a kernel module, so
>> has_kernel_support() in tst_supported_fs_types.c probes the kernel
>> mount, succeeds, and returns TST_FS_KERNEL immediately — never
>> reaching the FUSE detection path. As a result, the existing "fuse"
>> skip doesn't fire even though safe_macros always mounts ntfs via FUSE
>> anyway.
>
> I think I've figured it out. The ntfs driver in kernel is the old
> read-only one and ntfs3 is the new read-write kernel driver.
>
> What we can do in the library is to fix the ntfs driver to be always
> handled by fuse and add ntfs3 that is the read-write kernel driver. With
> that we will fix this test but also enable more coverage.
>
> This works for me:
>
> diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
> index c619a373d..961ffc091 100644
> --- a/lib/tst_mkfs.c
> +++ b/lib/tst_mkfs.c
> @@ -50,6 +50,9 @@ void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void),
> return;
> }
>
> + if (!strcmp(fs_type, "ntfs3"))
> + fs_type = "ntfs";
> +
> snprintf(mkfs, sizeof(mkfs), "mkfs.%s", fs_type);
>
> if (fs_opts) {
> diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> index 0c8c8dc50..d3020fc48 100644
> --- a/lib/tst_supported_fs_types.c
> +++ b/lib/tst_supported_fs_types.c
> @@ -30,6 +30,7 @@ static const char *const fs_type_whitelist[] = {
> "vfat",
> "exfat",
> "ntfs",
> + "ntfs3",
> "tmpfs",
> NULL
> };
> @@ -51,6 +52,9 @@ static int has_mkfs(const char *fs_type)
> return 1;
> }
>
> + if (!strcmp(fs_type, "ntfs3"))
> + fs_type = "ntfs";
> +
> sprintf(buf, "mkfs.%s >/dev/null 2>&1", fs_type);
>
> ret = tst_system(buf);
> @@ -87,6 +91,9 @@ static enum tst_fs_impl has_kernel_support(const char *fs_type)
> char template[PATH_MAX];
> int ret;
>
> + if (!strcmp(fs_type, "ntfs"))
> + goto check_fuse;
> +
> snprintf(template, sizeof(template), "%s/mountXXXXXX", tmpdir);
> if (!mkdtemp(template))
> tst_brk(TBROK | TERRNO, "mkdtemp(%s) failed", template);
> @@ -102,6 +109,7 @@ static enum tst_fs_impl has_kernel_support(const char *fs_type)
>
> SAFE_RMDIR(template);
>
> +check_fuse:
> if (tst_fs_in_skiplist(fs_type, fs_type_fuse_blacklist)) {
> tst_res(TINFO, "Skipping %s because of FUSE blacklist", fs_type);
> return TST_FS_UNSUPPORTED;
>
Hi Cyril,
Tested your proposed changes, all scenarios pass:
1. Normal run with ntfs3 loaded — ntfs correctly detected as FUSE-based
and skipped, ntfs3 runs via kernel driver and passes (6/6):
tst_supported_fs_types.c: TINFO: FUSE does support ntfs
tst_supported_fs_types.c: TINFO: Skipping FUSE based ntfs as requested by the test
tst_supported_fs_types.c: TINFO: Kernel supports ntfs3
tst_supported_fs_types.c: TINFO: mkfs.ntfs does exist
...
tst_test.c: TINFO: === Testing on ntfs3 ===
file_attr05.c: TPASS: file_setattr(...) : EOPNOTSUPP (95)
2. Normal run with ntfs3 not loaded — same result, kernel autoloads
ntfs3 on mount (6/6).
3. Force ntfs3 — formats with mkfs.ntfs, mounts as ntfs3, passes.
4. Force ntfs — mounts via FUSE, returns EINVAL as expected, confirming
the "fuse" skip is what protects the normal run.
Are you planning to send this as a formal patch? Happy to defer to
you since it's a cleaner fix at the library level, but want to make
sure it doesn't fall through the cracks.
-matt
More information about the ltp
mailing list