* [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure
@ 2025-06-23 7:37 Amir Goldstein
2025-06-24 16:38 ` Wei Gao via ltp
2025-06-25 9:47 ` Andrea Cervesato via ltp
0 siblings, 2 replies; 5+ messages in thread
From: Amir Goldstein @ 2025-06-23 7:37 UTC (permalink / raw)
To: Petr Vorel; +Cc: Jan Kara, ltp, Al Viro
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure
2025-06-24 16:38 ` Wei Gao via ltp
@ 2025-06-24 5:41 ` Amir Goldstein
2025-06-24 18:23 ` Wei Gao via ltp
0 siblings, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2025-06-24 5:41 UTC (permalink / raw)
To: Wei Gao; +Cc: Jan Kara, Al Viro, ltp
On Tue, Jun 24, 2025 at 6:39 AM Wei Gao <wegao@suse.com> wrote:
>
> On Mon, Jun 23, 2025 at 09:37:17AM +0200, Amir Goldstein wrote:
> > 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
>
> For me this patch more looks like an improvement instead of a fix.
> Thanks for your patch.
>
It is a fix to the problem reported by Al Viro in the linked message.
Thanks,
Amir.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure
2025-06-23 7:37 [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure Amir Goldstein
@ 2025-06-24 16:38 ` Wei Gao via ltp
2025-06-24 5:41 ` Amir Goldstein
2025-06-25 9:47 ` Andrea Cervesato via ltp
1 sibling, 1 reply; 5+ messages in thread
From: Wei Gao via ltp @ 2025-06-24 16:38 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Jan Kara, Al Viro, ltp
On Mon, Jun 23, 2025 at 09:37:17AM +0200, Amir Goldstein wrote:
> 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
For me this patch more looks like an improvement instead of a fix.
Thanks for your patch.
Acked-by: Wei Gao <wegao@suse.com>
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure
2025-06-24 5:41 ` Amir Goldstein
@ 2025-06-24 18:23 ` Wei Gao via ltp
0 siblings, 0 replies; 5+ messages in thread
From: Wei Gao via ltp @ 2025-06-24 18:23 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Jan Kara, Al Viro, ltp
On Tue, Jun 24, 2025 at 07:41:46AM +0200, Amir Goldstein wrote:
> On Tue, Jun 24, 2025 at 6:39 AM Wei Gao <wegao@suse.com> wrote:
> >
> > On Mon, Jun 23, 2025 at 09:37:17AM +0200, Amir Goldstein wrote:
> > > 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
> >
> > For me this patch more looks like an improvement instead of a fix.
> > Thanks for your patch.
> >
>
> It is a fix to the problem reported by Al Viro in the linked message.
Thanks, after check email carefully, i guess the the test skip initial
old_cache_pressure in setup but do wirte 0 to old_cache_pressure in
cleanup trigger the issue.
>
> Thanks,
> Amir.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure
2025-06-23 7:37 [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure Amir Goldstein
2025-06-24 16:38 ` Wei Gao via ltp
@ 2025-06-25 9:47 ` Andrea Cervesato via ltp
1 sibling, 0 replies; 5+ messages in thread
From: Andrea Cervesato via ltp @ 2025-06-25 9:47 UTC (permalink / raw)
To: Amir Goldstein, Petr Vorel; +Cc: Jan Kara, Al Viro, ltp
Hi!
Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>
Merged.
- Andrea
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-25 9:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23 7:37 [LTP] [PATCH] fanotify10, fanotify23: fix cleanup of vfs_cache_pressure Amir Goldstein
2025-06-24 16:38 ` 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
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.