Skip to content

Commit

Permalink
udev: update devlink with the newer device node even when priority is…
Browse files Browse the repository at this point in the history
… 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)

Resolves: RHEL-33815
  • Loading branch information
yuwata authored and jamacku committed Dec 20, 2024
1 parent 623d77b commit 3b3ba0e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/udev/udev-node.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,13 @@ static int link_update(sd_device *dev, const char *slink, bool add) {
/* The devlink priority is downgraded. Another device may have a higher
* priority now. Let's find the device node with the highest priority. */
} else {
if (current_prio >= prio)
/* The devlink with equal or higher priority already exists and is
* owned by another device. Hence, it is not necessary to recreate it. */
if (current_prio > prio)
/* The devlink with a higher priority already exists and is owned by
* another device. Hence, it is not necessary to recreate it. */
return 0;

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

Expand Down

0 comments on commit 3b3ba0e

Please sign in to comment.