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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-11-13 14:53:04 +01:00 committed by Lennart Poettering
parent 8724defeae
commit 7fe0d0d5c0
2 changed files with 5 additions and 2 deletions

View 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);

View 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);
}