[LTP] [PATCH] syscalls/fanotify10: Make evictable marks test more reliable
Jan Kara
jack@suse.cz
Thu Aug 25 16:03:06 CEST 2022
In some setups evictable marks tests are failing because the inode with
evictable mark does not get evicted. Make sure we sync the filesystem
before we try to drop caches to increase likelyhood the inode will get
evicted.
Reported-by: Jan Stancek <jstancek@redhat.com>
Reported-by: Dominique Leuenberger <dimstar@opensuse.org>
Acked-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
testcases/kernel/syscalls/fanotify/fanotify10.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify10.c b/testcases/kernel/syscalls/fanotify/fanotify10.c
index 19e43d2c2762..54636ce2ddd4 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify10.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify10.c
@@ -342,6 +342,15 @@ static void show_fanotify_marks(int fd)
}
}
+static void drop_caches(char *path)
+{
+ int fd = SAFE_OPEN(path, O_RDONLY);
+ if (syncfs(fd) < 0)
+ tst_brk(TBROK | TERRNO, "Unexpected error when syncing filesystem");
+ SAFE_CLOSE(fd);
+ SAFE_FILE_PRINTF(DROP_CACHES_FILE, "3");
+}
+
static int create_fanotify_groups(unsigned int n)
{
struct tcase *tc = &tcases[n];
@@ -402,7 +411,7 @@ add_mark:
* drop_caches should evict inode from cache and remove evictable marks
*/
if (evictable_ignored) {
- SAFE_FILE_PRINTF(DROP_CACHES_FILE, "3");
+ drop_caches(tc->mark_path);
for (p = 0; p < num_classes; p++) {
for (i = 0; i < GROUPS_PER_PRIO; i++) {
if (fd_notify[p][i] > 0)
--
2.35.3
More information about the ltp
mailing list