lib: Treat kernel ntfs3 as a separate FS
PATCH 1/1 lib: Treat kernel ntfs3 as a separate FS
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.
--- lib/tst_mkfs.c | 3 +++ lib/tst_supported_fs_types.c | 8 ++++++++ 2 files changed, 11 insertions(+)
lib/tst_mkfs.c +3 -0
@@ -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) {
lib/tst_supported_fs_types.c +8 -0
@@ -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 ;
Signature · 5 lines
2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Cyril,
our agent completed the review of the patch.
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Quoted 6 lines · Cyril Hrubis
lib: Treat kernel ntfs3 as a separate FS
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.
Two typos: "finaly" -> "finally", "callled" -> "called" (a few lines below).
Since this fixes a real failure, please consider adding a Fixes: tag pointing to the LTP commit that introduced the broken ntfs handling. If the issue predates any single identifiable commit, dropping the tag is fine — just clarify in the reply.
[...]
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 9 lines
Quoted 6 lines
lib: Treat kernel ntfs3 as a separate FS
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.
Two typos: "finaly" -> "finally", "callled" -> "called" (a few lines below).
I will fix these before commiting.
Quoted 4 lines
Since this fixes a real failure, please consider adding a Fixes: tag pointing to the LTP commit that introduced the broken ntfs handling. If the issue predates any single identifiable commit, dropping the tag is fine — just clarify in the reply.
However this one is more complex, there isn't a single patch that caused the problem, moreover it was triggered only by addition of the ntfs3 driver into the kernel.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel
Reviewed-byHi Cyril,
Quoted 2 lines
Hi!
Quoted 1 line
Quoted 1 line
lib: Treat kernel ntfs3 as a separate FS
Great idea, thanks!
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
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.
Two typos: "finaly" -> "finally", "callled" -> "called" (a few lines below).
I will fix these before commiting.
Quoted 8 lines
Quoted 4 lines
Since this fixes a real failure, please consider adding a Fixes: tag pointing to the LTP commit that introduced the broken ntfs handling. If the issue predates any single identifiable commit, dropping the tag is fine — just clarify in the reply.
However this one is more complex, there isn't a single patch that caused the problem, moreover it was triggered only by addition of the ntfs3 driver into the kernel.
+1.
Trying, if patchwork / b4 takes this tag (link to lore). It'd be great if we had tooling patchwork.kernel.org + git.kernel.org have so that we would not have to add it manually.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Regards,
Avinesh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Thanks for the reviews and testing, pushed.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp