From: Yu Watanabe Date: Mon, 30 Oct 2023 04:31:23 +0000 (+0900) Subject: udev: update devlink with the newer device node even when priority is equivalent X-Git-Tag: v255-rc1~61^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ec5ce5673d82818448ac36def7e0c7f7ca44805;p=thirdparty%2Fsystemd.git 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 331aa7aa15ee5dd12b369b276f575d521435eb52. Follow-up for 331aa7aa15ee5dd12b369b276f575d521435eb52. 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. --- diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index 6ba38087dcf..e12c26ce5a6 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -467,13 +467,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); }