anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0353-udev-downgrade-message-when-we-fail-to-set-inotify-w.patch

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