mirror of
https://github.com/systemd/systemd.git
synced 2025-08-26 17:49:52 +03:00
mount: retrigger run queue after ratelimit expired to run delayed mount start jobs
Fixes #20329
This commit is contained in:
@ -1838,6 +1838,21 @@ static bool mount_is_mounted(Mount *m) {
|
|||||||
return UNIT(m)->perpetual || FLAGS_SET(m->proc_flags, MOUNT_PROC_IS_MOUNTED);
|
return UNIT(m)->perpetual || FLAGS_SET(m->proc_flags, MOUNT_PROC_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) {
|
static void mount_enumerate(Manager *m) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -1891,6 +1906,12 @@ static void mount_enumerate(Manager *m) {
|
|||||||
goto fail;
|
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");
|
(void) sd_event_source_set_description(m->mount_event_source, "mount-monitor-dispatch");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user