All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/2] fanotify21: fix test failure when running iterations
@ 2026-05-28 16:29 Amir Goldstein
  2026-05-28 16:29 ` [LTP] [PATCH v2 2/2] fanotify13: " Amir Goldstein
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Amir Goldstein @ 2026-05-28 16:29 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Jan Kara, ltp, AnonymeMeow

Peter reported that fanotify21 -i2 fails.
Fix this by always remounting ro/rw before every test.
Use a bind mount, where remount works regardless of base fs.

Reported-by: Petr Vorel <pvorel@suse.cz>
Link: https://lore.kernel.org/linux-fsdevel/20260527072312.GA231966@pevik/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---

changes since v1:
- Address LTP AI Reviewer comments

 .../kernel/syscalls/fanotify/fanotify21.c      | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/testcases/kernel/syscalls/fanotify/fanotify21.c
index 340fb0018..4d2115469 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify21.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify21.c
@@ -123,6 +123,9 @@ static void do_setup(void)
 	int pidfd;
 	int init_flags = FAN_REPORT_PIDFD;
 
+	/* Bind mount so remount ro/rw always work */
+	SAFE_MOUNT(MOUNT_PATH, MOUNT_PATH, "none", MS_BIND, NULL);
+
 	if (tst_variant) {
 		fanotify_fd = -1;
 		fd_error_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_FD_ERROR, ".");
@@ -171,15 +174,9 @@ static void do_test(unsigned int num)
 		return;
 	}
 
-	if (tc->remount_ro) {
-		/* SAFE_MOUNT fails to remount FUSE */
-		if (mount(tst_device->dev, MOUNT_PATH, tst_device->fs_type,
-			  MS_REMOUNT|MS_RDONLY, NULL) != 0) {
-			tst_brk(TFAIL,
-				"filesystem %s failed to remount readonly",
-				tst_device->fs_type);
-		}
-	}
+	/* remount ro/rw the bind mount */
+	SAFE_MOUNT("none", MOUNT_PATH, "none", MS_BIND | MS_REMOUNT |
+		   (tc->remount_ro ? MS_RDONLY : 0), NULL);
 
 	/*
 	 * Generate the event in either self or a child process. Event
@@ -355,6 +352,9 @@ static void do_cleanup(void)
 
 	if (self_pidfd_fdinfo)
 		free(self_pidfd_fdinfo);
+
+	/* Unmount the bind mount */
+	SAFE_UMOUNT(MOUNT_PATH);
 }
 
 static struct tst_test test = {
-- 
2.54.0


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

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

end of thread, other threads:[~2026-06-03 13:34 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28 16:29 [LTP] [PATCH v2 1/2] fanotify21: fix test failure when running iterations Amir Goldstein
2026-05-28 16:29 ` [LTP] [PATCH v2 2/2] fanotify13: " Amir Goldstein
2026-05-29 16:30   ` Petr Vorel
2026-05-30 14:01     ` Amir Goldstein
2026-06-03 13:33       ` Petr Vorel
2026-05-29 16:34   ` Petr Vorel
2026-05-31 23:41   ` [LTP] [PATCH] " AnonymeMeow
2026-06-01  4:11     ` [LTP] " linuxtestproject.agent
2026-06-01  8:29     ` [LTP] [PATCH] " Amir Goldstein
2026-06-03  1:58       ` [LTP] [PATCH v2] " AnonymeMeow
2026-06-03  4:15         ` [LTP] " linuxtestproject.agent
2026-06-03 10:24         ` [LTP] [PATCH v2] " Amir Goldstein
2026-06-03 11:51           ` Petr Vorel
2026-05-28 18:43 ` [LTP] fanotify21: " linuxtestproject.agent
2026-05-29 16:25 ` [LTP] [PATCH v2 1/2] " 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.