96 lines
2.7 KiB
Diff
96 lines
2.7 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Martin Wilck <mwilck@suse.com>
|
||
|
Date: Wed, 6 Jul 2022 15:57:21 +0200
|
||
|
Subject: [PATCH] libmultipath: alua: remove get_sysfs_pg83()
|
||
|
|
||
|
Since b72e753 ("libmultipath: alua: try to retrieve inquiry data from sysfs"),
|
||
|
we fetch inquiry and VPD data from sysfs anyway. No need to do this twice.
|
||
|
|
||
|
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||
|
|
||
|
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
---
|
||
|
libmultipath/prioritizers/alua_rtpg.c | 57 ++++++++-------------------
|
||
|
1 file changed, 16 insertions(+), 41 deletions(-)
|
||
|
|
||
|
diff --git a/libmultipath/prioritizers/alua_rtpg.c b/libmultipath/prioritizers/alua_rtpg.c
|
||
|
index 3f9c0e73..4db13c20 100644
|
||
|
--- a/libmultipath/prioritizers/alua_rtpg.c
|
||
|
+++ b/libmultipath/prioritizers/alua_rtpg.c
|
||
|
@@ -228,25 +228,6 @@ get_target_port_group_support(const struct path *pp, unsigned int timeout)
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
-static int
|
||
|
-get_sysfs_pg83(const struct path *pp, unsigned char *buff, int buflen)
|
||
|
-{
|
||
|
- struct udev_device *parent = pp->udev;
|
||
|
-
|
||
|
- while (parent) {
|
||
|
- const char *subsys = udev_device_get_subsystem(parent);
|
||
|
- if (subsys && !strncmp(subsys, "scsi", 4))
|
||
|
- break;
|
||
|
- parent = udev_device_get_parent(parent);
|
||
|
- }
|
||
|
-
|
||
|
- if (!parent || sysfs_get_vpd(parent, 0x83, buff, buflen) <= 0) {
|
||
|
- PRINT_DEBUG("failed to read sysfs vpd pg83");
|
||
|
- return -1;
|
||
|
- }
|
||
|
- return 0;
|
||
|
-}
|
||
|
-
|
||
|
int
|
||
|
get_target_port_group(const struct path * pp, unsigned int timeout)
|
||
|
{
|
||
|
@@ -265,32 +246,26 @@ get_target_port_group(const struct path * pp, unsigned int timeout)
|
||
|
}
|
||
|
|
||
|
memset(buf, 0, buflen);
|
||
|
+ rc = do_inquiry(pp, 1, 0x83, buf, buflen, timeout);
|
||
|
+ if (rc < 0)
|
||
|
+ goto out;
|
||
|
|
||
|
- rc = get_sysfs_pg83(pp, buf, buflen);
|
||
|
-
|
||
|
- if (rc < 0) {
|
||
|
+ scsi_buflen = get_unaligned_be16(&buf[2]) + 4;
|
||
|
+ if (scsi_buflen >= USHRT_MAX)
|
||
|
+ scsi_buflen = USHRT_MAX;
|
||
|
+ if (buflen < scsi_buflen) {
|
||
|
+ free(buf);
|
||
|
+ buf = (unsigned char *)malloc(scsi_buflen);
|
||
|
+ if (!buf) {
|
||
|
+ PRINT_DEBUG("malloc failed: could not allocate"
|
||
|
+ "%u bytes", scsi_buflen);
|
||
|
+ return -RTPG_RTPG_FAILED;
|
||
|
+ }
|
||
|
+ buflen = scsi_buflen;
|
||
|
+ memset(buf, 0, buflen);
|
||
|
rc = do_inquiry(pp, 1, 0x83, buf, buflen, timeout);
|
||
|
if (rc < 0)
|
||
|
goto out;
|
||
|
-
|
||
|
- scsi_buflen = get_unaligned_be16(&buf[2]) + 4;
|
||
|
- /* Paranoia */
|
||
|
- if (scsi_buflen >= USHRT_MAX)
|
||
|
- scsi_buflen = USHRT_MAX;
|
||
|
- if (buflen < scsi_buflen) {
|
||
|
- free(buf);
|
||
|
- buf = (unsigned char *)malloc(scsi_buflen);
|
||
|
- if (!buf) {
|
||
|
- PRINT_DEBUG("malloc failed: could not allocate"
|
||
|
- "%u bytes", scsi_buflen);
|
||
|
- return -RTPG_RTPG_FAILED;
|
||
|
- }
|
||
|
- buflen = scsi_buflen;
|
||
|
- memset(buf, 0, buflen);
|
||
|
- rc = do_inquiry(pp, 1, 0x83, buf, buflen, timeout);
|
||
|
- if (rc < 0)
|
||
|
- goto out;
|
||
|
- }
|
||
|
}
|
||
|
|
||
|
vpd83 = (struct vpd83_data *) buf;
|