From: Amir Goldstein <amir73il@gmail.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: Jan Kara <jack@suse.cz>,
ltp@lists.linux.it, Al Viro <viro@zeniv.linux.org.uk>
Subject: [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure
Date: Mon, 23 Jun 2025 09:37:17 +0200 [thread overview]
Message-ID: <20250623073717.338178-1-amir73il@gmail.com> (raw)
Avoid setting vfs_cache_pressure to zero if test was not run
because kernel does not support fanotify.
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/linux-fsdevel/20250622215140.GX1880847@ZenIV/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
testcases/kernel/syscalls/fanotify/fanotify10.c | 8 ++++----
testcases/kernel/syscalls/fanotify/fanotify23.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify10.c b/testcases/kernel/syscalls/fanotify/fanotify10.c
index ccb4f55df..2d33416f3 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify10.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify10.c
@@ -102,7 +102,6 @@ static int ignore_mark_unsupported;
#define DROP_CACHES_FILE "/proc/sys/vm/drop_caches"
#define CACHE_PRESSURE_FILE "/proc/sys/vm/vfs_cache_pressure"
-static int old_cache_pressure;
static pid_t child_pid;
static int bind_mount_created;
static unsigned int num_classes = NUM_CLASSES;
@@ -925,7 +924,6 @@ static void setup(void)
SAFE_MKDIR(MNT2_PATH, 0755);
mount_cycle();
- SAFE_FILE_SCANF(CACHE_PRESSURE_FILE, "%d", &old_cache_pressure);
/* Set high priority for evicting inodes */
SAFE_FILE_PRINTF(CACHE_PRESSURE_FILE, "500");
}
@@ -939,8 +937,6 @@ static void cleanup(void)
if (bind_mount_created)
SAFE_UMOUNT(MNT2_PATH);
- SAFE_FILE_PRINTF(CACHE_PRESSURE_FILE, "%d", old_cache_pressure);
-
for (i = 0; i < max_file_multi; i++) {
char path[PATH_MAX];
@@ -972,6 +968,10 @@ static struct tst_test test = {
TEST_APP,
NULL
},
+ .save_restore = (const struct tst_path_val[]) {
+ {CACHE_PRESSURE_FILE, NULL, TST_SR_TCONF},
+ {}
+ },
.tags = (const struct tst_tag[]) {
{"linux-git", "9bdda4e9cf2d"},
{"linux-git", "2f02fd3fa13e"},
diff --git a/testcases/kernel/syscalls/fanotify/fanotify23.c b/testcases/kernel/syscalls/fanotify/fanotify23.c
index 26c9e87fb..36c7779da 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify23.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify23.c
@@ -35,7 +35,6 @@
#define DROP_CACHES_FILE "/proc/sys/vm/drop_caches"
#define CACHE_PRESSURE_FILE "/proc/sys/vm/vfs_cache_pressure"
-static int old_cache_pressure;
static int fd_notify;
static unsigned long long event_set[EVENT_MAX];
@@ -234,7 +233,6 @@ static void setup(void)
FAN_MARK_FILESYSTEM,
FAN_ATTRIB, MOUNT_PATH);
- SAFE_FILE_SCANF(CACHE_PRESSURE_FILE, "%d", &old_cache_pressure);
/* Set high priority for evicting inodes */
SAFE_FILE_PRINTF(CACHE_PRESSURE_FILE, "500");
}
@@ -243,8 +241,6 @@ static void cleanup(void)
{
if (fd_notify > 0)
SAFE_CLOSE(fd_notify);
-
- SAFE_FILE_PRINTF(CACHE_PRESSURE_FILE, "%d", old_cache_pressure);
}
static struct tst_test test = {
@@ -259,6 +255,10 @@ static struct tst_test test = {
{.type = "ext2"},
{}
},
+ .save_restore = (const struct tst_path_val[]) {
+ {CACHE_PRESSURE_FILE, NULL, TST_SR_TCONF},
+ {}
+ },
};
#else
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2025-06-23 7:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 7:37 Amir Goldstein [this message]
2025-06-24 16:38 ` [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure Wei Gao via ltp
2025-06-24 5:41 ` Amir Goldstein
2025-06-24 18:23 ` Wei Gao via ltp
2025-06-25 9:47 ` Andrea Cervesato via ltp
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=20250623073717.338178-1-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox