From: Zbigniew Jędrzejewski-Szmek Date: Tue, 13 Nov 2018 13:53:04 +0000 (+0100) Subject: udev: downgrade message when we fail to set inotify watch up X-Git-Tag: v240~336 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fe0d0d5c0ad5aa3f069bb282868938d414d7ad1;p=thirdparty%2Fsystemd.git udev: downgrade message when we fail to set inotify watch up My logs are full of: systemd-udevd[6586]: seq 13515 queued, 'add' 'block' systemd-udevd[6586]: seq 13516 queued, 'change' 'block' systemd-udevd[6586]: seq 13517 queued, 'change' 'block' systemd-udevd[6586]: seq 13518 queued, 'remove' 'bdi' systemd-udevd[6586]: seq 13519 queued, 'remove' 'block' systemd-udevd[9865]: seq 13514 processed systemd-udevd[9865]: seq 13515 running systemd-udevd[9865]: GROUP 6 /usr/lib/udev/rules.d/50-udev-default.rules:59 systemd-udevd[9865]: IMPORT builtin 'blkid' /usr/lib/udev/rules.d/60-persistent-storage.rules:95 systemd-udevd[9865]: IMPORT builtin 'blkid' fails: No such file or directory systemd-udevd[9865]: loop4: Failed to add device '/dev/loop4' to watch: No such file or directory (the last line is at error level). If we are too slow to set up a watch and the device is already gone by the time we try, this is not an error. --- diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index cf2faa0831f..3f8715709a5 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -95,7 +95,10 @@ int udev_watch_begin(sd_device *dev) { log_device_debug(dev, "Adding watch on '%s'", devnode); wd = inotify_add_watch(inotify_fd, devnode, IN_CLOSE_WRITE); if (wd < 0) - return log_device_error_errno(dev, errno, "Failed to add device '%s' to watch: %m", devnode); + return log_device_full(dev, + errno == ENOENT ? LOG_DEBUG : LOG_ERR, + errno, + "Failed to add device '%s' to watch: %m", devnode); device_set_watch_handle(dev, wd); diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 05030dc81e6..354910e684b 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -456,7 +456,7 @@ static void worker_spawn(Manager *manager, struct event *event) { /* apply/restore inotify watch */ if (udev_event->inotify_watch) { - udev_watch_begin(dev->device); + (void) udev_watch_begin(dev->device); udev_device_update_db(dev); }