pid1: add env var to override default mount rate limit interval
This commit is contained in:
parent
63739f235a
commit
ba1f969e3d
@ -0,0 +1,57 @@
|
|||||||
|
From cc2030f928981947db8fb9ec185a82024abab2c4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: xujing <xujing125@huawei.com>
|
||||||
|
Date: Wed, 16 Oct 2024 15:19:09 +0800
|
||||||
|
Subject: [PATCH] pid1: add env var to override default mount rate limit
|
||||||
|
interval
|
||||||
|
|
||||||
|
Similar to 24a4542c. 24a4542c can only be set 1 in 1s at most,
|
||||||
|
sometimes we may need to set to something else(such as 1 in 2s).
|
||||||
|
So it's best to let the user decide.
|
||||||
|
|
||||||
|
This also allows users to solve #34690.
|
||||||
|
|
||||||
|
Signed-off-by: xujing <xujing125@huawei.com>
|
||||||
|
---
|
||||||
|
src/core/mount.c | 14 +++++++++++---
|
||||||
|
1 files changed, 11 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/core/mount.c b/src/core/mount.c
|
||||||
|
index ead9b46..f4bc6eb 100644
|
||||||
|
--- a/src/core/mount.c
|
||||||
|
+++ b/src/core/mount.c
|
||||||
|
@@ -1875,6 +1875,7 @@ static void mount_enumerate(Manager *m) {
|
||||||
|
mnt_init_debug(0);
|
||||||
|
|
||||||
|
if (!m->mount_monitor) {
|
||||||
|
+ usec_t mount_rate_limit_interval = 1 * USEC_PER_SEC;
|
||||||
|
unsigned mount_rate_limit_burst = 5;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
@@ -1916,14 +1917,21 @@ static void mount_enumerate(Manager *m) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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");
|
||||||
|
+ const char *e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_INTERVAL_SEC");
|
||||||
|
+ if (e) {
|
||||||
|
+ r = parse_sec(e, &mount_rate_limit_interval);
|
||||||
|
+ if (r < 0)
|
||||||
|
+ log_debug_errno(r, "Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_INTERVAL_SEC, ignoring: %s", e);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ 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);
|
||||||
|
+ log_debug_errno(r, "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);
|
||||||
|
+ r = sd_event_source_set_ratelimit(m->mount_event_source, mount_rate_limit_interval, mount_rate_limit_burst);
|
||||||
|
if (r < 0) {
|
||||||
|
log_error_errno(r, "Failed to enable rate limit for mount events: %m");
|
||||||
|
goto fail;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -25,7 +25,7 @@
|
|||||||
Name: systemd
|
Name: systemd
|
||||||
Url: https://systemd.io/
|
Url: https://systemd.io/
|
||||||
Version: 255
|
Version: 255
|
||||||
Release: 24
|
Release: 25
|
||||||
License: MIT and LGPLv2+ and GPLv2+
|
License: MIT and LGPLv2+ and GPLv2+
|
||||||
Summary: System and Service Manager
|
Summary: System and Service Manager
|
||||||
|
|
||||||
@ -71,6 +71,7 @@ Patch6017: backport-sd-event-fix-fd-leak-when-fd-is-owned-by-IO-event-sourc
|
|||||||
Patch6018: backport-fix-cgtop-sscanf-return-code-checks.patch
|
Patch6018: backport-fix-cgtop-sscanf-return-code-checks.patch
|
||||||
Patch6019: backport-mount-optimize-mountinfo-traversal-by-decoupling-dev.patch
|
Patch6019: backport-mount-optimize-mountinfo-traversal-by-decoupling-dev.patch
|
||||||
Patch6020: backport-systemctl-fix-printing-of-RootImageOptions.patch
|
Patch6020: backport-systemctl-fix-printing-of-RootImageOptions.patch
|
||||||
|
Patch6021: backport-pid1-add-env-var-to-override-default-mount-rate-limit-interval.patch
|
||||||
|
|
||||||
Patch9008: update-rtc-with-system-clock-when-shutdown.patch
|
Patch9008: update-rtc-with-system-clock-when-shutdown.patch
|
||||||
Patch9009: udev-add-actions-while-rename-netif-failed.patch
|
Patch9009: udev-add-actions-while-rename-netif-failed.patch
|
||||||
@ -1660,6 +1661,9 @@ fi
|
|||||||
%{_unitdir}/veritysetup.target
|
%{_unitdir}/veritysetup.target
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 11 2024 xujing <xujing125@huawei.com> - 255-25
|
||||||
|
- pid1: add env var to override default mount rate limit interval
|
||||||
|
|
||||||
* Wed Nov 6 2024 Han Jinpeng <hanjinpeng@kylinos.cn> - 255-24
|
* Wed Nov 6 2024 Han Jinpeng <hanjinpeng@kylinos.cn> - 255-24
|
||||||
- backport: fix systemctl printing of RootImageOptions issue
|
- backport: fix systemctl printing of RootImageOptions issue
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user