All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Jan Polensky <japo@linux.ibm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [RFC PATCH v1 1/2] safe_macros.c: Fix missing ro flag for FUSE NTFS mounts
Date: Thu, 15 May 2025 21:48:26 +0200	[thread overview]
Message-ID: <20250515194826.GB501284@pevik> (raw)
In-Reply-To: <20250513165640.185122-2-japo@linux.ibm.com>

Hi Jan,

> The test incorrectly assumes that NTFS 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:

Reviewed-by: Petr Vorel <pvorel@suse.cz>
IMHO candidate for a release. Li, Cyril WDYT?

> 	sudo LTP_SINGLE_FS_TYPE=ntfs strace -e trace=mount,statmount -o log.log -s 128 -f ./statmount02
FYI the problem is currently LTP_SINGLE_FS_TYPE is still meant only for testing
one of the filesystems among .all_filesystems => these in fs_type_whitelist[]
(see lib/tst_supported_fs_types.c).

BTW that's similar to use case we haven't even formulated in issue:
https://lore.kernel.org/ltp/Z066Fj9VQVlTOMp_@rei.lan/
https://lore.kernel.org/ltp/Z1mA2wzjW0hpQxUH@yuki.lan/
(The only difference is that this requires to use filesystem not in
fs_type_whitelist[], therefore minor bug for it was found).

Kind regards,
Petr

> 	...
> 	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

> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
>  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 6946cc5bcb94..1270b17af8f4 100644
> --- a/lib/safe_macros.c
> +++ b/lib/safe_macros.c
> @@ -942,10 +942,15 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
>  	 */
>  	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 (!strcmp(filesystemtype, "ntfs") && 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);
>  		if (WIFEXITED(rval) && WEXITSTATUS(rval) == 0)

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-05-15 19:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 16:56 [LTP] [RFC PATCH v1 0/2] Fix NTFS-related failures in statmount02 and Jan Polensky
2025-05-13 16:56 ` [LTP] [RFC PATCH v1 1/2] safe_macros.c: Fix missing ro flag for FUSE NTFS mounts Jan Polensky
2025-05-15 19:48   ` Petr Vorel [this message]
2025-05-16  6:26     ` Li Wang via ltp
2025-05-21  9:37   ` Cyril Hrubis
2025-05-21  9:55     ` Cyril Hrubis
2025-06-04 11:59       ` Cyril Hrubis
2025-05-13 16:56 ` [LTP] [RFC PATCH v1 2/2] statmount06.c: Fix incorrect fs_type assumption NTFS->FUSEBLK Jan Polensky
2025-05-21  9:45   ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250515194826.GB501284@pevik \
    --to=pvorel@suse.cz \
    --cc=japo@linux.ibm.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.