All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: make "access_state" sysfs attribute always visible
@ 2022-01-27 14:13 mwilck
  2022-01-27 14:29 ` Hannes Reinecke
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mwilck @ 2022-01-27 14:13 UTC (permalink / raw)
  To: Martin K. Petersen, Christoph Hellwig, Hannes Reinecke
  Cc: linux-scsi, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

If a SCSI device handler module is loaded after some SCSI devices
have already been probed (e.g. via request_module() by dm-multipath),
the "access_state" and "preferred_path" sysfs attributes remain invisible for
these devices, although the handler is attached and live. The reason is
that the visibility is only checked when the sysfs attribute group is
first created. This results in an inconsistent user experience depending
on the load order of SCSI low-level drivers vs. device handler modules.

This patch changes user space API: attempting to read the "access_state"
or "preferred_path" attributes will now result in -EINVAL rather than
-ENODEV for devices that have no device handler, and tests for the existence
of these attributes will have a different result.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/scsi_sysfs.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index f1e0c131b77c..226a50944c00 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1228,14 +1228,6 @@ static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj,
 	    !sdev->host->hostt->change_queue_depth)
 		return 0;
 
-#ifdef CONFIG_SCSI_DH
-	if (attr == &dev_attr_access_state.attr &&
-	    !sdev->handler)
-		return 0;
-	if (attr == &dev_attr_preferred_path.attr &&
-	    !sdev->handler)
-		return 0;
-#endif
 	return attr->mode;
 }
 
-- 
2.34.1


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

* Re: [PATCH] scsi: make "access_state" sysfs attribute always visible
  2022-01-27 14:13 [PATCH] scsi: make "access_state" sysfs attribute always visible mwilck
@ 2022-01-27 14:29 ` Hannes Reinecke
  2022-02-08  4:07 ` Martin K. Petersen
  2022-02-11 23:25 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2022-01-27 14:29 UTC (permalink / raw)
  To: mwilck, Martin K. Petersen, Christoph Hellwig; +Cc: linux-scsi

On 1/27/22 15:13, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> If a SCSI device handler module is loaded after some SCSI devices
> have already been probed (e.g. via request_module() by dm-multipath),
> the "access_state" and "preferred_path" sysfs attributes remain invisible for
> these devices, although the handler is attached and live. The reason is
> that the visibility is only checked when the sysfs attribute group is
> first created. This results in an inconsistent user experience depending
> on the load order of SCSI low-level drivers vs. device handler modules.
> 
> This patch changes user space API: attempting to read the "access_state"
> or "preferred_path" attributes will now result in -EINVAL rather than
> -ENODEV for devices that have no device handler, and tests for the existence
> of these attributes will have a different result.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/scsi/scsi_sysfs.c | 8 --------
>   1 file changed, 8 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index f1e0c131b77c..226a50944c00 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -1228,14 +1228,6 @@ static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj,
>   	    !sdev->host->hostt->change_queue_depth)
>   		return 0;
>   
> -#ifdef CONFIG_SCSI_DH
> -	if (attr == &dev_attr_access_state.attr &&
> -	    !sdev->handler)
> -		return 0;
> -	if (attr == &dev_attr_preferred_path.attr &&
> -	    !sdev->handler)
> -		return 0;
> -#endif
>   	return attr->mode;
>   }
>   
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

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

* Re: [PATCH] scsi: make "access_state" sysfs attribute always visible
  2022-01-27 14:13 [PATCH] scsi: make "access_state" sysfs attribute always visible mwilck
  2022-01-27 14:29 ` Hannes Reinecke
@ 2022-02-08  4:07 ` Martin K. Petersen
  2022-02-11 23:25 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-02-08  4:07 UTC (permalink / raw)
  To: mwilck; +Cc: Martin K. Petersen, Christoph Hellwig, Hannes Reinecke, linux-scsi


> If a SCSI device handler module is loaded after some SCSI devices have
> already been probed (e.g. via request_module() by dm-multipath), the
> "access_state" and "preferred_path" sysfs attributes remain invisible
> for these devices, although the handler is attached and live. The
> reason is that the visibility is only checked when the sysfs attribute
> group is first created. This results in an inconsistent user
> experience depending on the load order of SCSI low-level drivers
> vs. device handler modules.
>
> This patch changes user space API: attempting to read the
> "access_state" or "preferred_path" attributes will now result in
> -EINVAL rather than -ENODEV for devices that have no device handler,
> and tests for the existence of these attributes will have a different
> result.

Applied to 5.18/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: make "access_state" sysfs attribute always visible
  2022-01-27 14:13 [PATCH] scsi: make "access_state" sysfs attribute always visible mwilck
  2022-01-27 14:29 ` Hannes Reinecke
  2022-02-08  4:07 ` Martin K. Petersen
@ 2022-02-11 23:25 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-02-11 23:25 UTC (permalink / raw)
  To: mwilck, Hannes Reinecke, Christoph Hellwig
  Cc: Martin K . Petersen, linux-scsi

On Thu, 27 Jan 2022 15:13:51 +0100, mwilck@suse.com wrote:

> From: Martin Wilck <mwilck@suse.com>
> 
> If a SCSI device handler module is loaded after some SCSI devices
> have already been probed (e.g. via request_module() by dm-multipath),
> the "access_state" and "preferred_path" sysfs attributes remain invisible for
> these devices, although the handler is attached and live. The reason is
> that the visibility is only checked when the sysfs attribute group is
> first created. This results in an inconsistent user experience depending
> on the load order of SCSI low-level drivers vs. device handler modules.
> 
> [...]

Applied to 5.18/scsi-queue, thanks!

[1/1] scsi: make "access_state" sysfs attribute always visible
      https://git.kernel.org/mkp/scsi/c/7cddf7e8d1e8

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2022-02-11 23:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 14:13 [PATCH] scsi: make "access_state" sysfs attribute always visible mwilck
2022-01-27 14:29 ` Hannes Reinecke
2022-02-08  4:07 ` Martin K. Petersen
2022-02-11 23:25 ` Martin K. Petersen

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.