daandemeyer / rpms / systemd

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