[PATCH 11/18] misc: storage-by-uuid: consider only first diskuuid match
Marco Felsch
m.felsch at pengutronix.de
Mon Apr 14 03:24:54 PDT 2025
On 25-04-14, Ahmad Fatoum wrote:
> Multiple devices with the same disk UUID shouldn't happen and if it
Do we need to print a warning to inform the user that two disks share
the same disk-UUID?
Regards,
Marco
> does, the existing code is not equipped to handle that.
>
> Change it, so only the first _disk_ is considered. diskuuid is in a
> union with partuuid and that could lead to cdev partition being taken as
> backend storage instead.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> drivers/misc/storage-by-uuid.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/misc/storage-by-uuid.c b/drivers/misc/storage-by-uuid.c
> index 8b8fd901685e..7bb987dffbec 100644
> --- a/drivers/misc/storage-by-uuid.c
> +++ b/drivers/misc/storage-by-uuid.c
> @@ -143,10 +143,14 @@ static void check_exist(struct sbu *sbu)
> struct cdev *cdev;
>
> for_each_cdev(cdev) {
> - if (!strcmp(cdev->diskuuid, sbu->uuid)) {
> - dev_dbg(sbu->dev, "Found %s %s\n", cdev->name, cdev->diskuuid);
> - storage_by_uuid_add_partitions(sbu, cdev);
> - }
> + if (cdev_is_partition(cdev))
> + continue;
> + if (strcmp(cdev->diskuuid, sbu->uuid))
> + continue;
> +
> + dev_dbg(sbu->dev, "Found %s %s\n", cdev->name, cdev->diskuuid);
> + storage_by_uuid_add_partitions(sbu, cdev);
> + return;
> }
> }
>
> --
> 2.39.5
>
>
>
More information about the barebox
mailing list