Skip to content

Commit 28507e5

Browse files
committed
safe_mount: Do not try mount() syscall for FUSE fs
The problem here is that there exists two NTFS implementations. There is a readonly support in the kernel and full read/write FUSE implementation. If there is a NTFS kernel module present on the system the mount() syscall successfuly mounts the device in read-only mode which causes the tests to fail once they attempt to create a file. Signed-off-by: Cyril Hrubis <[email protected]> Acked-by: Jan Stancek <[email protected]>
1 parent fdefef3 commit 28507e5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/safe_macros.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -723,30 +723,30 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
723723
{
724724
int rval;
725725

726-
rval = mount(source, target, filesystemtype, mountflags, data);
727-
728726
/*
729727
* The FUSE filesystem executes mount.fuse helper, which tries to
730728
* execute corresponding binary name which is encoded at the start of
731729
* the source string and separated by # from the device name.
732730
*
733731
* The mount helpers are called mount.$fs_type.
734732
*/
735-
if (rval == -1 && errno == ENODEV && is_fuse(filesystemtype)) {
733+
if (is_fuse(filesystemtype)) {
736734
char buf[1024];
737-
int ret;
738735

739736
tst_resm(TINFO, "Trying FUSE...");
740737
snprintf(buf, sizeof(buf), "mount.%s '%s' '%s'",
741738
filesystemtype, source, target);
742739

743-
ret = tst_system(buf);
744-
if (WIFEXITED(ret) && WEXITSTATUS(ret) == 0)
740+
rval = tst_system(buf);
741+
if (WIFEXITED(rval) && WEXITSTATUS(rval) == 0)
745742
return 0;
746743

747-
errno = ENODEV;
744+
tst_brkm(TBROK, cleanup_fn, "mount.%s failed with %i",
745+
filesystemtype, rval);
746+
return -1;
748747
}
749748

749+
rval = mount(source, target, filesystemtype, mountflags, data);
750750
if (rval == -1) {
751751
tst_brkm(TBROK | TERRNO, cleanup_fn,
752752
"%s:%d: mount(%s, %s, %s, %lu, %p) failed",

0 commit comments

Comments
 (0)