[systemd-devel] [PATCHv2] core: do not spawn jobs or touch other units during coldplugging

Ivan Shapovalov intelfx100 at gmail.com
Fri Apr 24 18:00:17 PDT 2015


On 2015-04-24 at 16:04 +0200, Lennart Poettering wrote:
> On Fri, 24.04.15 15:52, Lennart Poettering (lennart at poettering.net) 
> wrote:
> 
> > before we coldplug a unit, we should coldplug all units it might
> > trigger, which are those with a listed UNIT_TRIGGERS dependency, as
> > well as all those that retroactively_start_dependencies() and
> > retroactively_stop_dependencies() operates on. Of course, we should
> > also avoid running in loops here, but that should be easy by 
> > keeping a
> > per-unit coldplug boolean around.
> 
> Actually, it really is about the UNIT_TRIGGERS dependencies only,
> since we don't do the retroactive deps stuff at all when we are
> coldplugging, it's conditionalized in m->n_reloading <= 0.

So, I think I understand the problem. We should do this not only for
UNIT_TRIGGERS, but also for any dependencies which may matter
when activating that unit. That is, anything which is referenced by
transaction_add_job_and_dependencies()... recursively.

To illustrate:

- A.path triggers A.service
- A.service requires basic.target
- we begin coldplugging
- we coldplug A.path
- by your patch, we first coldplug A.service
  -> A.service is now active
- we continue coldplugging A.path
  -> NB: basic.target is not coldplugged yet!
- A.path enters "running" and starts A.service
- transaction_add_job_and_dependencies() adds jobs for
  all dependencies of A.service
- at this point we're fucked up:
  basic.target is not coldplugged, but a job is added for it

-- 
Ivan Shapovalov / intelfx /
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150425/72d99d79/attachment.sig>


More information about the systemd-devel mailing list