Commit 6cbb7aed authored by Dexuan Cui's avatar Dexuan Cui Committed by Martin K. Petersen
Browse files

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 2bb95584 ("scsi: core: add scsi_host_(block,unblock) helper
function") and so far the APIs are only used by: commit 3d3ca53b
("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: 2bb95584 ("scsi: core: add scsi_host_(block,unblock) helper function")
Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent fa17a6dc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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: