]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: downgrade message when we fail to set inotify watch up
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 13 Nov 2018 13:53:04 +0000 (14:53 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 13 Nov 2018 21:02:55 +0000 (22:02 +0100)
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.

src/udev/udev-watch.c
src/udev/udevd.c

index cf2faa0831f1de7ba313a2f9bb230402153bed8f..3f8715709a5eccfdd8df040351c9e31ae62d3e1d 100644 (file)
@@ -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);
 
index 05030dc81e6eab866141bb4c7d1c9f8ed3d7fe9a..354910e684b4ae064eb7fe219dd437f43af45310 100644 (file)
@@ -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);
                         }