syscalls: file_attr05: skip ntfs filesystem
PATCH 1/1 syscalls: file_attr05: skip ntfs filesystem
LTP mounts ntfs via ntfs-3g (FUSE) rather than the kernel ntfs3 driver. ntfs-3g's ntfs_ioctl() returns EINVAL for any unhandled ioctl, including FS_IOC_FSSETXATTR, so file_setattr() returns EINVAL instead of the expected EOPNOTSUPP.
Add "ntfs" to skip_filesystems for the same reason "fuse" is already skipped.
--- testcases/kernel/syscalls/file_attr/file_attr05.c | 1 + 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/file_attr/file_attr05.c +1 -0
@@ -49,6 +49,7 @@ static struct tst_test test = { .skip_filesystems = (const char *const []) {"xfs" ,"fuse" ,/* EINVAL is raised before EOPNOTSUPP */ +"ntfs" ,/* mounted via ntfs-3g (FUSE), returns EINVAL */ "vfat" ,/* vfat is not implementing file_[set|get]attr */ NULL , },
Signature · 5 lines
2.50.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Matthew,
Quoted 7 lines
LTP mounts ntfs via ntfs-3g (FUSE) rather than the kernel ntfs3 driver. ntfs-3g's
ntfs_ioctl()returns EINVAL for any unhandled ioctl, includingFS_IOC_FSSETXATTR, sofile_setattr()returns EINVAL instead of the expected EOPNOTSUPP.Add "ntfs" to
skip_filesystemsfor the same reason "fuse" is already skipped.
Good catch, thanks!
We did not notice, because we have ntfs3 blacklisted in openSUSE Tumbleweed:
cat /etc/modprobe.d/60-blacklist_fs-ntfs3.conf
# The ntfs3 file system is blacklisted by default because it isn't actively
# supported by SUSE. blacklist ntfs3 # The filesystem can be un-blacklisted by running "modprobe ntfs3". # See README.md in the suse-module-tools package for details. install ntfs3 /usr/lib/module-init-tools/unblacklist ntfs3; /sbin/modprobe --ignore-install ntfs3
Therefore it works:
# ./file_attr05 ... tst_supported_fs_types.c:98: TINFO: Kernel supports ext2 tst_supported_fs_types.c:63: TINFO: mkfs.ext2 does exist tst_supported_fs_types.c:98: TINFO: Kernel supports ext3 tst_supported_fs_types.c:63: TINFO: mkfs.ext3 does exist tst_supported_fs_types.c:98: TINFO: Kernel supports ext4 tst_supported_fs_types.c:63: TINFO: mkfs.ext4 does exist tst_supported_fs_types.c:157: TINFO: Skipping xfs as requested by the test tst_supported_fs_types.c:98: TINFO: Kernel supports btrfs tst_supported_fs_types.c:63: TINFO: mkfs.btrfs does exist tst_supported_fs_types.c:106: TINFO: Skipping bcachefs because of FUSE blacklist tst_supported_fs_types.c:157: TINFO: Skipping vfat as requested by the test tst_supported_fs_types.c:98: TINFO: Kernel supports exfat tst_supported_fs_types.c:63: TINFO: mkfs.exfat does exist tst_supported_fs_types.c:133: TINFO: FUSE does support ntfs tst_supported_fs_types.c:63: TINFO: mkfs.ntfs does exist tst_supported_fs_types.c:165: TINFO: Skipping FUSE based ntfs as requested by the test ...
But if I force ntfs, it really fails due using ntfs3:
# LTP_FORCE_SINGLE_FS_TYPE=ntfs ./file_attr05
...
tst_supported_fs_types.c:199: TINFO: WARNING: force testing only ntfs
tst_test.c:1997: TINFO: === Testing on ntfs ===
tst_test.c:1295: TINFO: Formatting /dev/loop0 with ntfs opts='' extra opts=''
The partition start sector was not specified for /dev/loop0 and it could not be obtained automatically. It has been set to 0. The number of sectors per track was not specified for /dev/loop0 and it could not be obtained automatically. It has been set to 0. The number of heads was not specified for /dev/loop0 and it could not be obtained automatically. It has been set to 0. To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set. Windows will not be able to boot from this device.
tst_test.c:1307: TINFO: Mounting /dev/loop0 to /tmp/LTP_filWegMd2/mntpoint fstyp=ntfs flags=0
tst_test.c:1307: TINFO: Trying FUSE...
file_attr05.c:23: TFAIL: file_setattr(AT_FDCWD, FILEPATH, attr_set, FILE_ATTR_SIZE_LATEST, 0) expected EOPNOTSUPP: EINVAL (22)
Other way is if I remove blacklist and manually run 'modprobe ntfs3'.
Quoted 10 lines
Signed-off-by Matthew R. Ochs <[email protected]>--- testcases/kernel/syscalls/file_attr/file_attr05.c | 1 + 1 file changed, 1 insertion(+)testcases/kernel/syscalls/file_attr/file_attr05.c +0
-0
testcases/kernel/syscalls/file_attr/file_attr05.c static struct tst_test test = { · line 52
Quoted 4 lines
testcases/kernel/syscalls/file_attr/file_attr05.c +1
-0@@ -49,6 +49,7 @@ static struct tst_test test = { .skip_filesystems = (const char *const []) {"xfs" ,"fuse" ,/* EINVAL is raised before EOPNOTSUPP */ +"ntfs" ,/* mounted via ntfs-3g (FUSE), returns EINVAL */
For me it'd work to replace "fuse" with "ntfs" (i.e. remove "fuse"). Does it work for you as well, or you need to have blacklisted both?
testcases/kernel/syscalls/file_attr/file_attr05.c static struct tst_test test = { · line 53
Quoted 1 line
testcases/kernel/syscalls/file_attr/file_attr05.c +0
-0"vfat", /* vfat is not implementing file_[set|get]attr */
Also it looks to me that vfat is working.
Kind regards,
Petr
Quoted 2 lines
testcases/kernel/syscalls/file_attr/file_attr05.c +0
-0NULL, },
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Petr,
Quoted 9 lines · Petr Vorel
Hi Matthew,
Quoted 4 lines
LTP mounts ntfs via ntfs-3g (FUSE) rather than the kernel ntfs3 driver. ntfs-3g's
ntfs_ioctl()returns EINVAL for any unhandled ioctl, includingFS_IOC_FSSETXATTR, sofile_setattr()returns EINVAL instead of the expected EOPNOTSUPP.
Quoted 5 lines
Quoted 2 lines
Add "ntfs" to
skip_filesystemsfor the same reason "fuse" is already skipped.Reviewed-by Petr Vorel <[email protected]>Good catch, thanks!
I appreciate the review!
Quoted 54 lines
We did not notice, because we have ntfs3 blacklisted in openSUSE Tumbleweed:
cat
/etc/modprobe.d/60-blacklist_fs-ntfs3.conf
# The ntfs3 file system is blacklisted by default because it isn't actively# supported by SUSE. blacklist ntfs3 # The filesystem can be un-blacklisted by running "modprobe ntfs3". # See README.md in the suse-module-tools package for details. install ntfs3 /usr/lib/module-init-tools/unblacklist ntfs3; /sbin/modprobe --ignore-install ntfs3Therefore it works:
# ./file_attr05 ... tst_supported_fs_types.c:98: TINFO: Kernel supports ext2 tst_supported_fs_types.c:63: TINFO: mkfs.ext2 does exist tst_supported_fs_types.c:98: TINFO: Kernel supports ext3 tst_supported_fs_types.c:63: TINFO: mkfs.ext3 does exist tst_supported_fs_types.c:98: TINFO: Kernel supports ext4 tst_supported_fs_types.c:63: TINFO: mkfs.ext4 does exist tst_supported_fs_types.c:157: TINFO: Skipping xfs as requested by the test tst_supported_fs_types.c:98: TINFO: Kernel supports btrfs tst_supported_fs_types.c:63: TINFO: mkfs.btrfs does exist tst_supported_fs_types.c:106: TINFO: Skipping bcachefs because of FUSE blacklist tst_supported_fs_types.c:157: TINFO: Skipping vfat as requested by the test tst_supported_fs_types.c:98: TINFO: Kernel supports exfat tst_supported_fs_types.c:63: TINFO: mkfs.exfat does exist tst_supported_fs_types.c:133: TINFO: FUSE does support ntfs tst_supported_fs_types.c:63: TINFO: mkfs.ntfs does exist tst_supported_fs_types.c:165: TINFO: Skipping FUSE based ntfs as requested by the test ...But if I force ntfs, it really fails due using ntfs3:
# LTP_FORCE_SINGLE_FS_TYPE=ntfs ./file_attr05
...
tst_supported_fs_types.c:199: TINFO: WARNING: force testing only ntfs
tst_test.c:1997: TINFO: === Testing on ntfs ===
tst_test.c:1295: TINFO: Formatting/dev/loop0with ntfs opts='' extra opts=''
The partition start sector was not specified for/dev/loop0and it could not be obtained automatically. It has been set to 0. The number of sectors per track was not specified for/dev/loop0and it could not be obtained automatically. It has been set to 0. The number of heads was not specified for/dev/loop0and it could not be obtained automatically. It has been set to 0. To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set. Windows will not be able to boot from this device.
tst_test.c:1307: TINFO: Mounting/dev/loop0to/tmp/LTP_filWegMd2/mntpointfstyp=ntfs flags=0
tst_test.c:1307: TINFO: Trying FUSE...
file_attr05.c:23: TFAIL:file_setattr(AT_FDCWD, FILEPATH, attr_set, FILE_ATTR_SIZE_LATEST, 0)expected EOPNOTSUPP: EINVAL (22)Other way is if I remove blacklist and manually run 'modprobe ntfs3'.
Quoted 4 lines
Signed-off-by Matthew R. Ochs <[email protected]>---
testcases/kernel/syscalls/file_attr/file_attr05.c| 1 +1 file changed, 1 insertion(+)
Quoted 11 lines
Quoted 9 lines
testcases/kernel/syscalls/file_attr/file_attr05.c +0
-0@@ -49,6 +49,7 @@ static struct tst_test test = { .skip_filesystems = (const char *const []) { "xfs","fuse", /* EINVAL is raised before EOPNOTSUPP */
+ "ntfs", /* mounted via ntfs-3g (FUSE), returns EINVAL */For me it'd work to replace "fuse" with "ntfs" (i.e. remove "fuse"). Does it work for you as well, or you need to have blacklisted both?
Regarding replacing "fuse" with "ntfs": on Ubuntu, ntfs3 is available as a kernel module, so the detection reports "Kernel supports ntfs” and the FUSE skip path never fires — meaning "fuse" alone doesn’t catch it. Removing "fuse" would also drop coverage of other FUSE-based filesystems, so I'd prefer to keep both entries.
-matt
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Matt
Quoted 11 lines
Hi Petr,
Quoted 8 lines · Petr Vorel
Hi Matthew,
Quoted 4 lines
LTP mounts ntfs via ntfs-3g (FUSE) rather than the kernel ntfs3 driver. ntfs-3g's
ntfs_ioctl()returns EINVAL for any unhandled ioctl, includingFS_IOC_FSSETXATTR, sofile_setattr()returns EINVAL instead of the expected EOPNOTSUPP.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Add "ntfs" to
skip_filesystemsfor the same reason "fuse" is already skipped.Reviewed-by Petr Vorel <[email protected]>Good catch, thanks!
I appreciate the review!
You're welcome, thanks for your contributions!
Quoted 1 line
Quoted 1 line
We did not notice, because we have ntfs3 blacklisted in openSUSE Tumbleweed:
...
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
testcases/kernel/syscalls/file_attr/file_attr05.c +0
-0@@ -49,6 +49,7 @@ static struct tst_test test = { .skip_filesystems = (const char *const []) { "xfs","fuse", /* EINVAL is raised before EOPNOTSUPP */
+ "ntfs", /* mounted via ntfs-3g (FUSE), returns EINVAL */For me it'd work to replace "fuse" with "ntfs" (i.e. remove "fuse"). Does it work for you as well, or you need to have blacklisted both?
Quoted 5 lines
Regarding replacing "fuse" with "ntfs": on Ubuntu, ntfs3 is available as a kernel module, so the detection reports "Kernel supports ntfs” and the FUSE skip path never fires — meaning "fuse" alone doesn’t catch it. Removing "fuse" would also drop coverage of other FUSE-based filesystems, so I'd prefer to keep both entries.
I actually think that other fuse implementations work, fuse was probably added to fix ntfs. Or am I wrong? But that can be solved as a separate effort, I don't want to block what you plan to fix.
Kind regards,
Petr
Quoted 1 line
-matt
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 7 lines
LTP mounts ntfs via ntfs-3g (FUSE) rather than the kernel ntfs3 driver. ntfs-3g's
ntfs_ioctl()returns EINVAL for any unhandled ioctl, includingFS_IOC_FSSETXATTR, sofile_setattr()returns EINVAL instead of the expected EOPNOTSUPP.Add "ntfs" to
skip_filesystemsfor the same reason "fuse" is already skipped.
The "fuse" in skiplist should match all fuse based filesystems. We pass the skip_filesystems pointer to tst_get_supported_fs_types() in lib/tst_supported_fs_types.c. If "fuse" is present there we enable skip_fuse flag nad pass it to fs_could_be_used() function. In the fs_could_be_used() we check if filesystem is implemented by fuse and then skip it accordingly.
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?
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Cyril,
Quoted 18 lines · Cyril Hrubis
Hi!
Quoted 7 lines
LTP mounts ntfs via ntfs-3g (FUSE) rather than the kernel ntfs3 driver. ntfs-3g's
ntfs_ioctl()returns EINVAL for any unhandled ioctl, includingFS_IOC_FSSETXATTR, sofile_setattr()returns EINVAL instead of the expected EOPNOTSUPP.Add "ntfs" to
skip_filesystemsfor the same reason "fuse" is already skipped.The "fuse" in skiplist should match all fuse based filesystems. We pass the
skip_filesystemspointer totst_get_supported_fs_types()inlib/tst_supported_fs_types.c. If "fuse" is present there we enableskip_fuseflag nad pass it tofs_could_be_used()function. In thefs_could_be_used()we check if filesystem is implemented by fuse and then skip it accordingly.
Quoted 9 lines
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 investigated fixing this in the library by consulting possibly_fuse() in has_kernel_support() to fall through to FUSE detection when safe_macros would use FUSE regardless. However, possibly_fuse() covers both "ntfs" and "exfat", but safe_macros treats them differently — ntfs always uses FUSE, while exfat tries the kernel driver first and falls back to FUSE only on failure. The fix would incorrectly mark exfat as FUSE-based on systems with kernel exfat support, causing spurious skips in tests that skip "fuse".
Given that, I think the test-level fix is appropriate here. ntfs-3g returns EINVAL for any unhandled ioctl, so skipping ntfs in file_attr05 is correct and consistent with how "fuse" is already handled in the same skip list.
-matt
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 10 lines
Quoted 9 lines
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?
Quoted 6 lines
On Ubuntu, ntfs3 is available as a kernel module, so
has_kernel_support()intst_supported_fs_types.cprobes the kernel mount, succeeds, and returnsTST_FS_KERNELimmediately — never reaching the FUSE detection path. As a result, the existing "fuse" skip doesn't fire even thoughsafe_macrosalways 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:
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
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 77 lines · Cyril Hrubis
Hi!
Quoted 10 lines
Quoted 9 lines
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?
Quoted 6 lines
On Ubuntu, ntfs3 is available as a kernel module, so
has_kernel_support()intst_supported_fs_types.cprobes the kernel mount, succeeds, and returnsTST_FS_KERNELimmediately — never reaching the FUSE detection path. As a result, the existing "fuse" skip doesn't fire even thoughsafe_macrosalways 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:
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 +7
-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);
lib/tst_supported_fs_types.c static enum tst_fs_impl has_kernel_support(const char *fs_type) · line 115
Quoted 7 lines
lib/tst_supported_fs_types.c +1
-0@@ -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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp