From 995e08e3de9aaff81e72227587ffcb4cc78175d0 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Tue, 24 Sep 2013 17:31:50 +0800 Subject: discover: Check for devices with duplicate serial properties If we have multipath devices present in the system, we'll end up with duplicate mounts, parse results and boot options. This change adds a check to see if we've encountered a device with this serial number previously. Signed-off-by: Jeremy Kerr --- discover/udev.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'discover/udev.c') diff --git a/discover/udev.c b/discover/udev.c index 1c5cf71..e996e22 100644 --- a/discover/udev.c +++ b/discover/udev.c @@ -70,6 +70,7 @@ static int udev_handle_dev_add(struct pb_udev *udev, struct udev_device *dev) { struct discover_device *ddev; const char *typestr; + const char *serial; const char *path; const char *name; @@ -104,6 +105,12 @@ static int udev_handle_dev_add(struct pb_udev *udev, struct udev_device *dev) return -1; } + /* we may also see multipath devices; same dev nodes (hence id), but + * different serial numbers */ + serial = udev_device_get_property_value(dev, "ID_SERIAL"); + if (serial && device_lookup_by_serial(udev->handler, serial)) + return -1; + ddev = discover_device_create(udev->handler, name); ddev->device_path = udev_device_get_devnode(dev); -- cgit v1.2.1