Skip to content

Commit 52a9810

Browse files
metan-ucwpevik
authored andcommitted
SAFE_MOUNT: Fix mountflags handling for FUSE
- abort tests on FUSE when particular mount flag is not implemented - implement MS_RDONLY for FUSE - enable statmount02 that failed previously because of missing MS_RDONLY Link: https://lore.kernel.org/ltp/20250630122719.12948-1-chrubis@suse.cz/ Reported-by: Jan Polensky <japo@linux.ibm.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Jan Polensky <japo@linux.ibm.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
1 parent 3d745e5 commit 52a9810

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/safe_macros.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,10 +942,19 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
942942
*/
943943
if (possibly_fuse(filesystemtype)) {
944944
char buf[1024];
945+
const char *mount_ro = "";
946+
947+
if (mountflags & MS_RDONLY)
948+
mount_ro = "-o ro";
949+
950+
if (mountflags & (~MS_RDONLY)) {
951+
tst_brkm_(file, lineno, TBROK, cleanup_fn,
952+
"FUSE mount flag(s) not implemented!");
953+
}
945954

946955
tst_resm_(file, lineno, TINFO, "Trying FUSE...");
947-
snprintf(buf, sizeof(buf), "mount.%s '%s' '%s'",
948-
filesystemtype, source, target);
956+
snprintf(buf, sizeof(buf), "mount.%s %s '%s' '%s'",
957+
filesystemtype, mount_ro, source, target);
949958

950959
rval = tst_system(buf);
951960
if (WIFEXITED(rval) && WEXITSTATUS(rval) == 0)

testcases/kernel/syscalls/statmount/statmount02.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ static struct tst_test test = {
6868
.format_device = 1,
6969
.all_filesystems = 1,
7070
.skip_filesystems = (const char *const []) {
71-
"fuse",
7271
"btrfs",
7372
NULL
7473
},

0 commit comments

Comments
 (0)