]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
unit: add jobs that were skipped because of ratelimit back to run_queue
authorMichal Sekletar <msekleta@redhat.com>
Thu, 25 Nov 2021 17:28:25 +0000 (18:28 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 29 Nov 2021 18:06:35 +0000 (03:06 +0900)
Assumption in edc027b was that job we first skipped because of active
ratelimit is still in run_queue. Hence we trigger the queue and dispatch
it in the next iteration. Actually we remove jobs from run_queue in
job_run_and_invalidate() before we call unit_start(). Hence if we want
to attempt to run the job again in the future we need to add it back
to run_queue.

Fixes #21458

src/core/mount.c

index 90b11347f71dc95e284f150a384f7e4d3d651330..35368fe8e682b7fef8628cc008eaeaf37cd191de 100644 (file)
@@ -1840,9 +1840,18 @@ static bool mount_is_mounted(Mount *m) {
 
 static int mount_on_ratelimit_expire(sd_event_source *s, void *userdata) {
         Manager *m = userdata;
+        Job *j;
 
         assert(m);
 
+        /* Let's enqueue all start jobs that were previously skipped because of active ratelimit. */
+        HASHMAP_FOREACH(j, m->jobs) {
+                if (j->unit->type != UNIT_MOUNT)
+                        continue;
+
+                job_add_to_run_queue(j);
+        }
+
         /* By entering ratelimited state we made all mount start jobs not runnable, now rate limit is over so
          * let's make sure we dispatch them in the next iteration. */
         manager_trigger_run_queue(m);