summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2020-04-17 17:40:45 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2020-04-21 23:44:26 -0400
commit6cbb7aeded716b8660ee5d4b3dc082f791cdebaa (patch)
tree95691047a6ff203e661b5c57de3717307696911e /drivers/scsi/scsi_lib.c
parentfa17a6dc84d1eb6b62bcf981a4ddcc966b1a2c04 (diff)
downloadlwn-6cbb7aeded716b8660ee5d4b3dc082f791cdebaa.tar.gz
lwn-6cbb7aeded716b8660ee5d4b3dc082f791cdebaa.zip
scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK
The APIs scsi_host_block()/scsi_host_unblock() were recently added by commit 2bb955840c1d ("scsi: core: add scsi_host_(block,unblock) helper function") and so far the APIs are only used by: commit 3d3ca53b1639 ("scsi: aacraid: use scsi_host_(block,unblock) to block I/O"). However, from reading the code, I think the APIs don't really work for aacraid, because, in the resume path of hibernation, when aac_suspend() -> scsi_host_block() is called, scsi_device_quiesce() has set the state to SDEV_QUIESCE, so aac_suspend() -> scsi_host_block() returns -EINVAL. Fix the issue by allowing the state change. Link: https://lore.kernel.org/r/1587170445-50013-1-git-send-email-decui@microsoft.com Fixes: 2bb955840c1d ("scsi: core: add scsi_host_(block,unblock) helper function") Reviewed-by: Ewan D. Milne <emilne@redhat.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 47835c4b4ee0..06c260f6cdae 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2284,6 +2284,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
switch (oldstate) {
case SDEV_RUNNING:
case SDEV_CREATED_BLOCK:
+ case SDEV_QUIESCE:
case SDEV_OFFLINE:
break;
default: