basebuilder_pel7ppc64lebuilder0
3 years ago
7 changed files with 398 additions and 18 deletions
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
From c7324938cb6df93ac5da7d6dd281be8d1986d6f1 Mon Sep 17 00:00:00 2001 |
||||
From: Michal Sekletar <msekleta@redhat.com> |
||||
Date: Fri, 24 Jul 2020 17:40:47 +0200 |
||||
Subject: [PATCH] device: make sure we emit PropertiesChanged signal once we |
||||
set sysfs |
||||
|
||||
(cherry-picked from commit 7c4d139485139eae95b17a1d54cb51ae958abd70) |
||||
|
||||
Related: #1793527 |
||||
--- |
||||
src/core/device.c | 1 + |
||||
1 file changed, 1 insertion(+) |
||||
|
||||
diff --git a/src/core/device.c b/src/core/device.c |
||||
index 2afa19f2b4..23c8ee356f 100644 |
||||
--- a/src/core/device.c |
||||
+++ b/src/core/device.c |
||||
@@ -97,6 +97,7 @@ static int device_set_sysfs(Device *d, const char *sysfs) { |
||||
} |
||||
|
||||
d->sysfs = copy; |
||||
+ unit_add_to_dbus_queue(UNIT(d)); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
From 47f260a680046d3f9244fffa1ea978041811bf6a Mon Sep 17 00:00:00 2001 |
||||
From: Michal Sekletar <msekleta@redhat.com> |
||||
Date: Fri, 24 Jul 2020 17:45:48 +0200 |
||||
Subject: [PATCH] device: don't emit PropetiesChanged needlessly |
||||
MIME-Version: 1.0 |
||||
Content-Type: text/plain; charset=UTF-8 |
||||
Content-Transfer-Encoding: 8bit |
||||
|
||||
Functions called from device_setup_unit() already make sure that unit is |
||||
enqueued in case it is a new unit or properties exported on the bus have |
||||
changed. |
||||
|
||||
This should prevent unnecessary DBus wakeups and associated DBus traffic |
||||
when device_setup_unit() was called while reparsing /proc/self/mountinfo |
||||
due to the mountinfo notifications. Note that we parse |
||||
/proc/self/mountinfo quite often on the busy systems (e.g. k8s container |
||||
hosts) but majority of the time mounts didn't change, only some mount |
||||
got added. Thus we don't need to generate PropertiesChanged for devices |
||||
associated with the mounts that didn't change. |
||||
|
||||
Thanks to Renaud Métrich <rmetrich@redhat.com> for debugging the |
||||
problem and providing draft version of the patch. |
||||
|
||||
(cherry-picked from commit 2e129d5d6bd6bd8be4b5359e81a880cbf72a44b8) |
||||
|
||||
Resolves: #1793527 |
||||
--- |
||||
src/core/device.c | 4 ---- |
||||
1 file changed, 4 deletions(-) |
||||
|
||||
diff --git a/src/core/device.c b/src/core/device.c |
||||
index 23c8ee356f..112b28e21f 100644 |
||||
--- a/src/core/device.c |
||||
+++ b/src/core/device.c |
||||
@@ -362,10 +362,6 @@ static int device_setup_unit(Manager *m, struct udev_device *dev, const char *pa |
||||
if (main) |
||||
(void) device_add_udev_wants(u, dev); |
||||
|
||||
- /* Note that this won't dispatch the load queue, the caller |
||||
- * has to do that if needed and appropriate */ |
||||
- |
||||
- unit_add_to_dbus_queue(u); |
||||
return 0; |
||||
|
||||
fail: |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
From 74854679448851e04ee8f6f10cf7908e3273e989 Mon Sep 17 00:00:00 2001 |
||||
From: Michal Sekletar <msekleta@redhat.com> |
||||
Date: Thu, 15 Oct 2020 16:48:39 +0200 |
||||
Subject: [PATCH] core: don't update unit description if it is already set to |
||||
the same value |
||||
|
||||
This is a followup for 47f260a680046d3f9244fffa1ea978041811bf6a as that |
||||
actually relies on such behavior of unit_set_description(). |
||||
|
||||
RHEL-only |
||||
|
||||
Related: #1793527 |
||||
--- |
||||
src/core/unit.c | 3 +++ |
||||
1 file changed, 3 insertions(+) |
||||
|
||||
diff --git a/src/core/unit.c b/src/core/unit.c |
||||
index d953780a52..18b1b898fd 100644 |
||||
--- a/src/core/unit.c |
||||
+++ b/src/core/unit.c |
||||
@@ -273,6 +273,9 @@ int unit_set_description(Unit *u, const char *description) { |
||||
if (isempty(description)) |
||||
s = NULL; |
||||
else { |
||||
+ if (streq_ptr(u->description, description)) |
||||
+ return 0; |
||||
+ |
||||
s = strdup(description); |
||||
if (!s) |
||||
return -ENOMEM; |
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
From 71c1119e2fe9bc57e0efb07f784f616a98763028 Mon Sep 17 00:00:00 2001 |
||||
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com> |
||||
Date: Fri, 2 Oct 2020 17:30:35 +0200 |
||||
Subject: [PATCH] unit: don't emit PropertiesChanged signal if adding a |
||||
dependency to a unit is a no-op |
||||
|
||||
(cherry-picked from commit 5177cb0a9add4ae568cff6e6f7c2b3c77760c343) |
||||
|
||||
Related: #1793527 |
||||
--- |
||||
src/core/unit.c | 16 +++++++++++++--- |
||||
1 file changed, 13 insertions(+), 3 deletions(-) |
||||
|
||||
diff --git a/src/core/unit.c b/src/core/unit.c |
||||
index 18b1b898fd..e07c34bfc5 100644 |
||||
--- a/src/core/unit.c |
||||
+++ b/src/core/unit.c |
||||
@@ -2260,6 +2260,9 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen |
||||
}; |
||||
int r, q = 0, v = 0, w = 0; |
||||
Unit *orig_u = u, *orig_other = other; |
||||
+ /* Helper to know whether sending a notification is necessary or not: |
||||
+ * if the dependency is already there, no need to notify! */ |
||||
+ bool noop = true; |
||||
|
||||
assert(u); |
||||
assert(d >= 0 && d < _UNIT_DEPENDENCY_MAX); |
||||
@@ -2298,13 +2301,16 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen |
||||
q = set_put(u->dependencies[d], other); |
||||
if (q < 0) |
||||
return q; |
||||
+ else if (q > 0) |
||||
+ noop = false; |
||||
|
||||
if (inverse_table[d] != _UNIT_DEPENDENCY_INVALID && inverse_table[d] != d) { |
||||
v = set_put(other->dependencies[inverse_table[d]], u); |
||||
if (v < 0) { |
||||
r = v; |
||||
goto fail; |
||||
- } |
||||
+ } else if (v > 0) |
||||
+ noop = false; |
||||
} |
||||
|
||||
if (add_reference) { |
||||
@@ -2312,14 +2318,18 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen |
||||
if (w < 0) { |
||||
r = w; |
||||
goto fail; |
||||
- } |
||||
+ } else if (w > 0) |
||||
+ noop = false; |
||||
|
||||
r = set_put(other->dependencies[UNIT_REFERENCED_BY], u); |
||||
if (r < 0) |
||||
goto fail; |
||||
+ else if (r > 0) |
||||
+ noop = false; |
||||
} |
||||
|
||||
- unit_add_to_dbus_queue(u); |
||||
+ if (!noop) |
||||
+ unit_add_to_dbus_queue(u); |
||||
return 0; |
||||
|
||||
fail: |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
From aa4bc7e743c74afaeac4dd7d84afe734065bd366 Mon Sep 17 00:00:00 2001 |
||||
From: Wen Yang <wenyang@linux.alibaba.com> |
||||
Date: Thu, 18 Jun 2020 22:36:22 +0800 |
||||
Subject: [PATCH] core: fix unnecessary fallback to the rescue mode caused by |
||||
initrd-switch-root.service's exit status judgment error |
||||
|
||||
commit 1f0958f640b8 ("core: when determining whether a process exit |
||||
status is clean, consider whether it is a command or a daemon") |
||||
introduces a side effect that causes system falls into rescure mode |
||||
due initrd-switch-root.service entered failed state, detailed |
||||
information should refer to the redhat's doc, as follows: |
||||
https://access.redhat.com/solutions/4973191 |
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1414904 |
||||
|
||||
As we know that in the cloud computing scenarios, some very critical |
||||
services may run on the server, and the server may run continuously for |
||||
several years without restarting.The initramfske may still maintain the |
||||
original state many years ago without any changes. In addition, this |
||||
server may have been installed a lot of user mode programs and kernel |
||||
mode drivers due to various operations and maintenance over the years. |
||||
|
||||
If the initramfs is regenerated because of upgrading systemd, the user-mode |
||||
programs or drivers previously installed may be inserted into the initramfs, |
||||
introducing unknown risks, and may even cause the system to fail to start. |
||||
So we hope that this patch may avoid the above issues. |
||||
|
||||
Resolves: #1825232 |
||||
(cherry picked from commit ec8955ee3842b81d790cf5fa949844bf63a93b7c) |
||||
--- |
||||
src/core/service.c | 9 +++++++++ |
||||
src/shared/special.h | 1 + |
||||
2 files changed, 10 insertions(+) |
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c |
||||
index 4c73b6ef96..d2d1dcb107 100644 |
||||
--- a/src/core/service.c |
||||
+++ b/src/core/service.c |
||||
@@ -2644,6 +2644,15 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { |
||||
else |
||||
assert_not_reached("Unknown code"); |
||||
|
||||
+ /* Here's a special hack: avoid a timing issue caused by switching |
||||
+ * root when the initramfs contains an old systemd binary. |
||||
+ * |
||||
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1855149 |
||||
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1825232 */ |
||||
+ if (f != SERVICE_SUCCESS && status == SIGTERM && |
||||
+ unit_has_name(UNIT(s), SPECIAL_INITRD_SWITCH_ROOT_SERVICE)) |
||||
+ f = SERVICE_SUCCESS; |
||||
+ |
||||
if (s->main_pid == pid) { |
||||
/* Forking services may occasionally move to a new PID. |
||||
* As long as they update the PID file before exiting the old |
||||
diff --git a/src/shared/special.h b/src/shared/special.h |
||||
index b045047d36..cf393879bf 100644 |
||||
--- a/src/shared/special.h |
||||
+++ b/src/shared/special.h |
||||
@@ -96,6 +96,7 @@ |
||||
#define SPECIAL_QUOTACHECK_SERVICE "systemd-quotacheck.service" |
||||
#define SPECIAL_QUOTAON_SERVICE "quotaon.service" |
||||
#define SPECIAL_REMOUNT_FS_SERVICE "systemd-remount-fs.service" |
||||
+#define SPECIAL_INITRD_SWITCH_ROOT_SERVICE "initrd-switch-root.service" |
||||
|
||||
/* Services systemd relies on */ |
||||
#define SPECIAL_DBUS_SERVICE "dbus.service" |
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
From b9914f359690e83303ee8a2ffa4d60cdf76f2a90 Mon Sep 17 00:00:00 2001 |
||||
From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com> |
||||
Date: Fri, 2 Nov 2018 20:56:08 +0100 |
||||
Subject: [PATCH] core: Detect initial timer state from serialized data |
||||
|
||||
We keep a mark whether a single-shot timer was triggered in the caller's |
||||
variable initial. When such a timer elapses while we are |
||||
serializing/deserializing the inner state, we consider the timer |
||||
incorrectly as elapsed and don't trigger it later. |
||||
|
||||
This patch exploits last_trigger timestamp that we already serialize, |
||||
hence we can eliminate the argument initial completely. |
||||
|
||||
A reproducer for OnBootSec= timers: |
||||
cat >repro.c <<EOD |
||||
/* |
||||
* Compile: gcc repro.c -o repro |
||||
* Run: ./repro |
||||
*/ |
||||
#include <errno.h> |
||||
#include <fcntl.h> |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <sys/stat.h> |
||||
#include <sys/types.h> |
||||
#include <time.h> |
||||
#include <unistd.h> |
||||
|
||||
int main(int argc, char *argv[]) { |
||||
char command[1024]; |
||||
int pause; |
||||
|
||||
struct timespec now; |
||||
|
||||
while (1) { |
||||
usleep(rand() % 200000); // prevent periodic repeats |
||||
clock_gettime(CLOCK_MONOTONIC, &now); |
||||
printf("%i\n", now.tv_sec); |
||||
|
||||
system("rm -f $PWD/mark"); |
||||
snprintf(command, 1024, "systemd-run --user --on-boot=%i --timer-property=AccuracySec=100ms " |
||||
"touch $PWD/mark", now.tv_sec + 1); |
||||
system(command); |
||||
system("systemctl --user list-timers"); |
||||
pause = (1000000000 - now.tv_nsec)/1000 - 70000; // fiddle to hit the middle of reloading |
||||
usleep(pause > 0 ? pause : 0); |
||||
system("systemctl --user daemon-reload"); |
||||
sync(); |
||||
sleep(2); |
||||
if (open("./mark", 0) < 0) |
||||
if (errno == ENOENT) { |
||||
printf("mark file does not exist\n"); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
EOD |
||||
|
||||
(cherry picked from commit aa1f95d2647197eca84c33a0f10adaeada08467d) |
||||
|
||||
Resolves: #1764908 |
||||
--- |
||||
src/core/timer.c | 16 ++++++++-------- |
||||
1 file changed, 8 insertions(+), 8 deletions(-) |
||||
|
||||
diff --git a/src/core/timer.c b/src/core/timer.c |
||||
index fb192d5..b36700c 100644 |
||||
--- a/src/core/timer.c |
||||
+++ b/src/core/timer.c |
||||
@@ -267,10 +267,10 @@ static void timer_set_state(Timer *t, TimerState state) { |
||||
unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], true); |
||||
} |
||||
|
||||
-static void timer_enter_waiting(Timer *t, bool initial); |
||||
+static void timer_enter_waiting(Timer *t); |
||||
|
||||
static int timer_enter_waiting_coldplug(Unit *u) { |
||||
- timer_enter_waiting(TIMER(u), false); |
||||
+ timer_enter_waiting(TIMER(u)); |
||||
return 0; |
||||
} |
||||
|
||||
@@ -338,7 +338,7 @@ static void add_random(Timer *t, usec_t *v) { |
||||
log_unit_debug(UNIT(t)->id, "Adding %s random time.", format_timespan(s, sizeof(s), add, 0)); |
||||
} |
||||
|
||||
-static void timer_enter_waiting(Timer *t, bool initial) { |
||||
+static void timer_enter_waiting(Timer *t) { |
||||
bool found_monotonic = false, found_realtime = false; |
||||
usec_t ts_realtime, ts_monotonic; |
||||
usec_t base = 0; |
||||
@@ -442,7 +442,7 @@ static void timer_enter_waiting(Timer *t, bool initial) { |
||||
|
||||
v->next_elapse = base + v->value; |
||||
|
||||
- if (!initial && v->next_elapse < ts_monotonic && IN_SET(v->base, TIMER_ACTIVE, TIMER_BOOT, TIMER_STARTUP)) { |
||||
+ if (dual_timestamp_is_set(&t->last_trigger) && v->next_elapse < ts_monotonic && IN_SET(v->base, TIMER_ACTIVE, TIMER_BOOT, TIMER_STARTUP)) { |
||||
/* This is a one time trigger, disable it now */ |
||||
v->disabled = true; |
||||
continue; |
||||
@@ -619,7 +619,7 @@ static int timer_start(Unit *u) { |
||||
} |
||||
|
||||
t->result = TIMER_SUCCESS; |
||||
- timer_enter_waiting(t, true); |
||||
+ timer_enter_waiting(t); |
||||
return 1; |
||||
} |
||||
|
||||
@@ -742,14 +742,14 @@ static void timer_trigger_notify(Unit *u, Unit *other) { |
||||
case TIMER_ELAPSED: |
||||
|
||||
/* Recalculate sleep time */ |
||||
- timer_enter_waiting(t, false); |
||||
+ timer_enter_waiting(t); |
||||
break; |
||||
|
||||
case TIMER_RUNNING: |
||||
|
||||
if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other))) { |
||||
log_unit_debug(UNIT(t)->id, "%s got notified about unit deactivation.", UNIT(t)->id); |
||||
- timer_enter_waiting(t, false); |
||||
+ timer_enter_waiting(t); |
||||
} |
||||
break; |
||||
|
||||
@@ -782,7 +782,7 @@ static void timer_time_change(Unit *u) { |
||||
return; |
||||
|
||||
log_unit_debug(u->id, "%s: time change, recalculating next elapse.", u->id); |
||||
- timer_enter_waiting(t, false); |
||||
+ timer_enter_waiting(t); |
||||
} |
||||
|
||||
static const char* const timer_state_table[_TIMER_STATE_MAX] = { |
||||
-- |
||||
2.26.2 |
||||
|
Loading…
Reference in new issue