From: Mike Christie <michael.christie@oracle.com>
To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
james.bottomley@hansenpartnership.com
Cc: Mike Christie <michael.christie@oracle.com>
Subject: [PATCH 1/1] scsi: Fix setting device state to running
Date: Sat, 20 Nov 2021 10:49:17 -0600 [thread overview]
Message-ID: <20211120164917.4924-1-michael.christie@oracle.com> (raw)
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
next reply other threads:[~2021-11-20 16:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-20 16:49 Mike Christie [this message]
2021-11-20 17:31 ` [PATCH 1/1] scsi: Fix setting device state to running Lee Duncan
2021-11-23 3:45 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211120164917.4924-1-michael.christie@oracle.com \
--to=michael.christie@oracle.com \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.