unit: check for mount rate limiting before checking active state

Having this check as part of mount_can_start() is too late because
UNIT(u)->can_start() virtual method is called after checking the active
state of unit in unit_start().

We need to hold off running mount start jobs when /p/s/mountinfo monitor
is rate limited even when given mount unit is already active.

Fixes #20329
This commit is contained in:
Michal Sekletar
2022-05-30 13:22:16 +02:00
parent df90d255fe
commit b161bc394b
2 changed files with 4 additions and 3 deletions
+4
View File
@@ -1868,6 +1868,10 @@ int unit_start(Unit *u) {
assert(u);
/* Let's hold off running start jobs for mount units when /proc/self/mountinfo monitor is rate limited. */
if (u->type == UNIT_MOUNT && sd_event_source_is_ratelimited(u->manager->mount_event_source))
return -EAGAIN;
/* If this is already started, then this will succeed. Note that this will even succeed if this unit
* is not startable by the user. This is relied on to detect when we need to wait for units and when
* waiting is finished. */