linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] scsi: Fix setting device state to running
@ 2021-11-20 16:49 Mike Christie
  2021-11-20 17:31 ` Lee Duncan
  2021-11-23  3:45 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Christie @ 2021-11-20 16:49 UTC (permalink / raw)
  To: martin.petersen, linux-scsi, james.bottomley; +Cc: Mike Christie

This fixes an issue added in:

commit 4edd8cd4e86d ("scsi: core: sysfs: Fix hang when device state is set
via sysfs")

where if userspace is requesting to set the device state to SDEV_RUNNING
when the state is already SDEV_RUNNING, we return -EINVAL instead of
count. The commmit above set ret to count for this case, when it should
have set it to 0.

Fixes: 4edd8cd4e86d ("scsi: core: sysfs: Fix hang when device state is set
via sysfs")
Signed-off-by: Mike Christie <michael.christie@oracle.com>

---
 drivers/scsi/scsi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 7afcec250f9b..d4edce930a4a 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -812,7 +812,7 @@ store_state_field(struct device *dev, struct device_attribute *attr,
 
 	mutex_lock(&sdev->state_mutex);
 	if (sdev->sdev_state == SDEV_RUNNING && state == SDEV_RUNNING) {
-		ret = count;
+		ret = 0;
 	} else {
 		ret = scsi_device_set_state(sdev, state);
 		if (ret == 0 && state == SDEV_RUNNING)
-- 
2.25.1


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

* Re: [PATCH 1/1] scsi: Fix setting device state to running
  2021-11-20 16:49 [PATCH 1/1] scsi: Fix setting device state to running Mike Christie
@ 2021-11-20 17:31 ` Lee Duncan
  2021-11-23  3:45 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Duncan @ 2021-11-20 17:31 UTC (permalink / raw)
  To: Mike Christie, martin.petersen, linux-scsi, james.bottomley

On 11/20/21 8:49 AM, Mike Christie wrote:
> This fixes an issue added in:
> 
> commit 4edd8cd4e86d ("scsi: core: sysfs: Fix hang when device state is set
> via sysfs")
> 
> where if userspace is requesting to set the device state to SDEV_RUNNING
> when the state is already SDEV_RUNNING, we return -EINVAL instead of
> count. The commmit above set ret to count for this case, when it should
> have set it to 0.
> 
> Fixes: 4edd8cd4e86d ("scsi: core: sysfs: Fix hang when device state is set
> via sysfs")
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> 
> ---
>  drivers/scsi/scsi_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index 7afcec250f9b..d4edce930a4a 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -812,7 +812,7 @@ store_state_field(struct device *dev, struct device_attribute *attr,
>  
>  	mutex_lock(&sdev->state_mutex);
>  	if (sdev->sdev_state == SDEV_RUNNING && state == SDEV_RUNNING) {
> -		ret = count;
> +		ret = 0;
>  	} else {
>  		ret = scsi_device_set_state(sdev, state);
>  		if (ret == 0 && state == SDEV_RUNNING)
> 

Reviewed-by: Lee Duncan <lduncan@suse.com>


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

* Re: [PATCH 1/1] scsi: Fix setting device state to running
  2021-11-20 16:49 [PATCH 1/1] scsi: Fix setting device state to running Mike Christie
  2021-11-20 17:31 ` Lee Duncan
@ 2021-11-23  3:45 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-11-23  3:45 UTC (permalink / raw)
  To: Mike Christie, linux-scsi, james.bottomley; +Cc: Martin K . Petersen

On Sat, 20 Nov 2021 10:49:17 -0600, Mike Christie wrote:

> This fixes an issue added in:
> 
> commit 4edd8cd4e86d ("scsi: core: sysfs: Fix hang when device state is set
> via sysfs")
> 
> where if userspace is requesting to set the device state to SDEV_RUNNING
> when the state is already SDEV_RUNNING, we return -EINVAL instead of
> count. The commmit above set ret to count for this case, when it should
> have set it to 0.
> 
> [...]

Applied to 5.16/scsi-fixes, thanks!

[1/1] scsi: Fix setting device state to running
      https://git.kernel.org/mkp/scsi/c/eb97545d6264

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-11-23  3:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20 16:49 [PATCH 1/1] scsi: Fix setting device state to running Mike Christie
2021-11-20 17:31 ` Lee Duncan
2021-11-23  3:45 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).