You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.8 KiB
55 lines
1.8 KiB
2 years ago
|
From b0c226e9fd3e6bfa5388832cc2745d9ec935f3ec Mon Sep 17 00:00:00 2001
|
||
|
From: Michal Sekletar <msekleta@redhat.com>
|
||
|
Date: Mon, 4 Oct 2021 20:31:49 +0200
|
||
|
Subject: [PATCH] mount: retrigger run queue after ratelimit expired to run
|
||
|
delayed mount start jobs
|
||
|
|
||
|
Fixes #20329
|
||
|
|
||
|
(cherry picked from commit edc027b4f1cfaa49e8ecdde763eb8c623402d464)
|
||
|
|
||
|
Related: #2036608
|
||
|
---
|
||
|
src/core/mount.c | 21 +++++++++++++++++++++
|
||
|
1 file changed, 21 insertions(+)
|
||
|
|
||
|
diff --git a/src/core/mount.c b/src/core/mount.c
|
||
|
index ab09e6fbb0..bdba9e6884 100644
|
||
|
--- a/src/core/mount.c
|
||
|
+++ b/src/core/mount.c
|
||
|
@@ -1710,6 +1710,21 @@ static bool mount_is_mounted(Mount *m) {
|
||
|
return UNIT(m)->perpetual || m->is_mounted;
|
||
|
}
|
||
|
|
||
|
+static int mount_on_ratelimit_expire(sd_event_source *s, void *userdata) {
|
||
|
+ Manager *m = userdata;
|
||
|
+ int r;
|
||
|
+
|
||
|
+ assert(m);
|
||
|
+
|
||
|
+ /* 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. */
|
||
|
+ r = sd_event_source_set_enabled(m->run_queue_event_source, SD_EVENT_ONESHOT);
|
||
|
+ if (r < 0)
|
||
|
+ log_debug_errno(r, "Failed to enable run queue event source, ignoring: %m");
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
static void mount_enumerate(Manager *m) {
|
||
|
int r;
|
||
|
|
||
|
@@ -1763,6 +1778,12 @@ static void mount_enumerate(Manager *m) {
|
||
|
goto fail;
|
||
|
}
|
||
|
|
||
|
+ r = sd_event_source_set_ratelimit_expire_callback(m->mount_event_source, mount_on_ratelimit_expire);
|
||
|
+ if (r < 0) {
|
||
|
+ log_error_errno(r, "Failed to enable rate limit for mount events: %m");
|
||
|
+ goto fail;
|
||
|
+ }
|
||
|
+
|
||
|
(void) sd_event_source_set_description(m->mount_event_source, "mount-monitor-dispatch");
|
||
|
}
|
||
|
|