2014-05-17 21:46:37 +02:00
|
|
|
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
|
|
|
|
---
|
2014-07-12 17:14:24 +02:00
|
|
|
src/core/async.c | 24 ++++++++++++++++++++++++
|
2014-05-17 21:46:37 +02:00
|
|
|
src/core/service.c | 5 +++--
|
2014-07-12 17:14:24 +02:00
|
|
|
2 files changed, 27 insertions(+), 2 deletions(-)
|
2014-05-17 21:46:37 +02:00
|
|
|
|
Accepting request 242359 from Base:System
- Disable blkrrpart for SLES12 and below
- Add upstream patch
1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch
- Add with condition blkrrpart to be able to disable the patches
1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054
which uses the BLKRRPART ioctl for e.g. synthesize change events
which may interfere with other tools like parted.
- Update
handle-disable_caplock-and-compose_table-and-kbd_rate.patch,
handle-numlock-value-in-etc-sysconfig-keyboard.patch: read
/etc/vconsole.conf after /etc/sysconfig/(keyboard,console)
otherwise empty value in /etc/sysconfig/keyboard might override
/etc/vconsole.conf values.
- Update :
0001-journal-compress-return-early-in-uncompress_startswi.patch
0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch
0002-vconsole-setup-run-setfont-before-loadkeys.patch
0003-core-never-consider-failure-when-reading-drop-ins-fa.patch
0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch
apply-ACL-for-nvidia-device-nodes.patch
keep-crypt-password-prompt.patch
log-target-null-instead-kmsg.patch
parse-crypttab-for-noauto-option.patch
set-and-use-default-logconsole.patch: fix all warnings in code
- Remove 0001-compress-fix-return-value.patch: not relevant to
systemd v210 code.
- Also change udev-generate-peristent-rule to udev-generate-persistent-rule
OBS-URL: https://build.opensuse.org/request/show/242359
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
|
|
|
Index: src/core/service.c
|
|
|
|
===================================================================
|
|
|
|
--- src/core/service.c.orig
|
|
|
|
+++ src/core/service.c
|
2014-05-17 21:46:37 +02:00
|
|
|
@@ -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")) {
|
Accepting request 242359 from Base:System
- Disable blkrrpart for SLES12 and below
- Add upstream patch
1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch
- Add with condition blkrrpart to be able to disable the patches
1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054
which uses the BLKRRPART ioctl for e.g. synthesize change events
which may interfere with other tools like parted.
- Update
handle-disable_caplock-and-compose_table-and-kbd_rate.patch,
handle-numlock-value-in-etc-sysconfig-keyboard.patch: read
/etc/vconsole.conf after /etc/sysconfig/(keyboard,console)
otherwise empty value in /etc/sysconfig/keyboard might override
/etc/vconsole.conf values.
- Update :
0001-journal-compress-return-early-in-uncompress_startswi.patch
0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch
0002-vconsole-setup-run-setfont-before-loadkeys.patch
0003-core-never-consider-failure-when-reading-drop-ins-fa.patch
0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch
apply-ACL-for-nvidia-device-nodes.patch
keep-crypt-password-prompt.patch
log-target-null-instead-kmsg.patch
parse-crypttab-for-noauto-option.patch
set-and-use-default-logconsole.patch: fix all warnings in code
- Remove 0001-compress-fix-return-value.patch: not relevant to
systemd v210 code.
- Also change udev-generate-peristent-rule to udev-generate-persistent-rule
OBS-URL: https://build.opensuse.org/request/show/242359
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
|
|
|
Index: src/core/async.c
|
|
|
|
===================================================================
|
|
|
|
--- src/core/async.c.orig
|
|
|
|
+++ src/core/async.c
|
2014-05-17 21:46:37 +02:00
|
|
|
@@ -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;
|
2014-07-12 17:14:24 +02:00
|
|
|
@@ -70,3 +71,26 @@ int asynchronous_sync(void) {
|
2014-05-17 21:46:37 +02:00
|
|
|
|
|
|
|
return asynchronous_job(sync_thread, NULL);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+static void *close_thread(void *p) {
|
2014-07-12 17:14:24 +02:00
|
|
|
+ int fd = PTR_TO_INT(p);
|
|
|
|
+ if (fd >= 0)
|
|
|
|
+ close_nointr_nofail(fd);
|
2014-05-17 21:46:37 +02:00
|
|
|
+ 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));
|
2014-07-12 17:14:24 +02:00
|
|
|
+ if (r < 0 && fd >= 0)
|
2014-05-17 21:46:37 +02:00
|
|
|
+ close_nointr_nofail(fd);
|
|
|
|
+
|
|
|
|
+ return -1;
|
|
|
|
+}
|
Accepting request 242359 from Base:System
- Disable blkrrpart for SLES12 and below
- Add upstream patch
1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch
- Add with condition blkrrpart to be able to disable the patches
1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054
which uses the BLKRRPART ioctl for e.g. synthesize change events
which may interfere with other tools like parted.
- Update
handle-disable_caplock-and-compose_table-and-kbd_rate.patch,
handle-numlock-value-in-etc-sysconfig-keyboard.patch: read
/etc/vconsole.conf after /etc/sysconfig/(keyboard,console)
otherwise empty value in /etc/sysconfig/keyboard might override
/etc/vconsole.conf values.
- Update :
0001-journal-compress-return-early-in-uncompress_startswi.patch
0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch
0002-vconsole-setup-run-setfont-before-loadkeys.patch
0003-core-never-consider-failure-when-reading-drop-ins-fa.patch
0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch
apply-ACL-for-nvidia-device-nodes.patch
keep-crypt-password-prompt.patch
log-target-null-instead-kmsg.patch
parse-crypttab-for-noauto-option.patch
set-and-use-default-logconsole.patch: fix all warnings in code
- Remove 0001-compress-fix-return-value.patch: not relevant to
systemd v210 code.
- Also change udev-generate-peristent-rule to udev-generate-persistent-rule
OBS-URL: https://build.opensuse.org/request/show/242359
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
|
|
|
Index: src/core/async.h
|
|
|
|
===================================================================
|
|
|
|
--- src/core/async.h.orig
|
|
|
|
+++ src/core/async.h
|
|
|
|
@@ -23,3 +23,4 @@
|
|
|
|
|
|
|
|
int asynchronous_job(void* (*func)(void *p), void *arg);
|
|
|
|
int asynchronous_sync(void);
|
|
|
|
+int asynchronous_close(int fd);
|