All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] safe_mount: Do not try mount() syscall for FUSE fs
@ 2018-01-16  9:23 Cyril Hrubis
  2018-01-17  8:54 ` Jan Stancek
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2018-01-16  9:23 UTC (permalink / raw)
  To: ltp

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 <chrubis@suse.cz>
---

This is one small nit I found while testing LTP I think that it's safe
enough for the relese since it only touches code for ntfs and exfat.

 lib/safe_macros.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index c4aed0b30..c48e436dc 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -723,8 +723,6 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
 {
 	int rval;
 
-	rval = mount(source, target, filesystemtype, mountflags, data);
-
 	/*
 	 * The FUSE filesystem executes mount.fuse helper, which tries to
 	 * execute corresponding binary name which is encoded at the start of
@@ -732,21 +730,23 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
          *
 	 * The mount helpers are called mount.$fs_type.
 	 */
-	if (rval == -1 && errno == ENODEV && is_fuse(filesystemtype)) {
+	if (is_fuse(filesystemtype)) {
 		char buf[1024];
-		int ret;
 
 		tst_resm(TINFO, "Trying FUSE...");
 		snprintf(buf, sizeof(buf), "mount.%s '%s' '%s'",
 			 filesystemtype, source, target);
 
-		ret = tst_system(buf);
-		if (WIFEXITED(ret) && WEXITSTATUS(ret) == 0)
+		rval = tst_system(buf);
+		if (WIFEXITED(rval) && WEXITSTATUS(rval) == 0)
 			return 0;
 
-		errno = ENODEV;
+		tst_brkm(TBROK, cleanup_fn, "mount.%s failed with %i",
+			 filesystemtype, rval);
+		return -1;
 	}
 
+	rval = mount(source, target, filesystemtype, mountflags, data);
 	if (rval == -1) {
 		tst_brkm(TBROK | TERRNO, cleanup_fn,
 			 "%s:%d: mount(%s, %s, %s, %lu, %p) failed",
-- 
2.13.6


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

* [LTP] [PATCH] safe_mount: Do not try mount() syscall for FUSE fs
  2018-01-16  9:23 [LTP] [PATCH] safe_mount: Do not try mount() syscall for FUSE fs Cyril Hrubis
@ 2018-01-17  8:54 ` Jan Stancek
  2018-01-17 14:59   ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2018-01-17  8:54 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> 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 <chrubis@suse.cz>

This would prevent test using read-only kernel version of NTFS,
but no such test exists (and EROFS tests use tmpfs).

ACK

Regards,
Jan

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

* [LTP] [PATCH] safe_mount: Do not try mount() syscall for FUSE fs
  2018-01-17  8:54 ` Jan Stancek
@ 2018-01-17 14:59   ` Cyril Hrubis
  0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2018-01-17 14:59 UTC (permalink / raw)
  To: ltp

Hi!
Pushed along with two obvious fixed for two build failures.

Now last patch that I would like to get included in the release is:

[PATCH] tst_test: Fix exit value on tst_brk(TCONF, ...)

Can you have a quick look?

-- 
Cyril Hrubis
chrubis@suse.cz

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

end of thread, other threads:[~2018-01-17 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-16  9:23 [LTP] [PATCH] safe_mount: Do not try mount() syscall for FUSE fs Cyril Hrubis
2018-01-17  8:54 ` Jan Stancek
2018-01-17 14:59   ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.