dryang / rpms / systemd

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