From 7e450ee836401746cb899ced5aecef40e1908359d7b2492048162a38d1ec228b Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 21 Nov 2013 14:07:14 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=466 --- 1011-check-4-valid-kmsg-device.patch | 70 ++++++++++++++++++++++++++++ systemd.changes | 7 +++ systemd.spec | 3 ++ 3 files changed, 80 insertions(+) create mode 100644 1011-check-4-valid-kmsg-device.patch diff --git a/1011-check-4-valid-kmsg-device.patch b/1011-check-4-valid-kmsg-device.patch new file mode 100644 index 00000000..ffb36937 --- /dev/null +++ b/1011-check-4-valid-kmsg-device.patch @@ -0,0 +1,70 @@ +From: Werner Fink +Date: Thu, 21 Nov 2013 11:50:32 +0000 +Subject: [PATCH] Avoid busy systemd-journald + +Avoid a busy systemd-journald due polling a broken /dec/kmsg in lxc +environments. + +--- + journald-kmsg.c | 27 ++++++++++++++++++++++++++- + 1 file changed, 26 insertions(+), 1 deletion(-) + +Index: systemd-208/src/journal/journald-kmsg.c +=================================================================== +--- systemd-208/src/journal/journald-kmsg.c ++++ systemd-208/src/journal/journald-kmsg.c 2013-11-21 13:30:22.930735683 +0000 +@@ -23,7 +23,9 @@ + #include + #include + #include ++#include + #include ++#include + + #include + #include +@@ -377,20 +379,43 @@ int server_flush_dev_kmsg(Server *s) { + + int server_open_dev_kmsg(Server *s) { + struct epoll_event ev; ++ struct stat st; + + assert(s); + + s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); + if (s->dev_kmsg_fd < 0) { +- log_warning("Failed to open /dev/kmsg, ignoring: %m"); ++ /* Do not warn as it may not exists in LXC environments */ ++ if (errno != ENOENT) ++ log_warning("Failed to open /dev/kmsg, ignoring: %m"); + return 0; + } + ++ if (fstat(s->dev_kmsg_fd, &st) < 0) { ++ log_error("Failed to stat /dev/kmsg fd, ignoring: %m"); ++ close_nointr_nofail(s->dev_kmsg_fd); ++ s->dev_kmsg_fd = -1; ++ return 0; ++ } ++ ++ if (!S_ISCHR(st.st_mode) || major(st.st_rdev) != 1 || minor(st.st_rdev) != 11) { ++ int old_errno = errno; ++ errno = ENODEV; ++ log_warning("Irregular device /dev/kmsg, ignoring: %m"); ++ errno = old_errno; ++ close_nointr_nofail(s->dev_kmsg_fd); ++ s->dev_kmsg_fd = -1; ++ return 0; ++ } ++ + zero(ev); + ev.events = EPOLLIN; + ev.data.fd = s->dev_kmsg_fd; + if (epoll_ctl(s->epoll_fd, EPOLL_CTL_ADD, s->dev_kmsg_fd, &ev) < 0) { + ++ close_nointr_nofail(s->dev_kmsg_fd); ++ s->dev_kmsg_fd = -1; ++ + /* This will fail with EPERM on older kernels where + * /dev/kmsg is not readable. */ + if (errno == EPERM) diff --git a/systemd.changes b/systemd.changes index c5a10894..20b2c0b1 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Nov 21 12:27:11 UTC 2013 - werner@suse.de + +- Add patch + 1011-check-4-valid-kmsg-device.patch + to avoid a busy systemd-journald (bnc#851393) + ------------------------------------------------------------------- Wed Nov 6 09:42:05 UTC 2013 - werner@suse.de diff --git a/systemd.spec b/systemd.spec index 62f08f07..22d16489 100644 --- a/systemd.spec +++ b/systemd.spec @@ -258,6 +258,8 @@ Patch1008: 1008-add-msft-compability-rules.patch Patch1009: 1009-make-xsltproc-use-correct-ROFF-links.patch # PATCH-FIX-OPENSUSE 1010-do-not-install-sulogin-unit-with-poweroff.patch -- Avoid installing console-shell.service (bnc#849071) Patch1010: 1010-do-not-install-sulogin-unit-with-poweroff.patch +# PATCH-FIX-OPENSUSE 1011-check-4-valid-kmsg-device.patch -- Avoid busy systemd-journald (bnc#851393) +Patch1011: 1011-check-4-valid-kmsg-device.patch %description Systemd is a system and service manager, compatible with SysV and LSB @@ -534,6 +536,7 @@ cp %{SOURCE7} m4/ %endif %patch1009 -p1 %patch1010 -p1 +%patch1011 -p1 # ensure generate files are removed rm -f units/emergency.service