diff options
author | Tom Gundersen <teg@jklm.no> | 2014-09-09 11:15:37 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-09-09 15:30:10 +0200 |
commit | 4c83d994566718043e61e568cc214bdc4587f869 (patch) | |
tree | 19d720648aee971cc588171d887e1bd4dff889db /src/udev/udevd.c | |
parent | b081b27e1433cdc7ac72b25ae8b4db887d79187f (diff) |
udev: event - keep one rtnl per worker, rather than per event
Creating the rtnl context is cheap, but freeing it may not be, due to
synchronous close().
Also drop some excessive logging. We now log about the changing ifname
exactly once.
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r-- | src/udev/udevd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index e72c5b231e..be0acc3177 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -48,6 +48,7 @@ #include "udev.h" #include "udev-util.h" +#include "rtnl-util.h" #include "sd-daemon.h" #include "cgroup-util.h" #include "dev-setup.h" @@ -200,6 +201,7 @@ static void worker_new(struct event *event) { case 0: { struct udev_device *dev = NULL; int fd_monitor; + _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL; struct epoll_event ep_signal, ep_monitor; sigset_t mask; int rc = EXIT_SUCCESS; @@ -301,11 +303,17 @@ static void worker_new(struct event *event) { } } + /* needed for renaming netifs */ + udev_event->rtnl = rtnl; + /* apply rules, create node, symlinks */ udev_event_execute_rules(udev_event, event_timeout_usec, rules, &sigmask_orig); udev_event_execute_run(udev_event, event_timeout_usec, &sigmask_orig); + /* in case rtnl was initialized */ + rtnl = sd_rtnl_ref(udev_event->rtnl); + /* apply/restore inotify watch */ if (udev_event->inotify_watch) { udev_watch_begin(udev, dev); |