Skip to content

Commit eb97545

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: core: sysfs: Fix setting device state to SDEV_RUNNING
This fixes an issue added in commit 4edd8cd ("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. Link: https://lore.kernel.org/r/[email protected] Fixes: 4edd8cd ("scsi: core: sysfs: Fix hang when device state is set via sysfs") Reviewed-by: Lee Duncan <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e0a2c28 commit eb97545

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/scsi_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ store_state_field(struct device *dev, struct device_attribute *attr,
812812

813813
mutex_lock(&sdev->state_mutex);
814814
if (sdev->sdev_state == SDEV_RUNNING && state == SDEV_RUNNING) {
815-
ret = count;
815+
ret = 0;
816816
} else {
817817
ret = scsi_device_set_state(sdev, state);
818818
if (ret == 0 && state == SDEV_RUNNING)

0 commit comments

Comments
 (0)