2023-03-26 22:03:38

by David Vernet

[permalink] [raw]
Subject: Re: [PATCH] selftests: cgroup: Fix exception handling in test_memcg_oom_group_score_events()

On Sun, Mar 26, 2023 at 10:15:31AM +0200, Markus Elfring wrote:

[...]

> >>
> >> Fixes: a987785dcd6c8ae2915460582aebd6481c81eb67 ("Add tests for memory.oom.group")
> >
> > Fixes what in the what now?
>
> 1. Check repetition (which can be undesirable)
>
> 2. Can a cg_destroy() call ever work as expected if a cg_create() call failed?

Perhaps next time you can answer your own question by spending 30
seconds actually reading the code you're "fixing":

int cg_destroy(const char *cgroup)
{
int ret;

retry:
ret = rmdir(cgroup);
if (ret && errno == EBUSY) {
cg_killall(cgroup);
usleep(100);
goto retry;
}

if (ret && errno == ENOENT) <<< that case is explicitly handled here
ret = 0;

return ret;
}