All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmultipath: fix discovery of devices with sysfs attr containing only spaces
@ 2015-04-11 15:18 Mauricio Faria de Oliveira
  2015-04-11 15:33 ` Mauricio Faria de Oliveira
  2015-04-22 11:41 ` Mauricio Faria de Oliveira
  0 siblings, 2 replies; 3+ messages in thread
From: Mauricio Faria de Oliveira @ 2015-04-11 15:18 UTC (permalink / raw)
  To: dm-devel

commit 43c61e979521b17d9f50ea8e722682c33d0b7d69 causes sysfs_get_<attr>() to
return 0 if attr contains only spaces, and scsi_sysfs_pathinfo() to return 1
in 'if (sysfs_get_<attr>() <= 0)'; this breaks the device's discovery.

Changing the comparison operator '<=' to '<' allows discovery to continue.

This affects some IPR controllers (rev sysfs attr):

	# grep . /sys/block/sda/device/{vendor,model,rev} | tr ' ' '#'
	/sys/block/sda/device/vendor:IBM#####
	/sys/block/sda/device/model:IPR-0###5EC99A00
	/sys/block/sda/device/rev:####

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
 libmultipath/discovery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 4582a20..dde57c0 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1095,7 +1095,7 @@ scsi_sysfs_pathinfo (struct path * pp)
 
 	condlog(3, "%s: product = %s", pp->dev, pp->product_id);
 
-	if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE) <= 0)
+	if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE) < 0)
 		return 1;
 
 	condlog(3, "%s: rev = %s", pp->dev, pp->rev);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libmultipath: fix discovery of devices with sysfs attr containing only spaces
  2015-04-11 15:18 [PATCH] libmultipath: fix discovery of devices with sysfs attr containing only spaces Mauricio Faria de Oliveira
@ 2015-04-11 15:33 ` Mauricio Faria de Oliveira
  2015-04-22 11:41 ` Mauricio Faria de Oliveira
  1 sibling, 0 replies; 3+ messages in thread
From: Mauricio Faria de Oliveira @ 2015-04-11 15:33 UTC (permalink / raw)
  To: dm-devel

On 04/11/2015 12:18 PM, Mauricio Faria de Oliveira wrote:
> Changing the comparison operator '<=' to '<' allows discovery to continue.

This is changed only for rev; vendor & model seem unlikely to hit this.
I can submit a more general patch for the 3 attributes, if required.

-- 
Mauricio Faria de Oliveira
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libmultipath: fix discovery of devices with sysfs attr containing only spaces
  2015-04-11 15:18 [PATCH] libmultipath: fix discovery of devices with sysfs attr containing only spaces Mauricio Faria de Oliveira
  2015-04-11 15:33 ` Mauricio Faria de Oliveira
@ 2015-04-22 11:41 ` Mauricio Faria de Oliveira
  1 sibling, 0 replies; 3+ messages in thread
From: Mauricio Faria de Oliveira @ 2015-04-22 11:41 UTC (permalink / raw)
  To: hare; +Cc: dm-devel

Hi Hannes,

Would you be able to review/comment this patch when you have a chance?

It proposes a fix to an original commit of yours, so your opinion would 
be really appreciated. :-)

It's a change to allow devices with blank SCSI 'rev' sysfs attribute to
be discovered.

Thank you!


On 04/11/2015 12:18 PM, Mauricio Faria de Oliveira wrote:
> commit 43c61e979521b17d9f50ea8e722682c33d0b7d69 causes sysfs_get_<attr>() to
> return 0 if attr contains only spaces, and scsi_sysfs_pathinfo() to return 1
> in 'if (sysfs_get_<attr>() <= 0)'; this breaks the device's discovery.
>
> Changing the comparison operator '<=' to '<' allows discovery to continue.
>
> This affects some IPR controllers (rev sysfs attr):
>
> 	# grep . /sys/block/sda/device/{vendor,model,rev} | tr ' ' '#'
> 	/sys/block/sda/device/vendor:IBM#####
> 	/sys/block/sda/device/model:IPR-0###5EC99A00
> 	/sys/block/sda/device/rev:####
>
> Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
> ---
>   libmultipath/discovery.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
> index 4582a20..dde57c0 100644
> --- a/libmultipath/discovery.c
> +++ b/libmultipath/discovery.c
> @@ -1095,7 +1095,7 @@ scsi_sysfs_pathinfo (struct path * pp)
>
>   	condlog(3, "%s: product = %s", pp->dev, pp->product_id);
>
> -	if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE) <= 0)
> +	if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE) < 0)
>   		return 1;
>
>   	condlog(3, "%s: rev = %s", pp->dev, pp->rev);
>


-- 
Mauricio Faria de Oliveira
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-22 11:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-11 15:18 [PATCH] libmultipath: fix discovery of devices with sysfs attr containing only spaces Mauricio Faria de Oliveira
2015-04-11 15:33 ` Mauricio Faria de Oliveira
2015-04-22 11:41 ` Mauricio Faria de Oliveira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.