[libmultipath] Update discovery to work with new sysfs layout
authorHannes Reinecke <hare@suse.de>
Thu, 20 Mar 2008 22:53:48 +0000 (23:53 +0100)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Thu, 20 Mar 2008 22:53:48 +0000 (23:53 +0100)
With the new sysfs layout the parent device of a block device
it 'block', and only the parent of this is the 'real' parent.

libmultipath/discovery.c

index a85a248..30c36e5 100644 (file)
@@ -550,6 +550,9 @@ sysfs_pathinfo(struct path * pp)
        if (!parent)
                parent = pp->sysdev;
 
+       if (!strncmp(parent->kernel, "block",5))
+               parent = sysfs_device_get_parent(parent);
+
        condlog(3, "%s: subsystem = %s", pp->dev, parent->subsystem);
 
        if (!strncmp(parent->subsystem, "scsi",4))