scsi: Fix setting device state to running
PATCH 1/1 scsi: Fix setting device state to running
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.
via sysfs")
--- drivers/scsi/scsi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_sysfs.c +1 -1
@@ -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 )
Signature · 1 line
2.25.1
Quoted 24 lines · 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_RUNNINGwhen the state is alreadySDEV_RUNNING, we return-EINVALinstead 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 setvia sysfs")
Signed-off-by Mike Christie <[email protected]>--- drivers/scsi/scsi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_sysfs.c +0
-0
drivers/scsi/scsi_sysfs.c store_state_field(struct device *dev, struct device_attribute *attr, · line 818
Quoted 8 lines
drivers/scsi/scsi_sysfs.c +1
-1@@ -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 )
Martin K. Petersen
AppliedQuoted 11 lines · 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_RUNNINGwhen the state is alreadySDEV_RUNNING, we return-EINVALinstead 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
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering