forked from pool/systemd
Accepting request 163593 from home:fcrozat:branches:Base:System
- Add improve-readahead-spinning.patch: improve readahead performance on spinning media with ext4. - Add fix-journal-vacuum-logic.patch: fix vacuum logic in journal (bnc#789589). - Add fix-lsb-provides.patch: ensure LSB provides are correctly handled if also referenced as dependencies (bnc#809646). - Add fix-loopback-mount.patch: ensure udevd is started (and therefore static devices are created) before mounting (bnc#809820). - Update systemd-sysv-convert to search services files in new location (bnc#809695). - Add logind-nvidia-acl.diff: set ACL on nvidia devices (bnc#808319). - Add do-no-isolate-on-fsck-failure.patch: do not turn off services if fsck fails (bnc#812874) - Add wait-for-processes-killed.patch: wait for processes killed by SIGTERM before killing them with SIGKILL. - Update systemctl-options.patch to only apply SYSTEMCTL_OPTIONS to systemctl command (bnc#801878). OBS-URL: https://build.opensuse.org/request/show/163593 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=361
This commit is contained in:
parent
8c41c28b11
commit
e46422362e
87
do-no-isolate-on-fsck-failure.patch
Normal file
87
do-no-isolate-on-fsck-failure.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From 80cfe9e163b1c92f917e0a5e053b148fca790677 Mon Sep 17 00:00:00 2001
|
||||
From: "Dr. Tilmann Bubeck" <t.bubeck@reinform.de>
|
||||
Date: Fri, 4 May 2012 10:32:47 +0200
|
||||
Subject: [PATCH] Do no isolate in case of emergency or severe problems
|
||||
|
||||
This patch changes local-fs.target and systemd-fsck to not use
|
||||
"isolate" when going into emergency.
|
||||
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=810722
|
||||
|
||||
The motivation is, that when something wents wrong, we should
|
||||
keep everything as it is, to let the user fix the problem. When
|
||||
isolating we stop a lot of services and therefore change the
|
||||
system heavily so that it gets harder for the user to fix.
|
||||
|
||||
An example is a crypted partition. When the fsck in a crypted
|
||||
partition fails, it previously used "emergency/start/isolate"
|
||||
which stops cryptsetup. Therefore if the user tries to fsck
|
||||
e.g. /dev/mapper/luks-356c20ae-c7a2-4f1c-ae1d-1d290a91b691
|
||||
as printed by the failing fsck, then it will not find this
|
||||
device (because it got closed).
|
||||
|
||||
So please apply this patch to let the user see the failing
|
||||
situation.
|
||||
|
||||
Thanks!
|
||||
|
||||
[zj: removed dead isolate param from start_target().]
|
||||
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=49463
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=810722
|
||||
---
|
||||
src/fsck/fsck.c | 13 ++++---------
|
||||
units/local-fs.target | 2 +-
|
||||
2 files changed, 5 insertions(+), 10 deletions(-)
|
||||
|
||||
Index: systemd-195/src/fsck/fsck.c
|
||||
===================================================================
|
||||
--- systemd-195.orig/src/fsck/fsck.c
|
||||
+++ systemd-195/src/fsck/fsck.c
|
||||
@@ -40,10 +40,10 @@ static bool arg_skip = false;
|
||||
static bool arg_force = false;
|
||||
static bool arg_show_progress = false;
|
||||
|
||||
-static void start_target(const char *target, bool isolate) {
|
||||
+static void start_target(const char *target) {
|
||||
DBusMessage *m = NULL, *reply = NULL;
|
||||
DBusError error;
|
||||
- const char *mode, *basic_target = "basic.target";
|
||||
+ const char *mode = "replace", *basic_target = "basic.target";
|
||||
DBusConnection *bus = NULL;
|
||||
|
||||
assert(target);
|
||||
@@ -55,11 +55,6 @@ static void start_target(const char *tar
|
||||
goto finish;
|
||||
}
|
||||
|
||||
- if (isolate)
|
||||
- mode = "isolate";
|
||||
- else
|
||||
- mode = "replace";
|
||||
-
|
||||
log_info("Running request %s/start/%s", target, mode);
|
||||
|
||||
if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnitReplace"))) {
|
||||
@@ -379,10 +374,10 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (status.si_code == CLD_EXITED && (status.si_status & 2) && root_directory)
|
||||
/* System should be rebooted. */
|
||||
- start_target(SPECIAL_REBOOT_TARGET, false);
|
||||
+ start_target(SPECIAL_REBOOT_TARGET);
|
||||
else if (status.si_code == CLD_EXITED && (status.si_status & 6))
|
||||
/* Some other problem */
|
||||
- start_target(SPECIAL_EMERGENCY_TARGET, true);
|
||||
+ start_target(SPECIAL_EMERGENCY_TARGET);
|
||||
else {
|
||||
r = EXIT_SUCCESS;
|
||||
log_warning("Ignoring error.");
|
||||
Index: systemd-195/units/local-fs.target
|
||||
===================================================================
|
||||
--- systemd-195.orig/units/local-fs.target
|
||||
+++ systemd-195/units/local-fs.target
|
||||
@@ -9,4 +9,4 @@
|
||||
Description=Local File Systems
|
||||
Documentation=man:systemd.special(7)
|
||||
OnFailure=emergency.target
|
||||
-OnFailureIsolate=yes
|
||||
+OnFailureIsolate=no
|
40
fix-journal-vacuum-logic.patch
Normal file
40
fix-journal-vacuum-logic.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 6c142648aaced56ab681fcc97a71b06d588122a9 Mon Sep 17 00:00:00 2001
|
||||
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
|
||||
Date: Wed, 20 Mar 2013 21:32:05 +0100
|
||||
Subject: [PATCH] Fix vacuum logic error
|
||||
|
||||
The vacuum code used to stop vacuuming after one deletion, even
|
||||
when max_use was still exceeded.
|
||||
|
||||
Also make usage a uint64_t, as the code already pretends it is one.
|
||||
|
||||
Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
|
||||
---
|
||||
src/journal/journal-vacuum.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
|
||||
index 731f6c7..4a3a5a9 100644
|
||||
--- a/src/journal/journal-vacuum.c
|
||||
+++ b/src/journal/journal-vacuum.c
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "util.h"
|
||||
|
||||
struct vacuum_info {
|
||||
- off_t usage;
|
||||
+ uint64_t usage;
|
||||
char *filename;
|
||||
|
||||
uint64_t realtime;
|
||||
@@ -293,7 +293,7 @@ int journal_directory_vacuum(
|
||||
if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
|
||||
log_debug("Deleted archived journal %s/%s.", directory, list[i].filename);
|
||||
|
||||
- if ((uint64_t) list[i].usage > sum)
|
||||
+ if (list[i].usage < sum)
|
||||
sum -= list[i].usage;
|
||||
else
|
||||
sum = 0;
|
||||
--
|
||||
1.8.1.4
|
||||
|
10
fix-loopback-mount.patch
Normal file
10
fix-loopback-mount.patch
Normal file
@ -0,0 +1,10 @@
|
||||
Index: systemd-195/units/local-fs-pre.target
|
||||
===================================================================
|
||||
--- systemd-195.orig/units/local-fs-pre.target
|
||||
+++ systemd-195/units/local-fs-pre.target
|
||||
@@ -8,4 +8,4 @@
|
||||
[Unit]
|
||||
Description=Local File Systems (Pre)
|
||||
Documentation=man:systemd.special(7)
|
||||
-After=md.service lvm.service dmraid.service
|
||||
+After=md.service lvm.service dmraid.service systemd-udevd.service
|
43
fix-lsb-provides.patch
Normal file
43
fix-lsb-provides.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From a99435109b83e7146a30ccf5387037b51c1fe907 Mon Sep 17 00:00:00 2001
|
||||
From: Frederic Crozat <fcrozat@suse.com>
|
||||
Date: Thu, 21 Mar 2013 15:40:45 +0100
|
||||
Subject: [PATCH] core: ensure LSB Provides are handled correctly
|
||||
|
||||
Let's say you have two initscripts, A and B:
|
||||
|
||||
A contains in its LSB header:
|
||||
Required-Start: C
|
||||
|
||||
and B contains in its LSB header:
|
||||
Provides: C
|
||||
|
||||
When systemd is parsing /etc/rc.d/, depending on the file order, you
|
||||
can end up with either:
|
||||
- B is parsed first. An unit "C.service" will be "created" and will be
|
||||
added as additional name to B.service, with unit_add_name. No bug.
|
||||
- A is parsed first. An unit "C.service" is created for the
|
||||
"Required-Start" dependency (it will have no file attached, since
|
||||
nothing provides this dependency yet). Then B is parsed and when trying
|
||||
to handle "Provides: C", unit_add_name is called but will fail, because
|
||||
"C.service" already exists in manager->units. Therefore, a merge should
|
||||
occur for that case.
|
||||
---
|
||||
src/core/service.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 4451d38..fa8a1cb 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -762,7 +762,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
|
||||
continue;
|
||||
|
||||
if (unit_name_to_type(m) == UNIT_SERVICE)
|
||||
- r = unit_add_name(u, m);
|
||||
+ r = unit_merge_by_name(u, m);
|
||||
else
|
||||
/* NB: SysV targets
|
||||
* which are provided
|
||||
--
|
||||
1.8.1.4
|
||||
|
221
improve-readahead-spinning.patch
Normal file
221
improve-readahead-spinning.patch
Normal file
@ -0,0 +1,221 @@
|
||||
From 94243ef299425d6c7089a7a05c48c9bb8f6cf3da Mon Sep 17 00:00:00 2001
|
||||
From: Auke Kok <auke-jan.h.kok@intel.com>
|
||||
Date: Fri, 22 Mar 2013 15:09:45 -0700
|
||||
Subject: [PATCH 1/2] readahead: chunk on spinning media
|
||||
|
||||
Readahead has all sorts of bad side effects depending on your
|
||||
storage media. On rotating disks, it may be degrading startup
|
||||
performance if enough requests are queued spanning linearly
|
||||
over all blocks early at boot, and mount, blkid and friends
|
||||
want to insert reads to the start of these block devices after.
|
||||
|
||||
The end result is that on spinning disks with ext3/4 that udev
|
||||
and mounts take a very long time, and nothing really happens until
|
||||
readahead is completely finished.
|
||||
|
||||
This has the net effect that the CPU is almost entirely idle
|
||||
for the entire period that readahead is working. We could have
|
||||
finished starting up quite a lot of services in this time if
|
||||
we were smarter at how we do readahead.
|
||||
|
||||
This patch sorts all requests into 2 second "chunks" and sub-sorts
|
||||
each chunk by block. This adds a single cross-drive seek per "chunk"
|
||||
but has the benefit that we will have a lot of the blocks we need
|
||||
early on in the boot sequence loaded into memory faster.
|
||||
|
||||
For a comparison of how before/after bootcharts look (ext4 on a
|
||||
mobile 5400rpm 250GB drive) please look at:
|
||||
|
||||
http://foo-projects.org/~sofar/blocked-tests/
|
||||
|
||||
There are bootcharts in the "before" and "after" folders where you
|
||||
should be able to see that many low-level services finish 5-7
|
||||
seconds earlier with the patch applied (after).
|
||||
---
|
||||
Makefile.am | 2 +-
|
||||
src/readahead/readahead-collect.c | 28 +++++++++++++++++++++++++---
|
||||
2 files changed, 26 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 37c1cc2..5861976 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -2956,7 +2956,7 @@ systemd_readahead_SOURCES = \
|
||||
systemd_readahead_LDADD = \
|
||||
libsystemd-shared.la \
|
||||
libsystemd-daemon.la \
|
||||
- libudev.la
|
||||
+ libudev.la -lm
|
||||
|
||||
dist_doc_DATA += \
|
||||
src/readahead/sd-readahead.c \
|
||||
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
|
||||
index 5d07f47..5d22949 100644
|
||||
--- a/src/readahead/readahead-collect.c
|
||||
+++ b/src/readahead/readahead-collect.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <sys/vfs.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/inotify.h>
|
||||
+#include <math.h>
|
||||
|
||||
#ifdef HAVE_FANOTIFY_INIT
|
||||
#include <sys/fanotify.h>
|
||||
@@ -67,6 +68,7 @@
|
||||
*/
|
||||
|
||||
static ReadaheadShared *shared = NULL;
|
||||
+static struct timespec starttime;
|
||||
|
||||
/* Avoid collisions with the NULL pointer */
|
||||
#define SECTOR_TO_PTR(s) ULONG_TO_PTR((s)+1)
|
||||
@@ -205,6 +207,7 @@ static unsigned long fd_first_block(int fd) {
|
||||
struct item {
|
||||
const char *path;
|
||||
unsigned long block;
|
||||
+ unsigned long bin;
|
||||
};
|
||||
|
||||
static int qsort_compare(const void *a, const void *b) {
|
||||
@@ -213,6 +216,13 @@ static int qsort_compare(const void *a, const void *b) {
|
||||
i = a;
|
||||
j = b;
|
||||
|
||||
+ /* sort by bin first */
|
||||
+ if (i->bin < j->bin)
|
||||
+ return -1;
|
||||
+ if (i->bin > j->bin)
|
||||
+ return 1;
|
||||
+
|
||||
+ /* then sort by sector */
|
||||
if (i->block < j->block)
|
||||
return -1;
|
||||
if (i->block > j->block)
|
||||
@@ -250,6 +260,8 @@ static int collect(const char *root) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &starttime);
|
||||
+
|
||||
/* If there's no pack file yet we lower the kernel readahead
|
||||
* so that mincore() is accurate. If there is a pack file
|
||||
* already we assume it is accurate enough so that kernel
|
||||
@@ -447,10 +459,21 @@ static int collect(const char *root) {
|
||||
free(p);
|
||||
else {
|
||||
unsigned long ul;
|
||||
+ struct timespec ts;
|
||||
+ struct item *entry;
|
||||
+
|
||||
+ entry = new0(struct item, 1);
|
||||
|
||||
ul = fd_first_block(m->fd);
|
||||
|
||||
- if ((k = hashmap_put(files, p, SECTOR_TO_PTR(ul))) < 0) {
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
+
|
||||
+ entry->block = ul;
|
||||
+ entry->path = strdup(p);
|
||||
+ entry->bin = round((ts.tv_sec - starttime.tv_sec +
|
||||
+ ((ts.tv_nsec - starttime.tv_nsec) / 1000000000.0)) / 2.0);
|
||||
+
|
||||
+ if ((k = hashmap_put(files, p, entry)) < 0) {
|
||||
log_warning("set_put() failed: %s", strerror(-k));
|
||||
free(p);
|
||||
}
|
||||
@@ -518,8 +541,7 @@ done:
|
||||
|
||||
j = ordered;
|
||||
HASHMAP_FOREACH_KEY(q, p, files, i) {
|
||||
- j->path = p;
|
||||
- j->block = PTR_TO_SECTOR(q);
|
||||
+ memcpy(j, q, sizeof(struct item));
|
||||
j++;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.1.4
|
||||
|
||||
|
||||
From b0640287f784a320661f7206c9ade07b99003fd5 Mon Sep 17 00:00:00 2001
|
||||
From: Auke Kok <auke-jan.h.kok@intel.com>
|
||||
Date: Tue, 26 Mar 2013 11:13:47 -0700
|
||||
Subject: [PATCH 2/2] readahead: cleanups
|
||||
|
||||
- check for OOM
|
||||
- no need to use floats and round()
|
||||
---
|
||||
Makefile.am | 2 +-
|
||||
src/readahead/readahead-collect.c | 20 ++++++++++++++------
|
||||
2 files changed, 15 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 5861976..37c1cc2 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -2956,7 +2956,7 @@ systemd_readahead_SOURCES = \
|
||||
systemd_readahead_LDADD = \
|
||||
libsystemd-shared.la \
|
||||
libsystemd-daemon.la \
|
||||
- libudev.la -lm
|
||||
+ libudev.la
|
||||
|
||||
dist_doc_DATA += \
|
||||
src/readahead/sd-readahead.c \
|
||||
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
|
||||
index 5d22949..e2fd8df 100644
|
||||
--- a/src/readahead/readahead-collect.c
|
||||
+++ b/src/readahead/readahead-collect.c
|
||||
@@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
static ReadaheadShared *shared = NULL;
|
||||
-static struct timespec starttime;
|
||||
+static usec_t starttime;
|
||||
|
||||
/* Avoid collisions with the NULL pointer */
|
||||
#define SECTOR_TO_PTR(s) ULONG_TO_PTR((s)+1)
|
||||
@@ -260,7 +260,7 @@ static int collect(const char *root) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
- clock_gettime(CLOCK_MONOTONIC, &starttime);
|
||||
+ starttime = now(CLOCK_MONOTONIC);
|
||||
|
||||
/* If there's no pack file yet we lower the kernel readahead
|
||||
* so that mincore() is accurate. If there is a pack file
|
||||
@@ -459,19 +459,27 @@ static int collect(const char *root) {
|
||||
free(p);
|
||||
else {
|
||||
unsigned long ul;
|
||||
- struct timespec ts;
|
||||
+ usec_t entrytime;
|
||||
struct item *entry;
|
||||
|
||||
entry = new0(struct item, 1);
|
||||
+ if (!entry) {
|
||||
+ r = log_oom();
|
||||
+ goto finish;
|
||||
+ }
|
||||
|
||||
ul = fd_first_block(m->fd);
|
||||
|
||||
- clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
+ entrytime = now(CLOCK_MONOTONIC);
|
||||
|
||||
entry->block = ul;
|
||||
entry->path = strdup(p);
|
||||
- entry->bin = round((ts.tv_sec - starttime.tv_sec +
|
||||
- ((ts.tv_nsec - starttime.tv_nsec) / 1000000000.0)) / 2.0);
|
||||
+ if (!entry->path) {
|
||||
+ free(entry);
|
||||
+ r = log_oom();
|
||||
+ goto finish;
|
||||
+ }
|
||||
+ entry->bin = (entrytime - starttime) / 2000000;
|
||||
|
||||
if ((k = hashmap_put(files, p, entry)) < 0) {
|
||||
log_warning("set_put() failed: %s", strerror(-k));
|
||||
--
|
||||
1.8.1.4
|
||||
|
14
logind-nvidia-acl.diff
Normal file
14
logind-nvidia-acl.diff
Normal file
@ -0,0 +1,14 @@
|
||||
Index: systemd-195/src/login/logind-acl.c
|
||||
===================================================================
|
||||
--- systemd-195.orig/src/login/logind-acl.c
|
||||
+++ systemd-195/src/login/logind-acl.c
|
||||
@@ -240,6 +240,9 @@ int devnode_acl_all(struct udev *udev,
|
||||
goto finish;
|
||||
}
|
||||
|
||||
+ devnode_acl("/dev/nvidia0", flush, del, old_uid, add, new_uid);
|
||||
+ devnode_acl("/dev/nvidiactl", flush, del, old_uid, add, new_uid);
|
||||
+
|
||||
finish:
|
||||
if (e)
|
||||
udev_enumerate_unref(e);
|
@ -2,17 +2,14 @@ Index: systemd-195/src/systemctl/systemctl.c
|
||||
===================================================================
|
||||
--- systemd-195.orig/src/systemctl/systemctl.c
|
||||
+++ systemd-195/src/systemctl/systemctl.c
|
||||
@@ -5239,6 +5239,7 @@ static int runlevel_main(void) {
|
||||
@@ -4118,10 +4118,32 @@ static int systemctl_parse_argv(int argc
|
||||
};
|
||||
|
||||
int main(int argc, char*argv[]) {
|
||||
int r, retval = EXIT_FAILURE;
|
||||
int c;
|
||||
+ char **to_free = NULL;
|
||||
DBusConnection *bus = NULL;
|
||||
DBusError error;
|
||||
|
||||
@@ -5247,6 +5248,27 @@ int main(int argc, char*argv[]) {
|
||||
log_parse_environment();
|
||||
log_open();
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
|
||||
+ if (secure_getenv("SYSTEMCTL_OPTIONS")) {
|
||||
+ char **parsed_systemctl_options = strv_split_quoted(getenv("SYSTEMCTL_OPTIONS"));
|
||||
@ -35,15 +32,15 @@ Index: systemd-195/src/systemctl/systemctl.c
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
r = parse_argv(argc, argv);
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
@@ -5348,6 +5370,8 @@ finish:
|
||||
while ((c = getopt_long(argc, argv, "ht:p:aqfs:H:Pn:o:", options, NULL)) >= 0) {
|
||||
|
||||
strv_free(arg_property);
|
||||
switch (c) {
|
||||
@@ -4297,6 +4319,8 @@ static int systemctl_parse_argv(int argc
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ strv_free(to_free);
|
||||
+
|
||||
pager_close();
|
||||
ask_password_agent_close();
|
||||
polkit_agent_close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,26 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 8 14:51:47 CEST 2013 - fcrozat@suse.com
|
||||
|
||||
- Add improve-readahead-spinning.patch: improve readahead
|
||||
performance on spinning media with ext4.
|
||||
- Add fix-journal-vacuum-logic.patch: fix vacuum logic in journal
|
||||
(bnc#789589).
|
||||
- Add fix-lsb-provides.patch: ensure LSB provides are correctly
|
||||
handled if also referenced as dependencies (bnc#809646).
|
||||
- Add fix-loopback-mount.patch: ensure udevd is started (and
|
||||
therefore static devices are created) before mounting
|
||||
(bnc#809820).
|
||||
- Update systemd-sysv-convert to search services files in new
|
||||
location (bnc#809695).
|
||||
- Add logind-nvidia-acl.diff: set ACL on nvidia devices
|
||||
(bnc#808319).
|
||||
- Add do-no-isolate-on-fsck-failure.patch: do not turn off services
|
||||
if fsck fails (bnc#812874)
|
||||
- Add wait-for-processes-killed.patch: wait for processes killed by
|
||||
SIGTERM before killing them with SIGKILL.
|
||||
- Update systemctl-options.patch to only apply SYSTEMCTL_OPTIONS to
|
||||
systemctl command (bnc#801878).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 2 22:09:42 CEST 2013 - sbrabec@suse.cz
|
||||
|
||||
|
@ -140,6 +140,12 @@ Patch72: handle-root-uses-lang.patch
|
||||
Patch76: multiple-sulogin.patch
|
||||
# PATCH-FIX-OPENSUSE systemctl-options.patch bnc#798620 fcrozat@suse.com -- handle SYSTEMCTL_OPTIONS environment variable
|
||||
Patch77: systemctl-options.patch
|
||||
# PATCH-FIX-UPSTREAM fix-loopback-mount.patch bnc#809820 fcrozat@suse.com -- loopback mount should be started after /dev/loop-control is available
|
||||
Patch136: fix-loopback-mount.patch
|
||||
# PATCH-FIX-UPSTREAM fix-lsb-provides.patch bnc#809646 fcrozat@suse.com -- fix LSB provides
|
||||
Patch137: fix-lsb-provides.patch
|
||||
# PATCH-FIX-OPENSUSE logind-nvidia-acl.diff bnc#808319 -- set ACL on nvidia devices
|
||||
Patch140: logind-nvidia-acl.diff
|
||||
|
||||
# Upstream First - Policy:
|
||||
# Never add any patches to this package without the upstream commit id
|
||||
@ -283,6 +289,14 @@ Patch133: support-hybrid-suspend.patch
|
||||
Patch134: forward-to-pmutils.patch
|
||||
# PATCH-FIX-UPSTREAM rbind-mount.patch fcrozat@suse.com bnc#804575 -- Handle rbind mount point correctly
|
||||
Patch135: rbind-mount.patch
|
||||
# PATCH-FIX-UPSTREAM fix-journal-vacuum-logic.patch bnc#789589 -- fix journal vacuum logic
|
||||
Patch138: fix-journal-vacuum-logic.patch
|
||||
# PATCH-FIX-UPSTREAM improve-readahead-spinning.patch -- improve readahead on spinning disk
|
||||
Patch139: improve-readahead-spinning.patch
|
||||
# PATCH-FIX-UPSTREAM wait-for-processes-killed.patch -- wait for processes killed by SIGTERM before killing them with SIGKILL
|
||||
Patch141: wait-for-processes-killed.patch
|
||||
# PATCH-FIX-UPSTREAM do-no-isolate-on-fsck-failure.patch bnc#812874 -- do not isolate if fsck fails
|
||||
Patch142: do-no-isolate-on-fsck-failure.patch
|
||||
|
||||
# udev patches
|
||||
# PATCH-FIX-OPENSUSE 1001-Reinstate-TIMEOUT-handling.patch
|
||||
@ -625,6 +639,13 @@ cp %{SOURCE7} m4/
|
||||
%patch133 -p1
|
||||
%patch134 -p1
|
||||
%patch135 -p1
|
||||
%patch136 -p1
|
||||
%patch137 -p1
|
||||
%patch138 -p1
|
||||
%patch139 -p1
|
||||
%patch140 -p1
|
||||
%patch141 -p1
|
||||
%patch142 -p1
|
||||
|
||||
%build
|
||||
autoreconf -fiv
|
||||
|
@ -18,7 +18,7 @@ EOF
|
||||
help() {
|
||||
usage
|
||||
cat << EOF
|
||||
Save and Restore SusV Service Runlevel Information
|
||||
Save and Restore SysV Service Runlevel Information
|
||||
|
||||
positional arguments:
|
||||
SERVICE Service names
|
||||
@ -62,6 +62,7 @@ fi
|
||||
lookup_database() {
|
||||
local services
|
||||
local service
|
||||
local service_file
|
||||
local runlevel
|
||||
local priority
|
||||
local -i k
|
||||
@ -147,22 +148,25 @@ case "$1" in
|
||||
shift
|
||||
services=$@
|
||||
for service in $services; do
|
||||
if [ ! -f "/lib/systemd/system/$service.service" ]; then
|
||||
if [ ! -f "/lib/systemd/system/$service.service" -a ! -f "/usr/lib/systemd/system/$service.service" ]; then
|
||||
echo systemd service $service.service does not exist. >/dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
lookup_database $services
|
||||
for service in $services; do
|
||||
[ -f "/lib/systemd/system/$service.service" ] && service_file="/lib/systemd/system/$service.service"
|
||||
[ -f "/usr/lib/systemd/system/$service.service" ] && service_file="/usr/lib/systemd/system/$service.service"
|
||||
|
||||
if [ -z "${results_runlevel[$service]}" ]; then
|
||||
echo No information found about service $service found. >/dev/stderr
|
||||
fail=1
|
||||
continue
|
||||
fi
|
||||
for runlevel in ${results_runlevel[$service]}; do
|
||||
echo ln -sf /lib/systemd/system/$service.service /etc/systemd/system/runlevel$runlevel.target.wants/$service.service >/dev/stderr
|
||||
echo ln -sf $service_file /etc/systemd/system/runlevel$runlevel.target.wants/$service.service >/dev/stderr
|
||||
mkdir -p "/etc/systemd/system/runlevel$runlevel.target.wants"
|
||||
/bin/ln -sf /lib/systemd/system/$service.service /etc/systemd/system/runlevel$runlevel.target.wants/$service.service
|
||||
/bin/ln -sf $service_file /etc/systemd/system/runlevel$runlevel.target.wants/$service.service
|
||||
done
|
||||
|
||||
done
|
||||
|
@ -1,3 +1,26 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 8 14:51:47 CEST 2013 - fcrozat@suse.com
|
||||
|
||||
- Add improve-readahead-spinning.patch: improve readahead
|
||||
performance on spinning media with ext4.
|
||||
- Add fix-journal-vacuum-logic.patch: fix vacuum logic in journal
|
||||
(bnc#789589).
|
||||
- Add fix-lsb-provides.patch: ensure LSB provides are correctly
|
||||
handled if also referenced as dependencies (bnc#809646).
|
||||
- Add fix-loopback-mount.patch: ensure udevd is started (and
|
||||
therefore static devices are created) before mounting
|
||||
(bnc#809820).
|
||||
- Update systemd-sysv-convert to search services files in new
|
||||
location (bnc#809695).
|
||||
- Add logind-nvidia-acl.diff: set ACL on nvidia devices
|
||||
(bnc#808319).
|
||||
- Add do-no-isolate-on-fsck-failure.patch: do not turn off services
|
||||
if fsck fails (bnc#812874)
|
||||
- Add wait-for-processes-killed.patch: wait for processes killed by
|
||||
SIGTERM before killing them with SIGKILL.
|
||||
- Update systemctl-options.patch to only apply SYSTEMCTL_OPTIONS to
|
||||
systemctl command (bnc#801878).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 2 22:09:42 CEST 2013 - sbrabec@suse.cz
|
||||
|
||||
|
21
systemd.spec
21
systemd.spec
@ -135,6 +135,12 @@ Patch72: handle-root-uses-lang.patch
|
||||
Patch76: multiple-sulogin.patch
|
||||
# PATCH-FIX-OPENSUSE systemctl-options.patch bnc#798620 fcrozat@suse.com -- handle SYSTEMCTL_OPTIONS environment variable
|
||||
Patch77: systemctl-options.patch
|
||||
# PATCH-FIX-UPSTREAM fix-loopback-mount.patch bnc#809820 fcrozat@suse.com -- loopback mount should be started after /dev/loop-control is available
|
||||
Patch136: fix-loopback-mount.patch
|
||||
# PATCH-FIX-UPSTREAM fix-lsb-provides.patch bnc#809646 fcrozat@suse.com -- fix LSB provides
|
||||
Patch137: fix-lsb-provides.patch
|
||||
# PATCH-FIX-OPENSUSE logind-nvidia-acl.diff bnc#808319 -- set ACL on nvidia devices
|
||||
Patch140: logind-nvidia-acl.diff
|
||||
|
||||
# Upstream First - Policy:
|
||||
# Never add any patches to this package without the upstream commit id
|
||||
@ -278,6 +284,14 @@ Patch133: support-hybrid-suspend.patch
|
||||
Patch134: forward-to-pmutils.patch
|
||||
# PATCH-FIX-UPSTREAM rbind-mount.patch fcrozat@suse.com bnc#804575 -- Handle rbind mount point correctly
|
||||
Patch135: rbind-mount.patch
|
||||
# PATCH-FIX-UPSTREAM fix-journal-vacuum-logic.patch bnc#789589 -- fix journal vacuum logic
|
||||
Patch138: fix-journal-vacuum-logic.patch
|
||||
# PATCH-FIX-UPSTREAM improve-readahead-spinning.patch -- improve readahead on spinning disk
|
||||
Patch139: improve-readahead-spinning.patch
|
||||
# PATCH-FIX-UPSTREAM wait-for-processes-killed.patch -- wait for processes killed by SIGTERM before killing them with SIGKILL
|
||||
Patch141: wait-for-processes-killed.patch
|
||||
# PATCH-FIX-UPSTREAM do-no-isolate-on-fsck-failure.patch bnc#812874 -- do not isolate if fsck fails
|
||||
Patch142: do-no-isolate-on-fsck-failure.patch
|
||||
|
||||
# udev patches
|
||||
# PATCH-FIX-OPENSUSE 1001-Reinstate-TIMEOUT-handling.patch
|
||||
@ -620,6 +634,13 @@ cp %{SOURCE7} m4/
|
||||
%patch133 -p1
|
||||
%patch134 -p1
|
||||
%patch135 -p1
|
||||
%patch136 -p1
|
||||
%patch137 -p1
|
||||
%patch138 -p1
|
||||
%patch139 -p1
|
||||
%patch140 -p1
|
||||
%patch141 -p1
|
||||
%patch142 -p1
|
||||
|
||||
%build
|
||||
autoreconf -fiv
|
||||
|
249
wait-for-processes-killed.patch
Normal file
249
wait-for-processes-killed.patch
Normal file
@ -0,0 +1,249 @@
|
||||
From df758e98754016119a9c8d49213a636a80ffab22 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Thu, 28 Mar 2013 23:00:32 +0100
|
||||
Subject: [PATCH] killall: print notice what we forcefully KILL
|
||||
|
||||
---
|
||||
src/core/killall.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/core/killall.c b/src/core/killall.c
|
||||
index 55200ff..1eb3766 100644
|
||||
--- a/src/core/killall.c
|
||||
+++ b/src/core/killall.c
|
||||
@@ -139,6 +139,13 @@ static int killall(int sig) {
|
||||
if (ignore_proc(pid))
|
||||
continue;
|
||||
|
||||
+ if (sig == SIGKILL) {
|
||||
+ _cleanup_free_ char *s;
|
||||
+
|
||||
+ get_process_comm(pid, &s);
|
||||
+ log_notice("Sending SIGKILL to PID %lu (%s)", (unsigned long) pid, strna(s));
|
||||
+ }
|
||||
+
|
||||
if (kill(pid, sig) >= 0)
|
||||
n_processes++;
|
||||
else if (errno != ENOENT)
|
||||
--
|
||||
1.8.1.4
|
||||
|
||||
From aaf7eb81be912e7bed939f31e3bc4c631b2552b3 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Mon, 1 Apr 2013 22:48:40 +0200
|
||||
Subject: [PATCH] shutdown: correctly wait for processes we killed in the
|
||||
killall spree
|
||||
|
||||
Previously we simply counted how many processes we killed and expected
|
||||
as many waitpid() calls to succeed. That however is incorrect to do.
|
||||
|
||||
As we might kill processes that are not our immediate children, and as
|
||||
there might be left-over processes in the waitpid() queue from earlier
|
||||
the we might get more ore less waitpid() events that we expect.
|
||||
|
||||
Hence: keep precise track of the processes we kill, remove the ones we
|
||||
get waitpid() for, and after each time we get SIGCHLD check if all
|
||||
others still exist. We use getpgid() to check if a PID still exists.
|
||||
|
||||
This should fix issues with journald not setting journal files offline
|
||||
correctly on shutdown, because we'd too quickly proceed from SIGTERM to
|
||||
SIGKILL because some left-over process was in our waitpid() queue.
|
||||
---
|
||||
src/core/killall.c | 85 +++++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 58 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/src/core/killall.c b/src/core/killall.c
|
||||
index 1eb3766..7f0dbb9 100644
|
||||
--- a/src/core/killall.c
|
||||
+++ b/src/core/killall.c
|
||||
@@ -22,12 +22,14 @@
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "def.h"
|
||||
#include "killall.h"
|
||||
+#include "set.h"
|
||||
|
||||
-#define TIMEOUT_USEC (5 * USEC_PER_SEC)
|
||||
+#define TIMEOUT_USEC (10 * USEC_PER_SEC)
|
||||
|
||||
static bool ignore_proc(pid_t pid) {
|
||||
char buf[PATH_MAX];
|
||||
@@ -73,38 +75,68 @@ static bool ignore_proc(pid_t pid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
-static void wait_for_children(int n_processes, sigset_t *mask) {
|
||||
+static void wait_for_children(Set *pids, sigset_t *mask) {
|
||||
usec_t until;
|
||||
|
||||
assert(mask);
|
||||
|
||||
+ if (set_isempty(pids))
|
||||
+ return;
|
||||
+
|
||||
until = now(CLOCK_MONOTONIC) + TIMEOUT_USEC;
|
||||
for (;;) {
|
||||
struct timespec ts;
|
||||
int k;
|
||||
usec_t n;
|
||||
+ void *p;
|
||||
+ Iterator i;
|
||||
|
||||
+ /* First, let the kernel inform us about killed
|
||||
+ * children. Most processes will probably be our
|
||||
+ * children, but some are not (might be our
|
||||
+ * grandchildren instead...). */
|
||||
for (;;) {
|
||||
- pid_t pid = waitpid(-1, NULL, WNOHANG);
|
||||
+ pid_t pid;
|
||||
|
||||
+ pid = waitpid(-1, NULL, WNOHANG);
|
||||
if (pid == 0)
|
||||
break;
|
||||
+ if (pid < 0) {
|
||||
+ if (errno == ECHILD)
|
||||
+ break;
|
||||
|
||||
- if (pid < 0 && errno == ECHILD)
|
||||
+ log_error("waitpid() failed: %m");
|
||||
return;
|
||||
+ }
|
||||
+
|
||||
+ set_remove(pids, ULONG_TO_PTR(pid));
|
||||
+ }
|
||||
|
||||
- if (n_processes > 0)
|
||||
- if (--n_processes == 0)
|
||||
- return;
|
||||
+ /* Now explicitly check who might be remaining, who
|
||||
+ * might not be our child. */
|
||||
+ SET_FOREACH(p, pids, i) {
|
||||
+
|
||||
+ /* We misuse getpgid as a check whether a
|
||||
+ * process still exists. */
|
||||
+ if (getpgid((pid_t) PTR_TO_ULONG(p)) >= 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (errno != ESRCH)
|
||||
+ continue;
|
||||
+
|
||||
+ set_remove(pids, p);
|
||||
}
|
||||
|
||||
+ if (set_isempty(pids))
|
||||
+ return;
|
||||
+
|
||||
n = now(CLOCK_MONOTONIC);
|
||||
if (n >= until)
|
||||
return;
|
||||
|
||||
timespec_store(&ts, until - n);
|
||||
-
|
||||
- if ((k = sigtimedwait(mask, NULL, &ts)) != SIGCHLD) {
|
||||
+ k = sigtimedwait(mask, NULL, &ts);
|
||||
+ if (k != SIGCHLD) {
|
||||
|
||||
if (k < 0 && errno != EAGAIN) {
|
||||
log_error("sigtimedwait() failed: %m");
|
||||
@@ -117,10 +149,9 @@ static void wait_for_children(int n_processes, sigset_t *mask) {
|
||||
}
|
||||
}
|
||||
|
||||
-static int killall(int sig) {
|
||||
- DIR *dir;
|
||||
+static int killall(int sig, Set *pids) {
|
||||
+ _cleanup_closedir_ DIR *dir = NULL;
|
||||
struct dirent *d;
|
||||
- unsigned int n_processes = 0;
|
||||
|
||||
dir = opendir("/proc");
|
||||
if (!dir)
|
||||
@@ -143,23 +174,25 @@ static int killall(int sig) {
|
||||
_cleanup_free_ char *s;
|
||||
|
||||
get_process_comm(pid, &s);
|
||||
- log_notice("Sending SIGKILL to PID %lu (%s)", (unsigned long) pid, strna(s));
|
||||
+ log_notice("Sending SIGKILL to PID %lu (%s).", (unsigned long) pid, strna(s));
|
||||
}
|
||||
|
||||
- if (kill(pid, sig) >= 0)
|
||||
- n_processes++;
|
||||
- else if (errno != ENOENT)
|
||||
+ if (kill(pid, sig) >= 0) {
|
||||
+ if (pids)
|
||||
+ set_put(pids, ULONG_TO_PTR((unsigned long) pid));
|
||||
+ } else if (errno != ENOENT)
|
||||
log_warning("Could not kill %d: %m", pid);
|
||||
}
|
||||
|
||||
- closedir(dir);
|
||||
-
|
||||
- return n_processes;
|
||||
+ return set_size(pids);
|
||||
}
|
||||
|
||||
void broadcast_signal(int sig, bool wait_for_exit) {
|
||||
sigset_t mask, oldmask;
|
||||
- int n_processes;
|
||||
+ Set *pids;
|
||||
+
|
||||
+ if (wait_for_exit)
|
||||
+ pids = set_new(trivial_hash_func, trivial_compare_func);
|
||||
|
||||
assert_se(sigemptyset(&mask) == 0);
|
||||
assert_se(sigaddset(&mask, SIGCHLD) == 0);
|
||||
@@ -168,17 +201,15 @@ void broadcast_signal(int sig, bool wait_for_exit) {
|
||||
if (kill(-1, SIGSTOP) < 0 && errno != ESRCH)
|
||||
log_warning("kill(-1, SIGSTOP) failed: %m");
|
||||
|
||||
- n_processes = killall(sig);
|
||||
+ killall(sig, pids);
|
||||
|
||||
if (kill(-1, SIGCONT) < 0 && errno != ESRCH)
|
||||
log_warning("kill(-1, SIGCONT) failed: %m");
|
||||
|
||||
- if (n_processes <= 0)
|
||||
- goto finish;
|
||||
-
|
||||
if (wait_for_exit)
|
||||
- wait_for_children(n_processes, &mask);
|
||||
+ wait_for_children(pids, &mask);
|
||||
+
|
||||
+ assert_se(sigprocmask(SIG_SETMASK, &oldmask, NULL) == 0);
|
||||
|
||||
-finish:
|
||||
- sigprocmask(SIG_SETMASK, &oldmask, NULL);
|
||||
+ set_free(pids);
|
||||
}
|
||||
--
|
||||
1.8.1.4
|
||||
|
||||
From b6e8f1f03dc8b7579f8c6b00372f136d74c45232 Mon Sep 17 00:00:00 2001
|
||||
From: Harald Hoyer <harald@redhat.com>
|
||||
Date: Wed, 3 Apr 2013 15:16:06 +0200
|
||||
Subject: [PATCH] core/killall.c: prevent segfault and initialize pids
|
||||
|
||||
---
|
||||
src/core/killall.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/killall.c b/src/core/killall.c
|
||||
index 7f0dbb9..e078012 100644
|
||||
--- a/src/core/killall.c
|
||||
+++ b/src/core/killall.c
|
||||
@@ -189,7 +189,7 @@ static int killall(int sig, Set *pids) {
|
||||
|
||||
void broadcast_signal(int sig, bool wait_for_exit) {
|
||||
sigset_t mask, oldmask;
|
||||
- Set *pids;
|
||||
+ Set *pids = NULL;
|
||||
|
||||
if (wait_for_exit)
|
||||
pids = set_new(trivial_hash_func, trivial_compare_func);
|
||||
--
|
||||
1.8.1.4
|
||||
|
Loading…
Reference in New Issue
Block a user