diff options
author | Tom Gundersen <teg@jklm.no> | 2015-03-11 15:41:32 +0100 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-03-18 20:43:21 -0400 |
commit | 16ded2181496dbacd26229441abd59c224b2ba7a (patch) | |
tree | 68553723412891679fbac3aeb8601251917e5632 /src/udev/udevd.c | |
parent | f5d1fa66a17a61fb689a77fc21808bd54e93fd7c (diff) |
udevd: improve handling of failed worker
The information in the db is stale, so it does not make sense to
expose it any longer. Also, don't drop the kernel event, but simply
pass it on to userspace without ammending it.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r-- | src/udev/udevd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 238d79b969..10222eb1be 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -87,6 +87,7 @@ struct event { struct udev_list_node node; struct udev *udev; struct udev_device *dev; + struct udev_device *dev_kernel; enum event_state state; int exitcode; unsigned long long int delaying_seqnum; @@ -137,6 +138,7 @@ static inline struct worker *node_to_worker(struct udev_list_node *node) { static void event_queue_delete(struct event *event) { udev_list_node_remove(&event->node); udev_device_unref(event->dev); + udev_device_unref(event->dev_kernel); free(event); } @@ -455,6 +457,8 @@ static int event_queue_insert(struct udev_device *dev) { event->udev = udev_device_get_udev(dev); event->dev = dev; + event->dev_kernel = udev_device_shallow_clone(dev); + udev_device_copy_properties(event->dev_kernel, dev); event->seqnum = udev_device_get_seqnum(dev); event->devpath = udev_device_get_devpath(dev); event->devpath_len = strlen(event->devpath); @@ -882,6 +886,11 @@ static void handle_signal(struct udev *udev, int signo) { log_error("worker ["PID_FMT"] failed while handling '%s'", pid, worker->event->devpath); worker->event->exitcode = -32; + /* delete state from disk */ + udev_device_delete_db(worker->event->dev); + udev_device_tag_index(worker->event->dev, NULL, false); + /* forward kernel event without ammending it */ + udev_monitor_send_device(monitor, NULL, worker->event->dev_kernel); event_queue_delete(worker->event); /* drop reference taken for state 'running' */ |