From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Talbert Date: Wed, 11 Aug 2010 03:05:38 +0000 Subject: Re: Behavior with duplicate UUID's Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Mon, 9 Aug 2010, Kay Sievers wrote: > The behavior is undefined, and can only be controlled with > link_priority= option. > > We can't, and don't want to pretend to make any control over 'the > first one'. In a hotplug world, there is almost never a correct first > one, because everything runs in parallel. I agree with you that if two devices are hotplugged at around the same time, the result would be expectedly unpredictable. However, if you have your root partition (with a symlink established at bootup), and then hours later, you hotplug another device, it would seem to me that the symlink of the older device would be preferable to keep. Right now, the symlink for the original device is removed and a symlink for the new one is added. I propose a slightly different change. This changes the symlink priority processing when the priorities are the same. The oldest symlink is instead preferred, rather than the newest one. --- udev-node.c.orig 2010-05-20 11:06:52.000000000 -0400 +++ udev-node.c 2010-08-10 22:52:53.000000000 -0400 @@ -261,9 +261,10 @@ devnode = udev_device_get_devnode(dev_db); if (devnode != NULL) { - dbg(udev, "compare priority of '%s'(%i) > '%s'(%i)\n", target, priority, - udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db)); - if (target = NULL || udev_device_get_devlink_priority(dev_db) > priority) { + dbg(udev, "compare priority of '%s'(%i) >= '%s'(%i)\n", + udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db), + target, priority); + if (target = NULL || udev_device_get_devlink_priority(dev_db) >= priority) { info(udev, "'%s' claims priority %i for '%s'\n", udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir); priority = udev_device_get_devlink_priority(dev_db); --- Thanks, Scott