diff mbox series

[v2,3/3] tst_cgroup: make use of alias in safe_cgroup_has

Message ID 20210622122538.402907-3-liwang@redhat.com
State Superseded
Headers show
Series [v2,1/3] mem: child alloc memory should larger than memory.max + memory.swap.max if lite==1 | expand

Commit Message

Li Wang June 22, 2021, 12:25 p.m. UTC
This is to fix the check issue of 'memory.swap.max' on CGroup v1.

Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Richard Palethorpe <rpalethorpe@suse.com>
---
 lib/tst_cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Palethorpe June 22, 2021, 1:40 p.m. UTC | #1
Hello,

Li Wang <liwang@redhat.com> writes:

> This is to fix the check issue of 'memory.swap.max' on CGroup v1.
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> Cc: Richard Palethorpe <rpalethorpe@suse.com>
> ---
>  lib/tst_cgroup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
> index 18e3b6169..61cc02fa7 100644
> --- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -1010,7 +1010,7 @@ int safe_cgroup_has(const char *const file, const int lineno,
>  		if (!(alias = cgroup_file_alias(cfile, *dir)))
>  		    continue;
>  
> -		if (!faccessat((*dir)->dir_fd, file_name, F_OK, 0))

Ah, dumb mistake by me!

> +		if (!faccessat((*dir)->dir_fd, alias, F_OK, 0))
>  			return 1;
>  
>  		if (errno == ENOENT)

Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
diff mbox series

Patch

diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
index 18e3b6169..61cc02fa7 100644
--- a/lib/tst_cgroup.c
+++ b/lib/tst_cgroup.c
@@ -1010,7 +1010,7 @@  int safe_cgroup_has(const char *const file, const int lineno,
 		if (!(alias = cgroup_file_alias(cfile, *dir)))
 		    continue;
 
-		if (!faccessat((*dir)->dir_fd, file_name, F_OK, 0))
+		if (!faccessat((*dir)->dir_fd, alias, F_OK, 0))
 			return 1;
 
 		if (errno == ENOENT)