SHA256
1
0
forked from pool/systemd
Dr. Werner Fink 2014-05-16 11:48:04 +00:00 committed by Git OBS Bridge
parent 494283f42f
commit 9cbd040327
8 changed files with 266 additions and 0 deletions

View File

@ -0,0 +1,74 @@
Based on 574634bcacb01efe15ca2742effd461a5b7afb5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 13 May 2014 23:22:13 +0200
Subject: [PATCH] core: close socket fds asynchronously
http://lists.freedesktop.org/archives/systemd-devel/2014-April/018928.html
---
src/core/async.c | 22 ++++++++++++++++++++++
src/core/service.c | 5 +++--
2 files changed, 25 insertions(+), 2 deletions(-)
--- src/core/service.c
+++ src/core/service.c 2014-05-16 11:41:50.150735247 +0000
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <sys/reboot.h>
+#include "async.h"
#include "manager.h"
#include "unit.h"
#include "service.h"
@@ -240,7 +241,7 @@ static void service_close_socket_fd(Serv
if (s->socket_fd < 0)
return;
- close_nointr_nofail(s->socket_fd);
+ asynchronous_close(s->socket_fd);
s->socket_fd = -1;
}
@@ -2767,7 +2768,7 @@ static int service_deserialize_item(Unit
else {
if (s->socket_fd >= 0)
- close_nointr_nofail(s->socket_fd);
+ asynchronous_close(s->socket_fd);
s->socket_fd = fdset_remove(fds, fd);
}
} else if (streq(key, "main-exec-status-pid")) {
--- src/core/async.c
+++ src/core/async.c 2014-05-07 09:40:35.000000000 +0000
@@ -24,6 +24,7 @@
#include "async.h"
#include "log.h"
+#include "util.h"
int asynchronous_job(void* (*func)(void *p), void *arg) {
pthread_attr_t a;
@@ -70,3 +71,24 @@ int asynchronous_sync(void) {
return asynchronous_job(sync_thread, NULL);
}
+
+static void *close_thread(void *p) {
+ close_nointr_nofail(PTR_TO_INT(p));
+ return NULL;
+}
+
+int asynchronous_close(int fd) {
+ int r;
+
+ /* This is supposed to behave similar to safe_close(), but
+ * actually invoke close() asynchronously, so that it will
+ * never block. Ideally the kernel would have an API for this,
+ * but it doesn't, so we work around it, and hide this as a
+ * far away as we can. */
+
+ r = asynchronous_job(close_thread, INT_TO_PTR(fd));
+ if (r < 0)
+ close_nointr_nofail(fd);
+
+ return -1;
+}

View File

@ -0,0 +1,28 @@
From 301f9684e6465df5d0590f6c571fe3229ded966d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 15 May 2014 18:30:07 +0200
Subject: [PATCH] logind: bring polkit policy for hibernate in line with
suspend/poweroff/reboot
THere's no reason why hibernate should be better protected then
suspendor poweroff, so sync the policies.
---
src/login/org.freedesktop.login1.policy.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/login/org.freedesktop.login1.policy.in src/login/org.freedesktop.login1.policy.in
index b96d32d..b8e90f1 100644
--- src/login/org.freedesktop.login1.policy.in
+++ src/login/org.freedesktop.login1.policy.in
@@ -254,7 +254,7 @@
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
- <allow_active>auth_admin_keep</allow_active>
+ <allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.hibernate</annotate>
</action>
--
1.7.9.2

View File

@ -0,0 +1,118 @@
From 9bdb98c59451ed090f8d35d470a54710f389ce71 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 16 May 2014 01:15:03 +0200
Subject: [PATCH] core: make sure to serialize jobs for all units
Previously we wouldn't serialize jobs for units that themselves have
nothing to serialize.
http://lists.freedesktop.org/archives/systemd-devel/2014-May/019051.html
---
src/core/manager.c | 3 ---
src/core/unit.c | 43 +++++++++++++++++++++----------------------
2 files changed, 21 insertions(+), 25 deletions(-)
diff --git src/core/manager.c src/core/manager.c
index 1e3e127..d0af674 100644
--- src/core/manager.c
+++ src/core/manager.c
@@ -2131,9 +2131,6 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) {
if (u->id != t)
continue;
- if (!unit_can_serialize(u))
- continue;
-
/* Start marker */
fputs(u->id, f);
fputc('\n', f);
diff --git src/core/unit.c src/core/unit.c
index c4ed923..41651ba 100644
--- src/core/unit.c
+++ src/core/unit.c
@@ -2288,25 +2288,25 @@ bool unit_can_serialize(Unit *u) {
}
int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) {
- ExecRuntime *rt;
int r;
assert(u);
assert(f);
assert(fds);
- if (!unit_can_serialize(u))
- return 0;
-
- r = UNIT_VTABLE(u)->serialize(u, f, fds);
- if (r < 0)
- return r;
+ if (unit_can_serialize(u)) {
+ ExecRuntime *rt;
- rt = unit_get_exec_runtime(u);
- if (rt) {
- r = exec_runtime_serialize(rt, u, f, fds);
+ r = UNIT_VTABLE(u)->serialize(u, f, fds);
if (r < 0)
return r;
+
+ rt = unit_get_exec_runtime(u);
+ if (rt) {
+ r = exec_runtime_serialize(rt, u, f, fds);
+ if (r < 0)
+ return r;
+ }
}
dual_timestamp_serialize(f, "inactive-exit-timestamp", &u->inactive_exit_timestamp);
@@ -2368,17 +2368,14 @@ void unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value) {
}
int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
- size_t offset;
ExecRuntime **rt = NULL;
+ size_t offset;
int r;
assert(u);
assert(f);
assert(fds);
- if (!unit_can_serialize(u))
- return 0;
-
offset = UNIT_VTABLE(u)->exec_runtime_offset;
if (offset > 0)
rt = (ExecRuntime**) ((uint8_t*) u + offset);
@@ -2503,17 +2500,19 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
continue;
}
- if (rt) {
- r = exec_runtime_deserialize_item(rt, u, l, v, fds);
+ if (unit_can_serialize(u)) {
+ if (rt) {
+ r = exec_runtime_deserialize_item(rt, u, l, v, fds);
+ if (r < 0)
+ return r;
+ if (r > 0)
+ continue;
+ }
+
+ r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds);
if (r < 0)
return r;
- if (r > 0)
- continue;
}
-
- r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds);
- if (r < 0)
- return r;
}
}
--
1.7.9.2

