[systemd-devel] [PATCH] core: fix oneshot service resource control

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Tue Jul 15 07:14:43 PDT 2014


On Tue, Jul 15, 2014 at 03:14:02PM +0200, Umut Tezduyar Lindskog wrote:
> On Tue, Jul 15, 2014 at 3:03 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > On Tue, Jul 15, 2014 at 08:36:29AM +0200, Umut Tezduyar Lindskog wrote:
> >> Oneshot services's cgroup is removed when the service
> >> exits. An assert is hit otherwise.
> >> ---
> >>  src/core/manager.c |    3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/src/core/manager.c b/src/core/manager.c
> >> index 3dffbe2..d27a45f 100644
> >> --- a/src/core/manager.c
> >> +++ b/src/core/manager.c
> >> @@ -2542,7 +2542,8 @@ void manager_check_finished(Manager *m) {
> >>          }
> >>
> >>          SET_FOREACH(u, m->startup_units, i)
> >> -                cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
> >> +                if (u && u->cgroup_path)
> >> +                        cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
> >
> > Why do you have to check for u? When iterating over a set, u cannot be NULL, no?
> 
> It seems like SET_FOREACH does the null check already. Thanks Zbyszek.
I pushed a version with the u check removed.

Zbyszek


More information about the systemd-devel mailing list