scsi: core: sysfs: Fix setting device state to SDEV_RUNNING
authorMike Christie <michael.christie@oracle.com>
Sat, 20 Nov 2021 16:49:17 +0000 (10:49 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Dec 2021 08:19:05 +0000 (09:19 +0100)
commit725ba1289508e1940ddc43142ff6f91cbcf77ec4
tree9241d04517714e3c94191c28390a9c909faf4558
parente65a8707b4cd756d26d246bb2b9fab06eebafac1
scsi: core: sysfs: Fix setting device state to SDEV_RUNNING

[ Upstream commit eb97545d6264b341b06ba7603f52ff6c0b2af6ea ]

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/20211120164917.4924-1-michael.christie@oracle.com
Fixes: 4edd8cd4e86d ("scsi: core: sysfs: Fix hang when device state is set via sysfs")
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/scsi_sysfs.c