diff options
author | Tom Gundersen <teg@jklm.no> | 2015-05-12 16:51:31 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-05-12 17:06:21 +0200 |
commit | a8389097c0cd91720424b25ee5c6825b4f69cb6a (patch) | |
tree | aa3bf5b4e45804d9ff0409194bf3dad1018afc78 /src | |
parent | e82e8fa5b19243177e178ed78c2480505eda5e03 (diff) |
udevd: explicitly read out uevents we create ourselves
Rather than skippling ctrl handling whenever we have handlede inotify events
(and hence may have synthesized a 'change' event), just call the uevent
handling explicitly from on_inotify() so that the event queue is up-to-date.
Diffstat (limited to 'src')
-rw-r--r-- | src/udev/udevd.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 65f4fe6a45..8528f7147b 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -910,9 +910,16 @@ static int on_inotify(sd_event_source *s, int fd, uint32_t revents, void *userda continue; log_debug("inotify event: %x for %s", e->mask, udev_device_get_devnode(dev)); - if (e->mask & IN_CLOSE_WRITE) + if (e->mask & IN_CLOSE_WRITE) { synthesize_change(dev); - else if (e->mask & IN_IGNORED) + + /* settle might be waiting on us to determine the queue + * state. If we just handled an inotify event, we might have + * generated a "change" event, but we won't have queued up + * the resultant uevent yet. Do that. + */ + on_uevent(NULL, -1, 0, monitor); + } else if (e->mask & IN_IGNORED) udev_watch_end(udev, dev); } @@ -1565,22 +1572,9 @@ int main(int argc, char *argv[]) { continue; /* device node watch */ - if (is_inotify) { + if (is_inotify) on_inotify(NULL, fd_inotify, 0, udev); - /* - * settle might be waiting on us to determine the queue - * state. If we just handled an inotify event, we might have - * generated a "change" event, but we won't have queued up - * the resultant uevent yet. - * - * Before we go ahead and potentially tell settle that the - * queue is empty, lets loop one more time to update the - * queue state again before deciding. - */ - continue; - } - /* tell settle that we are busy or idle, this needs to be before the * PING handling */ |