View File

@ -1,7 +1,19 @@
systemd systemd
supplements "packageand(systemd:pam-<targettype>)" supplements "packageand(systemd:pam-<targettype>)"
-/lib/systemd/system/ -/lib/systemd/system/
post "<prefix>%{_sbindir}/pam-config -a --systemd || :"
post "<prefix>/sbin/ldconfig
postun "<prefix>%{_sbindir}/pam-config -d --systemd || :"
postun "<prefix>/sbin/ldconfig"
libudev0 libudev0
post "<prefix>/sbin/ldconfig"
postun "<prefix>/sbin/ldconfig"
libgudev-1_0-0 libgudev-1_0-0
post "<prefix>/sbin/ldconfig"
postun "<prefix>/sbin/ldconfig"
libudev1 libudev1
post "<prefix>/sbin/ldconfig"
postun "<prefix>/sbin/ldconfig"
nss-myhostname nss-myhostname
post "<prefix>/sbin/ldconfig"
postun "<prefix>/sbin/ldconfig"

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri May 16 11:47:06 UTC 2014 - werner@suse.de
- Add upstram patches
0001-core-close-socket-fds-asynchronously.patch
0002-logind-bring-polkit-policy-for-hibernate-in-line-wit.patch
0003-core-make-sure-to-serialize-jobs-for-all-units.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Wed May 14 07:37:08 UTC 2014 - werner@suse.de Wed May 14 07:37:08 UTC 2014 - werner@suse.de

View File

@ -433,6 +433,12 @@ Patch219: log-target-null-instead-kmsg.patch
Patch220: 0001-replace-more-dup-by-F_DUPFD_CLOEXEC.patch Patch220: 0001-replace-more-dup-by-F_DUPFD_CLOEXEC.patch
# PATCH-FIX-UPSTREAM added at 2014/05/14 # PATCH-FIX-UPSTREAM added at 2014/05/14
Patch221: 0002-pam_systemd-use-F_DUPFD_CLOEXEC-when-dupping-session.patch Patch221: 0002-pam_systemd-use-F_DUPFD_CLOEXEC-when-dupping-session.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch222: 0001-core-close-socket-fds-asynchronously.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch223: 0002-logind-bring-polkit-policy-for-hibernate-in-line-wit.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch224: 0003-core-make-sure-to-serialize-jobs-for-all-units.patch
# UDEV PATCHES # UDEV PATCHES
# ============ # ============
@ -839,6 +845,9 @@ cp %{SOURCE7} m4/
%patch219 -p1 %patch219 -p1
%patch220 -p0 %patch220 -p0
%patch221 -p0 %patch221 -p0
%patch222 -p0
%patch223 -p0
%patch224 -p0
# udev patches # udev patches
%patch1001 -p1 %patch1001 -p1

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri May 16 11:47:06 UTC 2014 - werner@suse.de
- Add upstram patches
0001-core-close-socket-fds-asynchronously.patch
0002-logind-bring-polkit-policy-for-hibernate-in-line-wit.patch
0003-core-make-sure-to-serialize-jobs-for-all-units.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Wed May 14 07:37:08 UTC 2014 - werner@suse.de Wed May 14 07:37:08 UTC 2014 - werner@suse.de

View File

@ -428,6 +428,12 @@ Patch219: log-target-null-instead-kmsg.patch
Patch220: 0001-replace-more-dup-by-F_DUPFD_CLOEXEC.patch Patch220: 0001-replace-more-dup-by-F_DUPFD_CLOEXEC.patch
# PATCH-FIX-UPSTREAM added at 2014/05/14 # PATCH-FIX-UPSTREAM added at 2014/05/14
Patch221: 0002-pam_systemd-use-F_DUPFD_CLOEXEC-when-dupping-session.patch Patch221: 0002-pam_systemd-use-F_DUPFD_CLOEXEC-when-dupping-session.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch222: 0001-core-close-socket-fds-asynchronously.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch223: 0002-logind-bring-polkit-policy-for-hibernate-in-line-wit.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch224: 0003-core-make-sure-to-serialize-jobs-for-all-units.patch
# UDEV PATCHES # UDEV PATCHES
# ============ # ============
@ -834,6 +840,9 @@ cp %{SOURCE7} m4/
%patch219 -p1 %patch219 -p1
%patch220 -p0 %patch220 -p0
%patch221 -p0 %patch221 -p0
%patch222 -p0
%patch223 -p0
%patch224 -p0
# udev patches # udev patches
%patch1001 -p1 %patch1001 -p1