|
|
446ea3 |
From f5611a22d4a65ef440352792085774ce898adb0f Mon Sep 17 00:00:00 2001
|
|
|
446ea3 |
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
|
446ea3 |
Date: Tue, 15 Jun 2021 02:13:59 +0900
|
|
|
446ea3 |
Subject: [PATCH] sd-event: always reshuffle time prioq on changing
|
|
|
446ea3 |
online/offline state
|
|
|
446ea3 |
|
|
|
446ea3 |
Before 81107b8419c39f726fd2805517a5b9faab204e59, the compare functions
|
|
|
446ea3 |
for the latest or earliest prioq did not handle ratelimited flag.
|
|
|
446ea3 |
So, it was ok to not reshuffle the time prioq when changing the flag.
|
|
|
446ea3 |
|
|
|
446ea3 |
But now, those two compare functions also compare the source is
|
|
|
446ea3 |
ratelimited or not. So, it is necessary to reshuffle the time prioq
|
|
|
446ea3 |
after changing the ratelimited flag.
|
|
|
446ea3 |
|
|
|
446ea3 |
Hopefully fixes #19903.
|
|
|
446ea3 |
|
|
|
446ea3 |
(cherry picked from commit 2115b9b6629eeba7bc9f42f757f38205febb1cb7)
|
|
|
446ea3 |
|
|
|
446ea3 |
Related: #1984406
|
|
|
446ea3 |
---
|
|
|
446ea3 |
src/libsystemd/sd-event/sd-event.c | 33 ++++++++++--------------------
|
|
|
446ea3 |
1 file changed, 11 insertions(+), 22 deletions(-)
|
|
|
446ea3 |
|
|
|
446ea3 |
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
|
|
|
446ea3 |
index ae46392901..f78da00c3a 100644
|
|
|
446ea3 |
--- a/src/libsystemd/sd-event/sd-event.c
|
|
|
446ea3 |
+++ b/src/libsystemd/sd-event/sd-event.c
|
|
|
446ea3 |
@@ -2390,14 +2390,6 @@ static int event_source_offline(
|
|
|
446ea3 |
source_io_unregister(s);
|
|
|
446ea3 |
break;
|
|
|
446ea3 |
|
|
|
446ea3 |
- case SOURCE_TIME_REALTIME:
|
|
|
446ea3 |
- case SOURCE_TIME_BOOTTIME:
|
|
|
446ea3 |
- case SOURCE_TIME_MONOTONIC:
|
|
|
446ea3 |
- case SOURCE_TIME_REALTIME_ALARM:
|
|
|
446ea3 |
- case SOURCE_TIME_BOOTTIME_ALARM:
|
|
|
446ea3 |
- event_source_time_prioq_reshuffle(s);
|
|
|
446ea3 |
- break;
|
|
|
446ea3 |
-
|
|
|
446ea3 |
case SOURCE_SIGNAL:
|
|
|
446ea3 |
event_gc_signal_data(s->event, &s->priority, s->signal.sig);
|
|
|
446ea3 |
break;
|
|
|
446ea3 |
@@ -2415,6 +2407,11 @@ static int event_source_offline(
|
|
|
446ea3 |
prioq_reshuffle(s->event->exit, s, &s->exit.prioq_index);
|
|
|
446ea3 |
break;
|
|
|
446ea3 |
|
|
|
446ea3 |
+ case SOURCE_TIME_REALTIME:
|
|
|
446ea3 |
+ case SOURCE_TIME_BOOTTIME:
|
|
|
446ea3 |
+ case SOURCE_TIME_MONOTONIC:
|
|
|
446ea3 |
+ case SOURCE_TIME_REALTIME_ALARM:
|
|
|
446ea3 |
+ case SOURCE_TIME_BOOTTIME_ALARM:
|
|
|
446ea3 |
case SOURCE_DEFER:
|
|
|
446ea3 |
case SOURCE_POST:
|
|
|
446ea3 |
case SOURCE_INOTIFY:
|
|
|
446ea3 |
@@ -2424,6 +2421,9 @@ static int event_source_offline(
|
|
|
446ea3 |
assert_not_reached("Wut? I shouldn't exist.");
|
|
|
446ea3 |
}
|
|
|
446ea3 |
|
|
|
446ea3 |
+ /* Always reshuffle time prioq, as the ratelimited flag may be changed. */
|
|
|
446ea3 |
+ event_source_time_prioq_reshuffle(s);
|
|
|
446ea3 |
+
|
|
|
446ea3 |
return 1;
|
|
|
446ea3 |
}
|
|
|
446ea3 |
|
|
|
446ea3 |
@@ -2505,22 +2505,11 @@ static int event_source_online(
|
|
|
446ea3 |
s->ratelimited = ratelimited;
|
|
|
446ea3 |
|
|
|
446ea3 |
/* Non-failing operations below */
|
|
|
446ea3 |
- switch (s->type) {
|
|
|
446ea3 |
- case SOURCE_TIME_REALTIME:
|
|
|
446ea3 |
- case SOURCE_TIME_BOOTTIME:
|
|
|
446ea3 |
- case SOURCE_TIME_MONOTONIC:
|
|
|
446ea3 |
- case SOURCE_TIME_REALTIME_ALARM:
|
|
|
446ea3 |
- case SOURCE_TIME_BOOTTIME_ALARM:
|
|
|
446ea3 |
- event_source_time_prioq_reshuffle(s);
|
|
|
446ea3 |
- break;
|
|
|
446ea3 |
-
|
|
|
446ea3 |
- case SOURCE_EXIT:
|
|
|
446ea3 |
+ if (s->type == SOURCE_EXIT)
|
|
|
446ea3 |
prioq_reshuffle(s->event->exit, s, &s->exit.prioq_index);
|
|
|
446ea3 |
- break;
|
|
|
446ea3 |
|
|
|
446ea3 |
- default:
|
|
|
446ea3 |
- break;
|
|
|
446ea3 |
- }
|
|
|
446ea3 |
+ /* Always reshuffle time prioq, as the ratelimited flag may be changed. */
|
|
|
446ea3 |
+ event_source_time_prioq_reshuffle(s);
|
|
|
446ea3 |
|
|
|
446ea3 |
return 1;
|
|
|
446ea3 |
}
|