diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index 1d3d9f1c083..f63a5839d6d 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -147,22 +147,23 @@ int udev_watch_lookup(int wd, sd_device **ret) { assert(ret); if (inotify_fd < 0) - return log_error_errno(EINVAL, "Invalid inotify descriptor."); + return log_debug_errno(EINVAL, "Invalid inotify descriptor."); if (wd < 0) - return log_error_errno(EINVAL, "Invalid watch handle."); + return log_debug_errno(EINVAL, "Invalid watch handle."); xsprintf(filename, "/run/udev/watch/%d", wd); r = readlink_malloc(filename, &device); - if (r < 0) { - if (r != -ENOENT) - return log_error_errno(errno, "Failed to read link '%s': %m", filename); + if (r == -ENOENT) return 0; - } + if (r < 0) + return log_debug_errno(r, "Failed to read link '%s': %m", filename); r = sd_device_new_from_device_id(ret, device); + if (r == -ENODEV) + return 0; if (r < 0) - return log_error_errno(r, "Failed to create sd_device object for '%s': %m", device); + return log_debug_errno(r, "Failed to create sd_device object for '%s': %m", device); - return 0; + return 1; } diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 42c88781868..42a492cc59e 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1169,13 +1169,13 @@ static int on_inotify(sd_event_source *s, int fd, uint32_t revents, void *userda _cleanup_(sd_device_unrefp) sd_device *dev = NULL; const char *devnode; - if (udev_watch_lookup(e->wd, &dev) < 0) + if (udev_watch_lookup(e->wd, &dev) <= 0) continue; if (sd_device_get_devname(dev, &devnode) < 0) continue; - log_debug("inotify event: %x for %s", e->mask, devnode); + log_device_debug(dev, "Inotify event: %x for %s", e->mask, devnode); if (e->mask & IN_CLOSE_WRITE) { synthesize_change(dev);