libmultipath: alua: try to retrieve inquiry data from sysfs
authorMartin Wilck <mwilck@suse.com>
Mon, 18 Mar 2019 11:24:38 +0000 (12:24 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 18 Apr 2019 11:07:17 +0000 (13:07 +0200)
This can avoid IO while configuring the path prioritizer.
The alua prioritizer avoids reading from sysfs for a reason
(see commit 7e2f46d3), but this applies only to RTPG / STPG,
not to INQUIRY calls.

Cc: Steve.Schremmer@netapp.com
Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/prioritizers/alua_rtpg.c

index d9215a8..271a019 100644 (file)
@@ -188,6 +188,23 @@ retry:
 int do_inquiry(const struct path *pp, int evpd, unsigned int codepage,
               void *resp, int resplen, unsigned int timeout)
 {
+       struct udev_device *ud;
+
+       ud = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi",
+                                                          "scsi_device");
+       if (ud != NULL) {
+               int rc;
+
+               if (!evpd)
+                       rc = sysfs_get_inquiry(ud, resp, resplen);
+               else
+                       rc = sysfs_get_vpd(ud, codepage, resp, resplen);
+
+               if (rc >= 0) {
+                       PRINT_HEX((unsigned char *) resp, resplen);
+                       return 0;
+               }
+       }
        return do_inquiry_sg(pp->fd, evpd, codepage, resp, resplen, timeout);
 }