public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] lib: Treat kernel ntfs3 as a separate FS
@ 2026-04-13 11:51 Cyril Hrubis
  2026-04-13 12:22 ` [LTP] " linuxtestproject.agent
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Cyril Hrubis @ 2026-04-13 11:51 UTC (permalink / raw)
  To: ltp; +Cc: Matt Ochs

The RW NTFS support for Linux kernel was added back in 2021 in a form of
ntfs3 driver. The old RO NTFS functionality was retained though, hence
if we mount a filesystem with type "ntfs" we read it read-only. On the
top of that there is NTFS fuse implementation as well.

Historically we ignored the kernel NTFS filesystem and went for FUSE
since there is not much we can do with read-only filesystem and the code
stayed like that even after kernel RW support was added. At that point
we should have enabled both kernel NTFS driver and fuse NTFS driver and
treat them as a different filesystem in order to maximize the coverage.

Meanwhile this even caused failures, which is how this issue finaly
surfaced with a fuse based NTFS not being skipped properly because the
test library got confused with having both kernel and fuse NTFS
available.

This patch finally fixes all of that by splitting the fuse and kernel
NTFS support into two separate filesystems (as seen by the test
library).

The kernel RW filesystem is called ntfs3 while the fuse based one is
callled just ntfs. For that to happen we need to:

- add new ntfs3 fs to the whitelist
- map ntfs3 to ntfs for mkfs
- jump directly to fuse for ntfs fs in the fs support check
  (we jump directly to fuse in the safe_mount() already)

As a side effect we fixed file_attr05 test to be properly skipped on
fuse NTFS.

Reported-by: Matt Ochs <mochs@nvidia.com>
Tested-by: Matt Ochs <mochs@nvidia.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_mkfs.c               | 3 +++
 lib/tst_supported_fs_types.c | 8 ++++++++
 2 files changed, 11 insertions(+)

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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-16 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-13 11:51 [LTP] [PATCH] lib: Treat kernel ntfs3 as a separate FS Cyril Hrubis
2026-04-13 12:22 ` [LTP] " linuxtestproject.agent
2026-04-13 14:36   ` Cyril Hrubis
2026-04-13 21:24     ` Petr Vorel
2026-04-14  8:58 ` [LTP] [PATCH] " Avinesh Kumar via ltp
2026-04-16 15:43 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox