.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=774
This commit is contained in:
parent
36fd338cba
commit
f444d6cc94
@ -0,0 +1,26 @@
|
||||
From ad6e5b348fa88f44d6cbfe7aabda7612a1d0463f Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Mon, 8 Sep 2014 14:00:58 +0200
|
||||
Subject: [PATCH] udev: net_setup_link - export the .link filename applied to
|
||||
the link
|
||||
|
||||
---
|
||||
src/udev/udev-builtin-net_setup_link.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git src/udev/udev-builtin-net_setup_link.c src/udev/udev-builtin-net_setup_link.c
|
||||
index 6207269..14351de 100644
|
||||
--- src/udev/udev-builtin-net_setup_link.c
|
||||
+++ src/udev/udev-builtin-net_setup_link.c
|
||||
@@ -57,6 +57,8 @@ static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
+ udev_builtin_add_property(dev, test, "ID_NET_LINK_FILE", link->filename);
|
||||
+
|
||||
if (name)
|
||||
udev_builtin_add_property(dev, test, "ID_NET_NAME", name);
|
||||
|
||||
--
|
||||
1.7.9.2
|
||||
|
@ -0,0 +1,27 @@
|
||||
From e4d7c49050769877c7f10184bbe2a1e77d0b5333 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Mon, 8 Sep 2014 17:16:24 +0200
|
||||
Subject: [PATCH] rules: net-setup-link - preserve ID_NET_LINK_FILE and
|
||||
ID_NET_NAME after MOVE
|
||||
|
||||
---
|
||||
rules/80-net-setup-link.rules | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git rules/80-net-setup-link.rules rules/80-net-setup-link.rules
|
||||
index f390fcb..27c43b9 100644
|
||||
--- rules/80-net-setup-link.rules
|
||||
+++ rules/80-net-setup-link.rules
|
||||
@@ -4,7 +4,8 @@ SUBSYSTEM!="net", GOTO="net_setup_link_end"
|
||||
|
||||
IMPORT{builtin}="path_id"
|
||||
|
||||
-ACTION=="move", IMPORT{db}="ID_NET_DRIVER"
|
||||
+ACTION=="move", IMPORT{db}="ID_NET_DRIVER", IMPORT{db}="ID_NET_LINK_FILE",
|
||||
+IMPORT{db}="ID_NET_NAME"
|
||||
|
||||
ACTION!="add", GOTO="net_setup_link_end"
|
||||
|
||||
--
|
||||
1.7.9.2
|
||||
|
27
1070-rules-net-setup-link-remove-stray-linebreak.patch
Normal file
27
1070-rules-net-setup-link-remove-stray-linebreak.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 52e231b04635400292179cf51b30d7d9b6323fb2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
|
||||
Date: Mon, 8 Sep 2014 22:53:39 +0300
|
||||
Subject: [PATCH] rules: net-setup-link - remove stray linebreak
|
||||
|
||||
If not backslash-escaped, it splits the rule in two.
|
||||
---
|
||||
rules/80-net-setup-link.rules | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git rules/80-net-setup-link.rules rules/80-net-setup-link.rules
|
||||
index 27c43b9..4207694 100644
|
||||
--- rules/80-net-setup-link.rules
|
||||
+++ rules/80-net-setup-link.rules
|
||||
@@ -4,8 +4,7 @@ SUBSYSTEM!="net", GOTO="net_setup_link_end"
|
||||
|
||||
IMPORT{builtin}="path_id"
|
||||
|
||||
-ACTION=="move", IMPORT{db}="ID_NET_DRIVER", IMPORT{db}="ID_NET_LINK_FILE",
|
||||
-IMPORT{db}="ID_NET_NAME"
|
||||
+ACTION=="move", IMPORT{db}="ID_NET_DRIVER", IMPORT{db}="ID_NET_LINK_FILE", IMPORT{db}="ID_NET_NAME"
|
||||
|
||||
ACTION!="add", GOTO="net_setup_link_end"
|
||||
|
||||
--
|
||||
1.7.9.2
|
||||
|
@ -0,0 +1,54 @@
|
||||
From b081b27e1433cdc7ac72b25ae8b4db887d79187f Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Tue, 9 Sep 2014 12:23:19 +0200
|
||||
Subject: [PATCH] udev: import the full db on MOVE events for devices without
|
||||
dev_t
|
||||
|
||||
---
|
||||
rules/80-net-setup-link.rules | 2 --
|
||||
src/udev/udev-event.c | 16 ++++++++++++++++
|
||||
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git rules/80-net-setup-link.rules rules/80-net-setup-link.rules
|
||||
index 4207694..6e411a9 100644
|
||||
--- rules/80-net-setup-link.rules
|
||||
+++ rules/80-net-setup-link.rules
|
||||
@@ -4,8 +4,6 @@ SUBSYSTEM!="net", GOTO="net_setup_link_end"
|
||||
|
||||
IMPORT{builtin}="path_id"
|
||||
|
||||
-ACTION=="move", IMPORT{db}="ID_NET_DRIVER", IMPORT{db}="ID_NET_LINK_FILE", IMPORT{db}="ID_NET_NAME"
|
||||
-
|
||||
ACTION!="add", GOTO="net_setup_link_end"
|
||||
|
||||
IMPORT{builtin}="net_setup_link"
|
||||
diff --git src/udev/udev-event.c src/udev/udev-event.c
|
||||
index 00cd6d4..18b92ca 100644
|
||||
--- src/udev/udev-event.c
|
||||
+++ src/udev/udev-event.c
|
||||
@@ -805,6 +805,22 @@ void udev_event_execute_rules(struct udev_event *event,
|
||||
udev_watch_end(event->udev, event->dev_db);
|
||||
}
|
||||
|
||||
+ if (major(udev_device_get_devnum(dev)) == 0 &&
|
||||
+ streq(udev_device_get_action(dev), "move")) {
|
||||
+ struct udev_list_entry *entry;
|
||||
+
|
||||
+ for ((entry = udev_device_get_properties_list_entry(event->dev_db)); entry; entry = udev_list_entry_get_next(entry)) {
|
||||
+ const char *key, *value;
|
||||
+ struct udev_list_entry *property;
|
||||
+
|
||||
+ key = udev_list_entry_get_name(entry);
|
||||
+ value = udev_list_entry_get_value(entry);
|
||||
+
|
||||
+ property = udev_device_add_property(event->dev, key, value);
|
||||
+ udev_list_entry_set_num(property, true);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
udev_rules_apply_to_event(rules, event, timeout_usec, sigmask);
|
||||
|
||||
/* rename a new network interface, if needed */
|
||||
--
|
||||
1.7.9.2
|
||||
|
39
1072-udev-netif_rename-don-t-log-to-kmsg.patch
Normal file
39
1072-udev-netif_rename-don-t-log-to-kmsg.patch
Normal file
@ -0,0 +1,39 @@
|
||||
Based on 1187f20655de0c37337ea73e1e55823b83cd7c00 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Tue, 9 Sep 2014 22:45:03 +0200
|
||||
Subject: [PATCH] udev: netif_rename - don't log to kmsg
|
||||
|
||||
As of 3.17, the kernel will do this on its own, so just do regular log_debug() logging from udev.
|
||||
---
|
||||
src/udev/udev-event.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
--- src/udev/udev-event.c
|
||||
+++ src/udev/udev-event.c 2014-09-16 08:52:36.154735794 +0000
|
||||
@@ -770,7 +770,7 @@ static int rename_netif(struct udev_even
|
||||
|
||||
r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name);
|
||||
if (r == 0) {
|
||||
- print_kmsg("renamed network interface %s to %s\n", oldname, name);
|
||||
+ log_debug("renamed network interface %s to %s", oldname, name);
|
||||
return r;
|
||||
} else if (r != -EEXIST) {
|
||||
log_error("error changing net interface name %s to %s: %s",
|
||||
@@ -789,7 +789,7 @@ static int rename_netif(struct udev_even
|
||||
}
|
||||
|
||||
/* log temporary name */
|
||||
- print_kmsg("renamed network interface %s to %s\n", oldname, interim);
|
||||
+ log_debug("renamed network interface %s to %s", oldname, interim);
|
||||
|
||||
loop = 90 * 20;
|
||||
while (loop--) {
|
||||
@@ -798,7 +798,7 @@ static int rename_netif(struct udev_even
|
||||
|
||||
r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name);
|
||||
if (r == 0) {
|
||||
- print_kmsg("renamed network interface %s to %s\n", interim, name);
|
||||
+ log_debug("renamed network interface %s to %s", interim, name);
|
||||
break;
|
||||
}
|
||||
|
75
1073-udev-drop-print_kmsg.patch
Normal file
75
1073-udev-drop-print_kmsg.patch
Normal file
@ -0,0 +1,75 @@
|
||||
Based on 9d19a679f23c7a72c326cbbbf44e0c9f423dec5d Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Tue, 9 Sep 2014 22:48:07 +0200
|
||||
Subject: [PATCH] udev - drop print_kmsg
|
||||
|
||||
The only remaining user was 'starting version XXX', which is now logged using log_info().
|
||||
---
|
||||
src/libudev/libudev-private.h | 1 -
|
||||
src/libudev/libudev-util.c | 25 -------------------------
|
||||
src/udev/udevd.c | 2 +-
|
||||
3 files changed, 1 insertion(+), 27 deletions(-)
|
||||
|
||||
diff --git src/libudev/libudev-private.h src/libudev/libudev-private.h
|
||||
index ae97557..cd1c1fb 100644
|
||||
--- src/libudev/libudev-private.h
|
||||
+++ src/libudev/libudev-private.h
|
||||
@@ -170,6 +170,5 @@ int util_delete_path(struct udev *udev, const char *path);
|
||||
uid_t util_lookup_user(struct udev *udev, const char *user);
|
||||
gid_t util_lookup_group(struct udev *udev, const char *group);
|
||||
int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value);
|
||||
-ssize_t print_kmsg(const char *fmt, ...) _printf_(1, 2);
|
||||
|
||||
#endif
|
||||
--- src/libudev/libudev-util.c
|
||||
+++ src/libudev/libudev-util.c 2014-09-16 08:56:01.862736270 +0000
|
||||
@@ -422,33 +422,3 @@ static int parse_proc_cmdline_word(const
|
||||
|
||||
return 0;
|
||||
}
|
||||
-
|
||||
-ssize_t print_kmsg(const char *fmt, ...)
|
||||
-{
|
||||
- _cleanup_close_ int fd = -1;
|
||||
- va_list ap;
|
||||
- char text[1024];
|
||||
- ssize_t len;
|
||||
- ssize_t ret;
|
||||
-
|
||||
- if (parse_proc_cmdline(parse_proc_cmdline_word) == -115) {
|
||||
- fd = open("/dev/null", O_WRONLY|O_NOCTTY|O_CLOEXEC);
|
||||
- } else {
|
||||
- fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC);
|
||||
- }
|
||||
-
|
||||
- if (fd < 0)
|
||||
- return -errno;
|
||||
-
|
||||
- len = snprintf(text, sizeof(text), "<30>systemd-udevd[%u]: ", getpid());
|
||||
-
|
||||
- va_start(ap, fmt);
|
||||
- len += vsnprintf(text + len, sizeof(text) - len, fmt, ap);
|
||||
- va_end(ap);
|
||||
-
|
||||
- ret = write(fd, text, len);
|
||||
- if (ret < 0)
|
||||
- return -errno;
|
||||
-
|
||||
- return ret;
|
||||
-}
|
||||
diff --git src/udev/udevd.c src/udev/udevd.c
|
||||
index be0acc3..b023b6e 100644
|
||||
--- src/udev/udevd.c
|
||||
+++ src/udev/udevd.c
|
||||
@@ -1200,7 +1200,7 @@ int main(int argc, char *argv[]) {
|
||||
sd_notify(1, "READY=1");
|
||||
}
|
||||
|
||||
- print_kmsg("starting version " VERSION "\n");
|
||||
+ log_info("starting version " VERSION "\n");
|
||||
|
||||
if (!debug) {
|
||||
int fd;
|
||||
--
|
||||
1.7.9.2
|
||||
|
25
1074-udev-fix-copy-paste-error-in-log-message.patch
Normal file
25
1074-udev-fix-copy-paste-error-in-log-message.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From ec3281d3b681b002dfe1a4bea0532a504e37557a Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Wed, 10 Sep 2014 07:59:22 +0200
|
||||
Subject: [PATCH] udev: fix copy-paste error in log message
|
||||
|
||||
---
|
||||
src/udev/udev-rules.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git src/udev/udev-rules.c src/udev/udev-rules.c
|
||||
index cc56215..6de7511 100644
|
||||
--- src/udev/udev-rules.c
|
||||
+++ src/udev/udev-rules.c
|
||||
@@ -1323,7 +1323,7 @@ static int add_rule(struct udev_rules *rules, char *line,
|
||||
if (cmd < UDEV_BUILTIN_MAX)
|
||||
rule_add_key(&rule_tmp, TK_A_RUN_BUILTIN, op, value, &cmd);
|
||||
else
|
||||
- log_error("IMPORT{builtin}: '%s' unknown %s:%u", value, filename, lineno);
|
||||
+ log_error("RUN{builtin}: '%s' unknown %s:%u", value, filename, lineno);
|
||||
} else if (streq(attr, "program")) {
|
||||
enum udev_builtin_cmd cmd = UDEV_BUILTIN_MAX;
|
||||
|
||||
--
|
||||
1.7.9.2
|
||||
|
28
1075-udev-timeout-increase-timeout.patch
Normal file
28
1075-udev-timeout-increase-timeout.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From b5338a19864ac3f5632aee48069a669479621dca Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Wed, 10 Sep 2014 10:56:26 +0200
|
||||
Subject: [PATCH] udev: timeout - increase timeout
|
||||
|
||||
Some kernel modules still take more than one minute to insmod, we no longer rely on the timeout
|
||||
killing insmod within a given period of time, so just bump this to a much higher value. Its only
|
||||
purpose is to make sure that nothing stays aronud forever.
|
||||
---
|
||||
src/udev/udevd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git src/udev/udevd.c src/udev/udevd.c
|
||||
index b023b6e..a7f8cbd 100644
|
||||
--- src/udev/udevd.c
|
||||
+++ src/udev/udevd.c
|
||||
@@ -74,7 +74,7 @@ static bool reload;
|
||||
static int children;
|
||||
static int children_max;
|
||||
static int exec_delay;
|
||||
-static usec_t event_timeout_usec = 60 * USEC_PER_SEC;
|
||||
+static usec_t event_timeout_usec = 180 * USEC_PER_SEC;
|
||||
static sigset_t sigmask_orig;
|
||||
static UDEV_LIST(event_list);
|
||||
static UDEV_LIST(worker_list);
|
||||
--
|
||||
1.7.9.2
|
||||
|
350
1076-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch
Normal file
350
1076-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch
Normal file
@ -0,0 +1,350 @@
|
||||
Based on 671174136525ddf208cdbe75d6d6bd159afa961f Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Thu, 11 Sep 2014 18:49:04 +0200
|
||||
Subject: [PATCH] udev: timeout - warn after a third of the timeout before
|
||||
killing
|
||||
|
||||
---
|
||||
src/test/test-udev.c | 4 ++--
|
||||
src/udev/udev-event.c | 40 ++++++++++++++++++++++++++++++----------
|
||||
src/udev/udev-rules.c | 8 +++++---
|
||||
src/udev/udev.h | 9 ++++++---
|
||||
src/udev/udevadm-test.c | 2 +-
|
||||
src/udev/udevd.c | 40 +++++++++++++++++++++++++++-------------
|
||||
6 files changed, 71 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git src/test/test-udev.c src/test/test-udev.c
|
||||
index 566a73a..f085262 100644
|
||||
--- src/test/test-udev.c
|
||||
+++ src/test/test-udev.c
|
||||
@@ -153,8 +153,8 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
- udev_event_execute_rules(event, USEC_PER_SEC, rules, &sigmask_orig);
|
||||
- udev_event_execute_run(event, USEC_PER_SEC, NULL);
|
||||
+ udev_event_execute_rules(event, 3 * USEC_PER_SEC, USEC_PER_SEC, rules, &sigmask_orig);
|
||||
+ udev_event_execute_run(event, 3 * USEC_PER_SEC, USEC_PER_SEC, NULL);
|
||||
out:
|
||||
if (event != NULL && event->fd_signal >= 0)
|
||||
close(event->fd_signal);
|
||||
diff --git src/udev/udev-event.c src/udev/udev-event.c
|
||||
index a883edc..e8d6676 100644
|
||||
--- src/udev/udev-event.c
|
||||
+++ src/udev/udev-event.c
|
||||
@@ -541,6 +541,7 @@ out:
|
||||
|
||||
static int spawn_wait(struct udev_event *event,
|
||||
usec_t timeout_usec,
|
||||
+ usec_t timeout_warn_usec,
|
||||
const char *cmd, pid_t pid) {
|
||||
struct pollfd pfd[1];
|
||||
int err = 0;
|
||||
@@ -550,6 +551,7 @@ static int spawn_wait(struct udev_event *event,
|
||||
|
||||
while (pid > 0) {
|
||||
int timeout;
|
||||
+ int timeout_warn = 0;
|
||||
int fdcount;
|
||||
|
||||
if (timeout_usec > 0) {
|
||||
@@ -558,13 +560,17 @@ static int spawn_wait(struct udev_event *event,
|
||||
age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
|
||||
if (age_usec >= timeout_usec)
|
||||
timeout = 1000;
|
||||
- else
|
||||
- timeout = ((timeout_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC;
|
||||
+ else {
|
||||
+ if (timeout_warn_usec > 0)
|
||||
+ timeout_warn = ((timeout_warn_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC;
|
||||
+
|
||||
+ timeout = ((timeout_usec - timeout_warn_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC;
|
||||
+ }
|
||||
} else {
|
||||
timeout = -1;
|
||||
}
|
||||
|
||||
- fdcount = poll(pfd, 1, timeout);
|
||||
+ fdcount = poll(pfd, 1, timeout_warn);
|
||||
if (fdcount < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
@@ -573,8 +579,20 @@ static int spawn_wait(struct udev_event *event,
|
||||
goto out;
|
||||
}
|
||||
if (fdcount == 0) {
|
||||
- log_error("timeout: killing '%s' [%u]", cmd, pid);
|
||||
- kill(pid, SIGKILL);
|
||||
+ log_warning("slow: '%s' [%u]", cmd, pid);
|
||||
+
|
||||
+ fdcount = poll(pfd, 1, timeout);
|
||||
+ if (fdcount < 0) {
|
||||
+ if (errno == EINTR)
|
||||
+ continue;
|
||||
+ err = -errno;
|
||||
+ log_error("failed to poll: %m");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (fdcount == 0) {
|
||||
+ log_error("timeout: killing '%s' [%u]", cmd, pid);
|
||||
+ kill(pid, SIGKILL);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (pfd[0].revents & POLLIN) {
|
||||
@@ -654,6 +672,7 @@ out:
|
||||
|
||||
int udev_event_spawn(struct udev_event *event,
|
||||
usec_t timeout_usec,
|
||||
+ usec_t timeout_warn_usec,
|
||||
const char *cmd, char **envp, const sigset_t *sigmask,
|
||||
char *result, size_t ressize) {
|
||||
struct udev *udev = event->udev;
|
||||
@@ -730,7 +749,7 @@ int udev_event_spawn(struct udev_event *event,
|
||||
outpipe[READ_END], errpipe[READ_END],
|
||||
result, ressize);
|
||||
|
||||
- err = spawn_wait(event, timeout_usec, cmd, pid);
|
||||
+ err = spawn_wait(event, timeout_usec, timeout_warn_usec, cmd, pid);
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -769,6 +788,7 @@ static int rename_netif(struct udev_event *event) {
|
||||
|
||||
void udev_event_execute_rules(struct udev_event *event,
|
||||
usec_t timeout_usec,
|
||||
+ usec_t timeout_warn_usec,
|
||||
struct udev_rules *rules, const sigset_t *sigmask) {
|
||||
struct udev_device *dev = event->dev;
|
||||
|
||||
@@ -783,7 +803,7 @@ void udev_event_execute_rules(struct udev_event *event,
|
||||
if (major(udev_device_get_devnum(dev)) != 0)
|
||||
udev_watch_end(event->udev, dev);
|
||||
|
||||
- udev_rules_apply_to_event(rules, event, timeout_usec, sigmask);
|
||||
+ udev_rules_apply_to_event(rules, event, timeout_usec, timeout_warn_usec, sigmask);
|
||||
|
||||
if (major(udev_device_get_devnum(dev)) != 0)
|
||||
udev_node_remove(dev);
|
||||
@@ -816,7 +836,7 @@ void udev_event_execute_rules(struct udev_event *event,
|
||||
}
|
||||
}
|
||||
|
||||
- udev_rules_apply_to_event(rules, event, timeout_usec, sigmask);
|
||||
+ udev_rules_apply_to_event(rules, event, timeout_usec, timeout_warn_usec, sigmask);
|
||||
|
||||
/* rename a new network interface, if needed */
|
||||
if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") &&
|
||||
@@ -889,7 +909,7 @@ void udev_event_execute_rules(struct udev_event *event,
|
||||
}
|
||||
}
|
||||
|
||||
-void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask) {
|
||||
+void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, const sigset_t *sigmask) {
|
||||
struct udev_list_entry *list_entry;
|
||||
|
||||
udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) {
|
||||
@@ -912,7 +932,7 @@ void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const
|
||||
|
||||
udev_event_apply_format(event, cmd, program, sizeof(program));
|
||||
envp = udev_device_get_properties_envp(event->dev);
|
||||
- udev_event_spawn(event, timeout_usec, program, envp, sigmask, NULL, 0);
|
||||
+ udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git src/udev/udev-rules.c src/udev/udev-rules.c
|
||||
index 9514dde..db95442 100644
|
||||
--- src/udev/udev-rules.c
|
||||
+++ src/udev/udev-rules.c
|
||||
@@ -615,6 +615,7 @@ static int import_file_into_properties(struct udev_device *dev, const char *file
|
||||
|
||||
static int import_program_into_properties(struct udev_event *event,
|
||||
usec_t timeout_usec,
|
||||
+ usec_t timeout_warn_usec,
|
||||
const char *program, const sigset_t *sigmask) {
|
||||
struct udev_device *dev = event->dev;
|
||||
char **envp;
|
||||
@@ -623,7 +624,7 @@ static int import_program_into_properties(struct udev_event *event,
|
||||
int err;
|
||||
|
||||
envp = udev_device_get_properties_envp(dev);
|
||||
- err = udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result));
|
||||
+ err = udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, result, sizeof(result));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1862,6 +1863,7 @@ enum escape_type {
|
||||
int udev_rules_apply_to_event(struct udev_rules *rules,
|
||||
struct udev_event *event,
|
||||
usec_t timeout_usec,
|
||||
+ usec_t timeout_warn_usec,
|
||||
const sigset_t *sigmask) {
|
||||
struct token *cur;
|
||||
struct token *rule;
|
||||
@@ -2070,7 +2072,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
|
||||
rules_str(rules, rule->rule.filename_off),
|
||||
rule->rule.filename_line);
|
||||
|
||||
- if (udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)) < 0) {
|
||||
+ if (udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, result, sizeof(result)) < 0) {
|
||||
if (cur->key.op != OP_NOMATCH)
|
||||
goto nomatch;
|
||||
} else {
|
||||
@@ -2106,7 +2108,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
|
||||
rules_str(rules, rule->rule.filename_off),
|
||||
rule->rule.filename_line);
|
||||
|
||||
- if (import_program_into_properties(event, timeout_usec, import, sigmask) != 0)
|
||||
+ if (import_program_into_properties(event, timeout_usec, timeout_warn_usec, import, sigmask) != 0)
|
||||
if (cur->key.op != OP_NOMATCH)
|
||||
goto nomatch;
|
||||
break;
|
||||
diff --git src/udev/udev.h src/udev/udev.h
|
||||
index ed01da3..765ba9e 100644
|
||||
--- src/udev/udev.h
|
||||
+++ src/udev/udev.h
|
||||
@@ -73,7 +73,8 @@ struct udev_rules;
|
||||
struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names);
|
||||
struct udev_rules *udev_rules_unref(struct udev_rules *rules);
|
||||
bool udev_rules_check_timestamp(struct udev_rules *rules);
|
||||
-int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask);
|
||||
+int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec,
|
||||
+ const sigset_t *sigmask);
|
||||
int udev_rules_apply_static_dev_perms(struct udev_rules *rules);
|
||||
|
||||
/* udev-event.c */
|
||||
@@ -84,10 +85,12 @@ int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string,
|
||||
char *result, size_t maxsize, int read_value);
|
||||
int udev_event_spawn(struct udev_event *event,
|
||||
usec_t timeout_usec,
|
||||
+ usec_t timeout_warn_usec,
|
||||
const char *cmd, char **envp, const sigset_t *sigmask,
|
||||
char *result, size_t ressize);
|
||||
-void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, struct udev_rules *rules, const sigset_t *sigset);
|
||||
-void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigset);
|
||||
+void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec,
|
||||
+ struct udev_rules *rules, const sigset_t *sigset);
|
||||
+void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, const sigset_t *sigset);
|
||||
int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]);
|
||||
|
||||
/* udev-watch.c */
|
||||
diff --git src/udev/udevadm-test.c src/udev/udevadm-test.c
|
||||
index 809adb6..4738b61 100644
|
||||
--- src/udev/udevadm-test.c
|
||||
+++ src/udev/udevadm-test.c
|
||||
@@ -136,7 +136,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
- udev_event_execute_rules(event, 60 * USEC_PER_SEC, rules, &sigmask_orig);
|
||||
+ udev_event_execute_rules(event, 60 * USEC_PER_SEC, 20 * USEC_PER_SEC, rules, &sigmask_orig);
|
||||
|
||||
udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev))
|
||||
printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry));
|
||||
--- src/udev/udevd.c
|
||||
+++ src/udev/udevd.c 2014-09-16 09:01:14.382735997 +0000
|
||||
@@ -75,6 +75,7 @@ static int children;
|
||||
static int children_max;
|
||||
static int exec_delay;
|
||||
static usec_t event_timeout_usec = 180 * USEC_PER_SEC;
|
||||
+static usec_t event_timeout_warn_usec = 180 * USEC_PER_SEC / 3;
|
||||
static sigset_t sigmask_orig;
|
||||
static UDEV_LIST(event_list);
|
||||
static UDEV_LIST(worker_list);
|
||||
@@ -129,6 +130,7 @@ struct worker {
|
||||
enum worker_state state;
|
||||
struct event *event;
|
||||
usec_t event_start_usec;
|
||||
+ bool event_warned;
|
||||
};
|
||||
|
||||
/* passed from worker to main process */
|
||||
@@ -314,9 +316,9 @@ static void worker_new(struct event *eve
|
||||
}
|
||||
|
||||
/* apply rules, create node, symlinks */
|
||||
- udev_event_execute_rules(udev_event, event_timeout_usec, rules, &sigmask_orig);
|
||||
+ udev_event_execute_rules(udev_event, event_timeout_usec, event_timeout_warn_usec, rules, &sigmask_orig);
|
||||
|
||||
- udev_event_execute_run(udev_event, event_timeout_usec, &sigmask_orig);
|
||||
+ udev_event_execute_run(udev_event, event_timeout_usec, event_timeout_warn_usec, &sigmask_orig);
|
||||
|
||||
/* apply/restore inotify watch */
|
||||
if (udev_event->inotify_watch) {
|
||||
@@ -410,6 +412,7 @@ out:
|
||||
worker->pid = pid;
|
||||
worker->state = WORKER_RUNNING;
|
||||
worker->event_start_usec = now(CLOCK_MONOTONIC);
|
||||
+ worker->event_warned = false;
|
||||
worker->event = event;
|
||||
event->state = EVENT_RUNNING;
|
||||
udev_list_node_append(&worker->node, &worker_list);
|
||||
@@ -441,6 +444,7 @@ static void event_run(struct event *even
|
||||
worker->event = event;
|
||||
worker->state = WORKER_RUNNING;
|
||||
worker->event_start_usec = now(CLOCK_MONOTONIC);
|
||||
+ worker->event_warned = false;
|
||||
event->state = EVENT_RUNNING;
|
||||
return;
|
||||
}
|
||||
@@ -1016,6 +1020,7 @@ static void kernel_cmdline_options(struc
|
||||
exec_delay = strtoul(opt + 16, NULL, 0);
|
||||
} else if (startswith(opt, "udev.event-timeout=")) {
|
||||
event_timeout_usec = strtoul(opt + 16, NULL, 0) * USEC_PER_SEC;
|
||||
+ event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1;
|
||||
}
|
||||
|
||||
free(s);
|
||||
@@ -1078,6 +1083,7 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
case 't':
|
||||
event_timeout_usec = strtoul(optarg, NULL, 0) * USEC_PER_SEC;
|
||||
+ event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1;
|
||||
break;
|
||||
case 'D':
|
||||
debug = true;
|
||||
@@ -1413,21 +1419,29 @@ int main(int argc, char *argv[]) {
|
||||
/* check for hanging events */
|
||||
udev_list_node_foreach(loop, &worker_list) {
|
||||
struct worker *worker = node_to_worker(loop);
|
||||
+ usec_t ts;
|
||||
|
||||
if (worker->state != WORKER_RUNNING)
|
||||
continue;
|
||||
|
||||
- if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > event_timeout_usec) {
|
||||
- log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath);
|
||||
- kill(worker->pid, SIGKILL);
|
||||
- worker->state = WORKER_KILLED;
|
||||
-
|
||||
- /* drop reference taken for state 'running' */
|
||||
- worker_unref(worker);
|
||||
- log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath);
|
||||
- worker->event->exitcode = -64;
|
||||
- event_queue_delete(worker->event);
|
||||
- worker->event = NULL;
|
||||
+ ts = now(CLOCK_MONOTONIC);
|
||||
+
|
||||
+ if ((ts - worker->event_start_usec) > event_timeout_warn_usec) {
|
||||
+ if ((ts - worker->event_start_usec) > event_timeout_usec) {
|
||||
+ log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath);
|
||||
+ kill(worker->pid, SIGKILL);
|
||||
+ worker->state = WORKER_KILLED;
|
||||
+
|
||||
+ /* drop reference taken for state 'running' */
|
||||
+ worker_unref(worker);
|
||||
+ log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath);
|
||||
+ worker->event->exitcode = -64;
|
||||
+ event_queue_delete(worker->event);
|
||||
+ worker->event = NULL;
|
||||
+ } else if (!worker->event_warned) {
|
||||
+ log_warning("worker [%u] %s is taking a long time", worker->pid, worker->event->devpath);
|
||||
+ worker->event_warned = true;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.7.9.2
|
||||
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 16 09:10:52 UTC 2014 - werner@suse.de
|
||||
|
||||
- Add upstream patches for udev
|
||||
1068-udev-net_setup_link-export-the-.link-filename-applie.patch
|
||||
1069-rules-net-setup-link-preserve-ID_NET_LINK_FILE-and-I.patch
|
||||
1070-rules-net-setup-link-remove-stray-linebreak.patch
|
||||
1071-udev-import-the-full-db-on-MOVE-events-for-devices-w.patch
|
||||
1072-udev-netif_rename-don-t-log-to-kmsg.patch
|
||||
1073-udev-drop-print_kmsg.patch
|
||||
1074-udev-fix-copy-paste-error-in-log-message.patch
|
||||
1075-udev-timeout-increase-timeout.patch
|
||||
1076-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Sep 13 13:35:33 UTC 2014 - rmilasan@suse.com
|
||||
|
||||
|
27
systemd.spec
27
systemd.spec
@ -970,6 +970,24 @@ Patch1065: 1065-udev-bump-event-timeout-to-60-seconds.patch
|
||||
Patch1066: 1066-udev-add-compatibility-links-for-truncated-by-id-links.patch
|
||||
# PATCH-FIX-UPSTREAM 1067-udev-always-resolve-correctly-database-names-on-chan.patch (bnc#864745)
|
||||
Patch1067: 1067-udev-always-resolve-correctly-database-names-on-chan.patch
|
||||
# PATCH-FIX-UPSTREAM 1068-udev-net_setup_link-export-the-.link-filename-applie.patch
|
||||
Patch1068: 1068-udev-net_setup_link-export-the-.link-filename-applie.patch
|
||||
# PATCH-FIX-UPSTREAM 1069-rules-net-setup-link-preserve-ID_NET_LINK_FILE-and-I.patch
|
||||
Patch1069: 1069-rules-net-setup-link-preserve-ID_NET_LINK_FILE-and-I.patch
|
||||
# PATCH-FIX-UPSTREAM 1070-rules-net-setup-link-remove-stray-linebreak.patch
|
||||
Patch1070: 1070-rules-net-setup-link-remove-stray-linebreak.patch
|
||||
# PATCH-FIX-UPSTREAM 1071-udev-import-the-full-db-on-MOVE-events-for-devices-w.patch
|
||||
Patch1071: 1071-udev-import-the-full-db-on-MOVE-events-for-devices-w.patch
|
||||
# PATCH-FIX-UPSTREAM 1072-udev-netif_rename-don-t-log-to-kmsg.patch
|
||||
Patch1072: 1072-udev-netif_rename-don-t-log-to-kmsg.patch
|
||||
# PATCH-FIX-UPSTREAM 1073-udev-drop-print_kmsg.patch
|
||||
Patch1073: 1073-udev-drop-print_kmsg.patch
|
||||
# PATCH-FIX-UPSTREAM 1074-udev-fix-copy-paste-error-in-log-message.patch
|
||||
Patch1074: 1074-udev-fix-copy-paste-error-in-log-message.patch
|
||||
# PATCH-FIX-UPSTREAM 1075-udev-timeout-increase-timeout.patch
|
||||
Patch1075: 1075-udev-timeout-increase-timeout.patch
|
||||
# PATCH-FIX-UPSTREAM 1076-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch
|
||||
Patch1076: 1076-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch
|
||||
|
||||
%description
|
||||
Systemd is a system and service manager, compatible with SysV and LSB
|
||||
@ -1624,6 +1642,15 @@ cp %{SOURCE7} m4/
|
||||
%patch1065 -p0
|
||||
%patch1066 -p1
|
||||
%patch1067 -p1
|
||||
%patch1068 -p0
|
||||
%patch1069 -p0
|
||||
%patch1070 -p0
|
||||
%patch1071 -p0
|
||||
%patch1072 -p0
|
||||
%patch1073 -p0
|
||||
%patch1074 -p0
|
||||
%patch1075 -p0
|
||||
%patch1076 -p0
|
||||
|
||||
# remove patch backups
|
||||
find -name '*.orig' -exec rm -f '{}' \+
|
||||
|
Loading…
Reference in New Issue
Block a user