richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
c2dfb7
From 38532765172a4e60624b9c24b8d081b34d9f7b86 Mon Sep 17 00:00:00 2001
c2dfb7
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
c2dfb7
Date: Tue, 13 Nov 2018 14:53:04 +0100
c2dfb7
Subject: [PATCH] udev: downgrade message when we fail to set inotify watch up
c2dfb7
c2dfb7
My logs are full of:
c2dfb7
c2dfb7
systemd-udevd[6586]: seq 13515 queued, 'add' 'block'
c2dfb7
systemd-udevd[6586]: seq 13516 queued, 'change' 'block'
c2dfb7
systemd-udevd[6586]: seq 13517 queued, 'change' 'block'
c2dfb7
systemd-udevd[6586]: seq 13518 queued, 'remove' 'bdi'
c2dfb7
systemd-udevd[6586]: seq 13519 queued, 'remove' 'block'
c2dfb7
systemd-udevd[9865]: seq 13514 processed
c2dfb7
systemd-udevd[9865]: seq 13515 running
c2dfb7
systemd-udevd[9865]: GROUP 6 /usr/lib/udev/rules.d/50-udev-default.rules:59
c2dfb7
systemd-udevd[9865]: IMPORT builtin 'blkid' /usr/lib/udev/rules.d/60-persistent-storage.rules:95
c2dfb7
systemd-udevd[9865]: IMPORT builtin 'blkid' fails: No such file or directory
c2dfb7
systemd-udevd[9865]: loop4: Failed to add device '/dev/loop4' to watch: No such file or directory
c2dfb7
(the last line is at error level).
c2dfb7
If we are too slow to set up a watch and the device is already gone by the time
c2dfb7
we try, this is not an error.
c2dfb7
c2dfb7
(cherry picked from commit 7fe0d0d5c0ad5aa3f069bb282868938d414d7ad1)
c2dfb7
c2dfb7
Resolves: #1808051
c2dfb7
---
c2dfb7
 src/udev/udev-watch.c | 3 ++-
c2dfb7
 1 file changed, 2 insertions(+), 1 deletion(-)
c2dfb7
c2dfb7
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c
c2dfb7
index 7864f57aa5..9c82196add 100644
c2dfb7
--- a/src/udev/udev-watch.c
c2dfb7
+++ b/src/udev/udev-watch.c
c2dfb7
@@ -87,7 +87,8 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) {
c2dfb7
         log_debug("adding watch on '%s'", udev_device_get_devnode(dev));
c2dfb7
         wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
c2dfb7
         if (wd < 0) {
c2dfb7
-                log_error_errno(errno, "inotify_add_watch(%d, %s, %o) failed: %m",
c2dfb7
+                log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_ERR,
c2dfb7
+                               errno, "inotify_add_watch(%d, %s, %o) failed: %m",
c2dfb7
                                 inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
c2dfb7
                 return;
c2dfb7
         }