]> Git Repo - linux.git/commitdiff
scsi: core: sysfs: Fix setting device state to SDEV_RUNNING
authorMike Christie <[email protected]>
Sat, 20 Nov 2021 16:49:17 +0000 (10:49 -0600)
committerMartin K. Petersen <[email protected]>
Tue, 23 Nov 2021 03:18:54 +0000 (22:18 -0500)
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.

Link: https://lore.kernel.org/r/[email protected]
Fixes: 4edd8cd4e86d ("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]>
drivers/scsi/scsi_sysfs.c

index 7afcec250f9b5a909f0857a9f6b3d0a9a1b464e9..d4edce930a4a066880c9c1bb40c6d4b8e08ab8f0 100644 (file)
@@ -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)
This page took 0.063331 seconds and 4 git commands to generate.