summaryrefslogtreecommitdiff
path: root/src/core/mount.c
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2022-12-05 21:05:54 +0000
committerLuca Boccassi <bluca@debian.org>2022-12-05 21:05:57 +0000
commit24a4542cfa674ee80b54afcc223f2490a011966b (patch)
treea394e8772613278994283524fe06e5ead71fbdc0 /src/core/mount.c
parentde28dd77c12d67574cc5add467858ef37c518d2b (diff)
downloadsystemd-24a4542cfa674ee80b54afcc223f2490a011966b.tar.gz
pid1: add env var to override default mount rate limit burst
I am hitting the rate limit on a busy system with low resources, and it stalls the boot process which is Very Bad (TM).
Diffstat (limited to 'src/core/mount.c')
-rw-r--r--src/core/mount.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index be46e56689..f16e5c487b 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1909,6 +1909,7 @@ static void mount_enumerate(Manager *m) {
mnt_init_debug(0);
if (!m->mount_monitor) {
+ unsigned mount_rate_limit_burst = 5;
int fd;
m->mount_monitor = mnt_new_monitor();
@@ -1948,7 +1949,15 @@ static void mount_enumerate(Manager *m) {
goto fail;
}
- r = sd_event_source_set_ratelimit(m->mount_event_source, 1 * USEC_PER_SEC, 5);
+ /* Let users override the default (5 in 1s), as it stalls the boot sequence on busy systems. */
+ const char *e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST");
+ if (e) {
+ r = safe_atou(e, &mount_rate_limit_burst);
+ if (r < 0)
+ log_debug("Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST, ignoring: %s", e);
+ }
+
+ r = sd_event_source_set_ratelimit(m->mount_event_source, 1 * USEC_PER_SEC, mount_rate_limit_burst);
if (r < 0) {
log_error_errno(r, "Failed to enable rate limit for mount events: %m");
goto fail;