Skip to content

Commit 277cb24

Browse files
yuwatabluca
authored andcommitted
udev: update devlink with the newer device node even when priority is equivalent
Several udev rules depends on the previous behavior, i.e. that udev replaces the devlink with the newer device node when the priority is equivalent. Let's relax the optimization done by 331aa7a. Follow-up for 331aa7a. Note, the offending commit drops O(N) of file reads per uevent, and this commit does not change the computational order. So, hopefully the performance impact of this change is small enough. Fixes #28141. (cherry picked from commit 7ec5ce5)
1 parent 3fba08f commit 277cb24

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/udev/udev-node.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,13 @@ static int link_update(sd_device *dev, const char *slink, bool add) {
468468
/* The devlink priority is downgraded. Another device may have a higher
469469
* priority now. Let's find the device node with the highest priority. */
470470
} else {
471-
if (current_prio >= prio)
472-
/* The devlink with equal or higher priority already exists and is
473-
* owned by another device. Hence, it is not necessary to recreate it. */
471+
if (current_prio > prio)
472+
/* The devlink with a higher priority already exists and is owned by
473+
* another device. Hence, it is not necessary to recreate it. */
474474
return 0;
475475

476-
/* This device has a higher priority than the current. Let's create the
477-
* devlink to our device node. */
476+
/* This device has the equal or a higher priority than the current. Let's
477+
* create the devlink to our device node. */
478478
return node_symlink(dev, NULL, slink);
479479
}
480480

0 commit comments

Comments
 (0)