Skip to content

Conversation

@poettering
Copy link
Member

Fixes: #16669

Copy link
Member

@keszybz keszybz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good fix, but I think the check in the first patch looks like something that grew organically over time and should be refactored now.

UNIT_NOT_FOUND,
UNIT_BAD_SETTING,
UNIT_ERROR,
UNIT_MASKED)|| other->type != UNIT_MOUNT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the states that are left are UNIT_STUB and UNIT_MERGED. I think it'd be cleaner at this point to invert the condition (and maybe even emit a warning if we hit that path. Wouldn't that mean some fuckup in the unit handling logic if a stub unit or a merged unit emitted a notification?).

Also, space before || is missing.

@keszybz keszybz added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Sep 12, 2020
In 4c2ef32 we enabled propagating
triggered unit state to the triggering unit for service units in more
load states, so that we don't accidentally stop tracking state
correctly.

Do the same for our other triggering unit states: automounts, paths, and
timers.

Also, make this an assertion rather than a simple test. After all it
should never happen that we get called for half-loaded units or units of
the wrong type. The load routines should already have made this
impossible.
We already do this for socket and automount units, do it for path units
too: if the triggered service keeps hitting the start limit, then fail
the triggering unit too, so that we don#t busy loop forever.

(Note that this leaves only timer units out in the cold for this kind of
protection, but it shouldn't matter there, as they are naturally
protected against busy loops: they are scheduled by time anyway).

Fixes: systemd#16669
This is implied in C and we generally don't bother with this, so don't
bother with this here either.
@poettering
Copy link
Member Author

Force pushed a new version, which upgrades these tests to assert() and turns them around. PTAL.

I think they should be asserts since it shouldn't be possible we get into the state where state changes are triggered on UNIT_STUB or UNIT_MERGED unit load states.

@poettering poettering removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Sep 14, 2020
@keszybz
Copy link
Member

keszybz commented Sep 14, 2020

Looks reasonable. I guess that if we ever get the logic wrong, at least it'll be easy to notice with all the asserts.

@keszybz
Copy link
Member

keszybz commented Sep 14, 2020

bionic-i386 timed out, and semaphoreci says something about lxc. Looks unrelated.

@keszybz keszybz merged commit 094c6fc into systemd:master Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

PathExists triggers continously, hogging CPU

2 participants