dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
eb8b6e
From faaac88f0686066e0b930952f12010f6d93fd6cf Mon Sep 17 00:00:00 2001
eb8b6e
From: Michal Sekletar <msekleta@redhat.com>
eb8b6e
Date: Mon, 4 Oct 2021 19:41:34 +0200
eb8b6e
Subject: [PATCH] mount: make mount units start jobs not runnable if
eb8b6e
 /p/s/mountinfo ratelimit is in effect
eb8b6e
eb8b6e
(cherry picked from commit a7c93dfe91e88a5a561341c523a45c7f8d71a588)
eb8b6e
eb8b6e
Related: #2037395
eb8b6e
---
eb8b6e
 src/core/mount.c | 3 +++
eb8b6e
 1 file changed, 3 insertions(+)
eb8b6e
eb8b6e
diff --git a/src/core/mount.c b/src/core/mount.c
eb8b6e
index 72341fe685..dbac1b7cb1 100644
eb8b6e
--- a/src/core/mount.c
eb8b6e
+++ b/src/core/mount.c
eb8b6e
@@ -1953,6 +1953,9 @@ static int mount_can_start(Unit *u) {
eb8b6e
 
eb8b6e
         assert(m);
eb8b6e
 
eb8b6e
+        if (sd_event_source_is_ratelimited(u->manager->mount_event_source))
eb8b6e
+                return -EAGAIN;
eb8b6e
+
eb8b6e
         r = unit_test_start_limit(u);
eb8b6e
         if (r < 0) {
eb8b6e
                 mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT);