lkml.org 
[lkml]   [2020]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK
Date
The APIs scsi_host_block()/scsi_host_unblock() are recently added by:
2bb955840c1d ("scsi: core: add scsi_host_(block,unblock) helper function")
and so far the APIs are only used by:
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.

Fixes: 2bb955840c1d ("scsi: core: add scsi_host_(block,unblock) helper function")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
drivers/scsi/scsi_lib.c | 1 +
1 file changed, 1 insertion(+)

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:
--
2.19.1
\
 
 \ /
  Last update: 2020-04-18 02:42    [W:0.073 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site