1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-21 02:50:18 +03:00

udev: several improvements for debugging logs (#36357)

This commit is contained in:
Daan De Meyer 2025-02-12 14:35:46 +01:00 committed by GitHub
commit 7ee5b95f6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -161,13 +161,13 @@ static int udev_watch_clear(sd_device *dev, int dirfd, int *ret_wd) {
if (ret_wd)
*ret_wd = wd;
r = 0;
r = 1;
finalize:
/* 5. remove symlink ID -> wd.
* The file is always owned by the device. Hence, it is safe to remove it unconditionally. */
if (unlinkat(dirfd, id, 0) < 0 && errno != ENOENT)
log_device_debug_errno(dev, errno, "Failed to remove '/run/udev/watch/%s': %m", id);
log_device_debug_errno(dev, errno, "Failed to remove '/run/udev/watch/%s', ignoring: %m", id);
return r;
}
@ -249,7 +249,7 @@ int udev_watch_end(int inotify_fd, sd_device *dev) {
/* First, clear symlinks. */
r = udev_watch_clear(dev, dirfd, &wd);
if (r < 0)
if (r <= 0)
return r;
/* Then, remove inotify watch. */

View File

@ -124,6 +124,7 @@ static int worker_lock_whole_disk(sd_device *dev, int *ret_fd) {
if (flock(fd, LOCK_SH|LOCK_NB) < 0)
return log_device_debug_errno(dev, errno, "Failed to flock(%s): %m", val);
log_device_debug(dev, "Successfully took flock(LOCK_SH) for %s, it will be released after the event has been processed.", val);
*ret_fd = TAKE_FD(fd);
return 1;