From 5abee64ed40039404d68414f0189245988635e6c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 26 May 2020 18:58:15 +0200 Subject: [PATCH] udev: when the BSD lock on a block device is taken, don't complain if someone implements https://systemd.io/BLOCK_DEVICE_LOCKING/ then we shouldn't loudly complain about that. This reverts back to the original behaviour from 3ebdb81ef088afd3b4c72b516beb5610f8c93a0d: when the lock is taken we silently skip processing the device and sending out the messages for it. --- src/udev/udevd.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/udev/udevd.c b/src/udev/udevd.c index d3f9d532e18..1d2ef257953 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -443,13 +443,18 @@ static int worker_device_monitor_handler(sd_device_monitor *monitor, sd_device * assert(manager); r = worker_process_device(manager, dev); - if (r < 0) - log_device_warning_errno(dev, r, "Failed to process device, ignoring: %m"); + if (r == -EAGAIN) + /* if we couldn't acquire the flock(), then proceed quietly */ + log_device_debug_errno(dev, r, "Device currently locked, not processing."); + else { + if (r < 0) + log_device_warning_errno(dev, r, "Failed to process device, ignoring: %m"); - /* send processed event back to libudev listeners */ - r = device_monitor_send_device(monitor, NULL, dev); - if (r < 0) - log_device_warning_errno(dev, r, "Failed to send device, ignoring: %m"); + /* send processed event back to libudev listeners */ + r = device_monitor_send_device(monitor, NULL, dev); + if (r < 0) + log_device_warning_errno(dev, r, "Failed to send device, ignoring: %m"); + } /* send udevd the result of the event execution */ r = worker_send_message(manager->worker_watch[WRITE_END]); -- 2.47.3