Re: [PATCH 5/6] libmultipath: Fix sgio_get_vpd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2018-03-01 at 11:29 -0800, Bart Van Assche wrote:
> 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@xxxxxxx>
> ---

Bart, thanks for the patch. Please consider rebasing your work on my
previously submitted patches which have already been positively
reviewed ([1], [2]):

 libmultipath: get_vpd_sgio: support VPD 0xc9
 libmultipath: sgio_get_vpd: add page argument
 libmultipath: fix return code of sgio_get_vpd()

Otherwise, ACK.

[1] https://www.redhat.com/archives/dm-devel/2018-January/msg00241.html
[2] https://www.redhat.com/archives/dm-devel/2018-January/msg00370.html

Martin

>  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;


-- 
Dr. Martin Wilck <mwilck@xxxxxxxx>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux