From: Bart Van Assche <bart.vanassche@wdc.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: Bart Van Assche <bart.vanassche@wdc.com>, dm-devel@redhat.com
Subject: [PATCH 5/6] libmultipath: Fix sgio_get_vpd()
Date: Thu, 1 Mar 2018 11:29:34 -0800 [thread overview]
Message-ID: <20180301192935.14643-6-bart.vanassche@wdc.com> (raw)
In-Reply-To: <20180301192935.14643-1-bart.vanassche@wdc.com>
Pass the VPD page number to sgio_get_vpd() such that the page needed
by the caller is queried instead of page 0x83. Fix the statement that
computes the length of the page returned by do_inq(). Fix the return
code check in the caller of sgio_get_vpd().
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
libmultipath/discovery.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index d84715e15db1..780feb253797 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -836,8 +836,9 @@ detect_alua(struct path * pp, struct config *conf)
#define DEFAULT_SGIO_LEN 254
+/* Query VPD page @pg. Returns 0 upon success and -1 upon failure. */
static int
-sgio_get_vpd (unsigned char * buff, int maxlen, int fd)
+sgio_get_vpd (unsigned char * buff, int maxlen, int fd, int pg)
{
int len = DEFAULT_SGIO_LEN;
@@ -846,8 +847,8 @@ sgio_get_vpd (unsigned char * buff, int maxlen, int fd)
return -1;
}
retry:
- if (0 == do_inq(fd, 0, 1, 0x83, buff, len)) {
- len = buff[3] + (buff[2] << 8);
+ if (0 == do_inq(fd, 0, 1, pg, buff, len)) {
+ len = buff[3] + (buff[2] << 8) + 4;
if (len >= maxlen)
return len;
if (len > DEFAULT_SGIO_LEN)
@@ -1099,7 +1100,7 @@ get_vpd_sgio (int fd, int pg, char * str, int maxlen)
unsigned char buff[4096];
memset(buff, 0x0, 4096);
- if (sgio_get_vpd(buff, 4096, fd) <= 0) {
+ if (sgio_get_vpd(buff, 4096, fd, pg) < 0) {
condlog(3, "failed to issue vpd inquiry for pg%02x",
pg);
return -errno;
--
2.16.2
next prev parent reply other threads:[~2018-03-01 19:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 19:29 [PATCH 0/6] Various multipath-tools patches Bart Van Assche
2018-03-01 19:29 ` [PATCH 1/6] multipathd/main.c: Fix indentation Bart Van Assche
2018-03-05 16:09 ` Martin Wilck
2018-03-01 19:29 ` [PATCH 2/6] libmultipath, alloc_path_with_pathinfo(): Ensure that pp->wwid is '\0'-terminated Bart Van Assche
2018-03-05 16:11 ` Martin Wilck
2018-03-01 19:29 ` [PATCH 3/6] libmultipath, alloc_path_with_pathinfo(): Declare third argument const Bart Van Assche
2018-03-05 16:18 ` Martin Wilck
2018-03-05 16:21 ` Bart Van Assche
2018-03-01 19:29 ` [PATCH 4/6] kpartx: Improve reliability of find_loop_by_file() Bart Van Assche
2018-03-05 18:38 ` Martin Wilck
2018-03-01 19:29 ` Bart Van Assche [this message]
2018-03-05 16:53 ` [PATCH 5/6] libmultipath: Fix sgio_get_vpd() Martin Wilck
2018-03-05 17:09 ` Martin Wilck
2018-03-05 19:14 ` Martin Wilck
2018-03-05 19:18 ` Bart Van Assche
2018-03-05 20:47 ` Martin Wilck
2018-03-05 21:13 ` Bart Van Assche
2018-03-05 23:24 ` Martin Wilck
2018-03-05 23:35 ` Martin Wilck
2018-03-01 19:29 ` [PATCH 6/6] Introduce the ibmultipath/unaligned.h header file Bart Van Assche
2018-03-05 17:18 ` Martin Wilck
2018-03-06 15:25 ` [PATCH 0/6] Various multipath-tools patches Benjamin Marzinski
2018-03-07 9:56 ` Christophe Varoqui
2018-03-08 20:39 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180301192935.14643-6-bart.vanassche@wdc.com \
--to=bart.vanassche@wdc.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox