* [LTP] [PATCH v3 1/1] safe_macros.c: Fix missing ro flag for FUSE mounts
@ 2025-07-29 13:27 Jan Polensky
2025-08-05 11:52 ` Petr Vorel
2025-08-05 11:54 ` Petr Vorel
0 siblings, 2 replies; 5+ messages in thread
From: Jan Polensky @ 2025-07-29 13:27 UTC (permalink / raw)
To: Linux Test Project
The test incorrectly assumes that FUSE mounts are read-only, but the mount
command does not explicitly set the read-only flag. As a result, the test fails
when checking `sb_flags` against `MS_RDONLY`.
Old behavior:
sudo LTP_SINGLE_FS_TYPE=ntfs strace -e trace=mount,statmount -o log.log -s 128 -f ./statmount02
...
statmount02.c:47: TFAIL: st_mount->sb_flags (0) != MS_RDONLY (1)
...
Relevant log excerpt:
3890601 mount("/dev/zero", "/tmp/mountBDSEqk", "ntfs", 0, NULL) = -1 ENOTBLK (Block device required)
3890608 mount("/dev/loop0", "/tmp/LTP_staTPRruR/mntpoint", "fuseblk", 0, "allow_other,blksize=4096,fd=4,rootmode=40000,user_id=0,group_id=0") = 0
3890607 statmount({size=24, mnt_id=0x80010957, param=STATMOUNT_SB_BASIC}, {size=512, mask=STATMOUNT_SB_BASIC, sb_dev_major=7, sb_dev_minor=0, sb_magic=FUSE_SUPER_MAGIC, sb_flags=0}, 512, 0) = 0
Reviewed-by: Avinesh Kumar <akumar@suse.de>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
Change since v1 (Thanks Cyril & thanks for the ping):
* Removed restriction for NTFS.
Change since v2 (Thanks Avinesh):
* Changed commit title from: "Fix missing ro flag for FUSE NTFS mounts"
lib/safe_macros.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index d52b55ab70fe..25fad4b7cae0 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -945,10 +945,15 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
tst_resm_(file, lineno, TINFO, "tst_is_fuse: %d", tst_is_fuse(source));
if (possibly_fuse(filesystemtype)) {
char buf[1024];
+ const char* mount_fmt;
tst_resm_(file, lineno, TINFO, "Trying FUSE...");
- snprintf(buf, sizeof(buf), "mount.%s '%s' '%s'",
- filesystemtype, source, target);
+ if (mountflags == MS_RDONLY)
+ mount_fmt = "mount.%s -o ro '%s' '%s'";
+ else
+ mount_fmt = "mount.%s '%s' '%s'";
+ snprintf(buf, sizeof(buf), mount_fmt, filesystemtype,
+ source, target);
rval = tst_system(buf);
tst_resm_(file, lineno, TINFO, "tst_is_fuse: %d", tst_is_fuse(source));
--
2.50.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [LTP] [PATCH v3 1/1] safe_macros.c: Fix missing ro flag for FUSE mounts
2025-07-29 13:27 [LTP] [PATCH v3 1/1] safe_macros.c: Fix missing ro flag for FUSE mounts Jan Polensky
@ 2025-08-05 11:52 ` Petr Vorel
2025-08-05 11:57 ` Cyril Hrubis
2025-08-05 11:54 ` Petr Vorel
1 sibling, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2025-08-05 11:52 UTC (permalink / raw)
To: Jan Polensky; +Cc: Linux Test Project
Hi all,
> The test incorrectly assumes that FUSE mounts are read-only, but the mount
> command does not explicitly set the read-only flag. As a result, the test fails
> when checking `sb_flags` against `MS_RDONLY`.
@Cyril actually v3 is the final version to have a look.
Kind regards,
Petr
> Old behavior:
> sudo LTP_SINGLE_FS_TYPE=ntfs strace -e trace=mount,statmount -o log.log -s 128 -f ./statmount02
> ...
> statmount02.c:47: TFAIL: st_mount->sb_flags (0) != MS_RDONLY (1)
> ...
> Relevant log excerpt:
> 3890601 mount("/dev/zero", "/tmp/mountBDSEqk", "ntfs", 0, NULL) = -1 ENOTBLK (Block device required)
> 3890608 mount("/dev/loop0", "/tmp/LTP_staTPRruR/mntpoint", "fuseblk", 0, "allow_other,blksize=4096,fd=4,rootmode=40000,user_id=0,group_id=0") = 0
> 3890607 statmount({size=24, mnt_id=0x80010957, param=STATMOUNT_SB_BASIC}, {size=512, mask=STATMOUNT_SB_BASIC, sb_dev_major=7, sb_dev_minor=0, sb_magic=FUSE_SUPER_MAGIC, sb_flags=0}, 512, 0) = 0
> Reviewed-by: Avinesh Kumar <akumar@suse.de>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
> Change since v1 (Thanks Cyril & thanks for the ping):
> * Removed restriction for NTFS.
> Change since v2 (Thanks Avinesh):
> * Changed commit title from: "Fix missing ro flag for FUSE NTFS mounts"
> lib/safe_macros.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
> diff --git a/lib/safe_macros.c b/lib/safe_macros.c
> index d52b55ab70fe..25fad4b7cae0 100644
> --- a/lib/safe_macros.c
> +++ b/lib/safe_macros.c
> @@ -945,10 +945,15 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
> tst_resm_(file, lineno, TINFO, "tst_is_fuse: %d", tst_is_fuse(source));
> if (possibly_fuse(filesystemtype)) {
> char buf[1024];
> + const char* mount_fmt;
> tst_resm_(file, lineno, TINFO, "Trying FUSE...");
> - snprintf(buf, sizeof(buf), "mount.%s '%s' '%s'",
> - filesystemtype, source, target);
> + if (mountflags == MS_RDONLY)
> + mount_fmt = "mount.%s -o ro '%s' '%s'";
> + else
> + mount_fmt = "mount.%s '%s' '%s'";
> + snprintf(buf, sizeof(buf), mount_fmt, filesystemtype,
> + source, target);
> rval = tst_system(buf);
> tst_resm_(file, lineno, TINFO, "tst_is_fuse: %d", tst_is_fuse(source));
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [LTP] [PATCH v3 1/1] safe_macros.c: Fix missing ro flag for FUSE mounts
2025-07-29 13:27 [LTP] [PATCH v3 1/1] safe_macros.c: Fix missing ro flag for FUSE mounts Jan Polensky
2025-08-05 11:52 ` Petr Vorel
@ 2025-08-05 11:54 ` Petr Vorel
1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2025-08-05 11:54 UTC (permalink / raw)
To: Jan Polensky; +Cc: Linux Test Project
Hi all,
NOTE: v3 does not apply due wrong context.
I'm going to merge v2 with a fixed title (wait little longer to give Cyril
chance to review).
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-06 11:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 13:27 [LTP] [PATCH v3 1/1] safe_macros.c: Fix missing ro flag for FUSE mounts Jan Polensky
2025-08-05 11:52 ` Petr Vorel
2025-08-05 11:57 ` Cyril Hrubis
2025-08-06 11:38 ` Jan Polensky
2025-08-05 11:54 ` Petr Vorel
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.