* [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK
@ 2020-04-18 0:40 Dexuan Cui
2020-04-18 2:41 ` Ming Lei
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Dexuan Cui @ 2020-04-18 0:40 UTC (permalink / raw)
To: jejb, martin.petersen, linux-scsi, linux-kernel, hch, bvanassche,
hare, mikelley, longli, ming.lei
Cc: Dexuan Cui
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK
2020-04-18 0:40 [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK Dexuan Cui
@ 2020-04-18 2:41 ` Ming Lei
2020-04-21 3:01 ` Dexuan Cui
2020-04-21 14:13 ` Ewan D. Milne
2020-04-22 3:44 ` Martin K. Petersen
2 siblings, 1 reply; 6+ messages in thread
From: Ming Lei @ 2020-04-18 2:41 UTC (permalink / raw)
To: Dexuan Cui
Cc: jejb, martin.petersen, linux-scsi, linux-kernel, hch, bvanassche,
hare, mikelley, longli
On Fri, Apr 17, 2020 at 05:40:45PM -0700, Dexuan Cui wrote:
> 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:
Looks reasonable because SDEV_BLOCK is one more strict state than
QEIESCE, so:
Reviewed-by: Ming Lei <ming.lei@redha.com>
Thanks,
Ming
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK
2020-04-18 2:41 ` Ming Lei
@ 2020-04-21 3:01 ` Dexuan Cui
2020-04-21 8:58 ` Ming Lei
0 siblings, 1 reply; 6+ messages in thread
From: Dexuan Cui @ 2020-04-21 3:01 UTC (permalink / raw)
To: Ming Lei, martin.petersen, bvanassche, hch, linux-scsi
Cc: jejb, linux-kernel, hare, Michael Kelley, Long Li
> From: Ming Lei <ming.lei@redhat.com>
> Sent: Friday, April 17, 2020 7:42 PM
> To: Dexuan Cui <decui@microsoft.com>
> Cc: jejb@linux.ibm.com; martin.petersen@oracle.com;
> linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; hch@lst.de;
> bvanassche@acm.org; hare@suse.de; Michael Kelley
> <mikelley@microsoft.com>; Long Li <longli@microsoft.com>
> Subject: Re: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to
> SDEV_BLOCK
>
> On Fri, Apr 17, 2020 at 05:40:45PM -0700, Dexuan Cui wrote:
> > 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:
>
> Looks reasonable because SDEV_BLOCK is one more strict state than
> QEIESCE, so:
Thanks, Ming!
> Reviewed-by: Ming Lei <ming.lei@redha.com>
>
> Thanks,
> Ming
There should be a small typo: s/redha/redhat :-)
Thanks,
-- Dexuan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK
2020-04-21 3:01 ` Dexuan Cui
@ 2020-04-21 8:58 ` Ming Lei
0 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2020-04-21 8:58 UTC (permalink / raw)
To: Dexuan Cui
Cc: martin.petersen, bvanassche, hch, linux-scsi, jejb, linux-kernel,
hare, Michael Kelley, Long Li
On Tue, Apr 21, 2020 at 03:01:34AM +0000, Dexuan Cui wrote:
> > From: Ming Lei <ming.lei@redhat.com>
> > Sent: Friday, April 17, 2020 7:42 PM
> > To: Dexuan Cui <decui@microsoft.com>
> > Cc: jejb@linux.ibm.com; martin.petersen@oracle.com;
> > linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; hch@lst.de;
> > bvanassche@acm.org; hare@suse.de; Michael Kelley
> > <mikelley@microsoft.com>; Long Li <longli@microsoft.com>
> > Subject: Re: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to
> > SDEV_BLOCK
> >
> > On Fri, Apr 17, 2020 at 05:40:45PM -0700, Dexuan Cui wrote:
> > > 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:
> >
> > Looks reasonable because SDEV_BLOCK is one more strict state than
> > QEIESCE, so:
>
> Thanks, Ming!
>
> > Reviewed-by: Ming Lei <ming.lei@redha.com>
> >
> > Thanks,
> > Ming
>
> There should be a small typo: s/redha/redhat :-)
Sorry for the fault:
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK
2020-04-18 0:40 [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK Dexuan Cui
2020-04-18 2:41 ` Ming Lei
@ 2020-04-21 14:13 ` Ewan D. Milne
2020-04-22 3:44 ` Martin K. Petersen
2 siblings, 0 replies; 6+ messages in thread
From: Ewan D. Milne @ 2020-04-21 14:13 UTC (permalink / raw)
To: decui, linux-scsi
On Fri, 2020-04-17 at 17:40 -0700, Dexuan Cui wrote:
> 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:
I think this should be OK.
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK
2020-04-18 0:40 [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK Dexuan Cui
2020-04-18 2:41 ` Ming Lei
2020-04-21 14:13 ` Ewan D. Milne
@ 2020-04-22 3:44 ` Martin K. Petersen
2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2020-04-22 3:44 UTC (permalink / raw)
To: Dexuan Cui
Cc: jejb, martin.petersen, linux-scsi, linux-kernel, hch, bvanassche,
hare, mikelley, longli, ming.lei
Dexuan,
> 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.
Applied to 5.7/scsi-fixes, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-04-22 3:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 0:40 [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK Dexuan Cui
2020-04-18 2:41 ` Ming Lei
2020-04-21 3:01 ` Dexuan Cui
2020-04-21 8:58 ` Ming Lei
2020-04-21 14:13 ` Ewan D. Milne
2020-04-22 3:44 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).