teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0562-udev-run-link_update-with-increased-retry-count-in-s.patch

b677e7
From 1f3165bda13c8572c8c31d23c998835c4e2ad8f3 Mon Sep 17 00:00:00 2001
b677e7
From: Michal Sekletar <msekleta@redhat.com>
b677e7
Date: Thu, 4 Mar 2021 17:35:22 +0100
b677e7
Subject: [PATCH] udev: run link_update() with increased retry count in second
b677e7
 invocation
b677e7
b677e7
In PR #17431 we have introduced retry loop in link_update() in order to
b677e7
maximize the chance that we end up with correct target when there are
b677e7
multiple contenders for given symlink.
b677e7
b677e7
Number of iterations in retry loop is either 1 or
b677e7
LINK_UPDATE_MAX_RETRIES, depending on the value of 'initialized' db
b677e7
flag. When device appears for the first time we need to set the
b677e7
flag before calling link_update() via update_devnode() for the second
b677e7
time to make sure we run the second invocation with higher retry loop
b677e7
counter.
b677e7
b677e7
(cherry picked from commit 996c83903da5bf8b371314b4207ff97afeef65a4)
b677e7
b677e7
Related: #1931947
b677e7
---
b677e7
 src/udev/udev-event.c | 3 +--
b677e7
 1 file changed, 1 insertion(+), 2 deletions(-)
b677e7
b677e7
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
b677e7
index 9004634f65..eaec05523b 100644
b677e7
--- a/src/udev/udev-event.c
b677e7
+++ b/src/udev/udev-event.c
b677e7
@@ -934,14 +934,13 @@ void udev_event_execute_rules(struct udev_event *event,
b677e7
                 /* (re)write database file */
b677e7
                 udev_device_tag_index(dev, event->dev_db, true);
b677e7
                 udev_device_update_db(dev);
b677e7
+                udev_device_set_is_initialized(dev);
b677e7
 
b677e7
                 /* Yes, we run update_devnode() twice, because in the first invocation, that is before update of udev database,
b677e7
                  * it could happen that two contenders are replacing each other's symlink. Hence we run it again to make sure
b677e7
                  * symlinks point to devices that claim them with the highest priority. */
b677e7
                 update_devnode(event);
b677e7
 
b677e7
-                udev_device_set_is_initialized(dev);
b677e7
-
b677e7
                 event->dev_db = udev_device_unref(event->dev_db);
b677e7
         }
b677e7
 }