summaryrefslogtreecommitdiff
path: root/src/udev/udev-event.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/udev-event.c')
-rw-r--r--src/udev/udev-event.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index c613916d18..f40b3120ca 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -997,6 +997,9 @@ int udev_event_execute_rules(
if (action == SD_DEVICE_REMOVE)
return event_execute_rules_on_remove(event, inotify_fd, timeout_usec, timeout_signal, properties_list, rules);
+ /* Disable watch during event processing. */
+ (void) udev_watch_end(inotify_fd, event->dev);
+
r = device_clone_with_db(dev, &event->dev_db_clone);
if (r < 0)
return log_device_debug_errno(dev, r, "Failed to clone sd_device object: %m");
@@ -1005,9 +1008,6 @@ int udev_event_execute_rules(
if (r < 0)
log_device_warning_errno(dev, r, "Failed to copy all tags from old database entry, ignoring: %m");
- /* Disable watch during event processing. */
- (void) udev_watch_end(inotify_fd, event->dev_db_clone);
-
if (action == SD_DEVICE_MOVE) {
r = udev_event_on_move(event->dev);
if (r < 0)
@@ -1083,7 +1083,6 @@ void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec, int timeout_s
int udev_event_process_inotify_watch(UdevEvent *event, int inotify_fd) {
sd_device *dev;
- int r;
assert(event);
assert(inotify_fd >= 0);
@@ -1095,16 +1094,10 @@ int udev_event_process_inotify_watch(UdevEvent *event, int inotify_fd) {
if (device_for_action(dev, SD_DEVICE_REMOVE))
return 0;
- if (!event->inotify_watch) {
+ if (event->inotify_watch)
+ (void) udev_watch_begin(inotify_fd, dev);
+ else
(void) udev_watch_end(inotify_fd, dev);
- return 0;
- }
-
- (void) udev_watch_begin(inotify_fd, dev);
-
- r = device_update_db(dev);
- if (r < 0)
- return log_device_debug_errno(dev, r, "Failed to update database under /run/udev/data/: %m");
return 0;
}