target-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] vhost scsi: fix lun reset completion handling
@ 2020-11-18  6:24 Mike Christie
  2020-11-18  8:51 ` Stefan Hajnoczi
  2020-11-18  8:56 ` Michael S. Tsirkin
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Christie @ 2020-11-18  6:24 UTC (permalink / raw)
  To: stefanha, linux-scsi, target-devel, mst, virtualization

vhost scsi owns the scsi se_cmd but lio frees the se_cmd->se_tmr
before calling release_cmd, so while with normal cmd completion we
can access the se_cmd from the vhost work, we can't do the same with
se_cmd->se_tmr. This has us copy the tmf response in
vhost_scsi_queue_tm_rsp to our internal vhost-scsi tmf struct for
when it gets sent to the guest from our worker thread.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/vhost/scsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index f22fce5..6ff8a5096 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -220,6 +220,7 @@ struct vhost_scsi_tmf {
 	struct list_head queue_entry;
 
 	struct se_cmd se_cmd;
+	u8 scsi_resp;
 	struct vhost_scsi_inflight *inflight;
 	struct iovec resp_iov;
 	int in_iovs;
@@ -426,6 +427,7 @@ static void vhost_scsi_queue_tm_rsp(struct se_cmd *se_cmd)
 	struct vhost_scsi_tmf *tmf = container_of(se_cmd, struct vhost_scsi_tmf,
 						  se_cmd);
 
+	tmf->scsi_resp = se_cmd->se_tmr_req->response;
 	transport_generic_free_cmd(&tmf->se_cmd, 0);
 }
 
@@ -1183,7 +1185,7 @@ static void vhost_scsi_tmf_resp_work(struct vhost_work *work)
 						  vwork);
 	int resp_code;
 
-	if (tmf->se_cmd.se_tmr_req->response == TMR_FUNCTION_COMPLETE)
+	if (tmf->scsi_resp == TMR_FUNCTION_COMPLETE)
 		resp_code = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED;
 	else
 		resp_code = VIRTIO_SCSI_S_FUNCTION_REJECTED;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] vhost scsi: fix lun reset completion handling
  2020-11-18  6:24 [PATCH 1/1] vhost scsi: fix lun reset completion handling Mike Christie
@ 2020-11-18  8:51 ` Stefan Hajnoczi
  2020-11-18  8:56 ` Michael S. Tsirkin
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2020-11-18  8:51 UTC (permalink / raw)
  To: Mike Christie; +Cc: linux-scsi, target-devel, mst, virtualization

[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

On Wed, Nov 18, 2020 at 12:24:20AM -0600, Mike Christie wrote:
> vhost scsi owns the scsi se_cmd but lio frees the se_cmd->se_tmr
> before calling release_cmd, so while with normal cmd completion we
> can access the se_cmd from the vhost work, we can't do the same with
> se_cmd->se_tmr. This has us copy the tmf response in
> vhost_scsi_queue_tm_rsp to our internal vhost-scsi tmf struct for
> when it gets sent to the guest from our worker thread.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>  drivers/vhost/scsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] vhost scsi: fix lun reset completion handling
  2020-11-18  6:24 [PATCH 1/1] vhost scsi: fix lun reset completion handling Mike Christie
  2020-11-18  8:51 ` Stefan Hajnoczi
@ 2020-11-18  8:56 ` Michael S. Tsirkin
  2020-11-18 16:18   ` Mike Christie
  1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2020-11-18  8:56 UTC (permalink / raw)
  To: Mike Christie; +Cc: stefanha, linux-scsi, target-devel, virtualization

On Wed, Nov 18, 2020 at 12:24:20AM -0600, Mike Christie wrote:
> vhost scsi owns the scsi se_cmd but lio frees the se_cmd->se_tmr
> before calling release_cmd, so while with normal cmd completion we
> can access the se_cmd from the vhost work, we can't do the same with
> se_cmd->se_tmr. This has us copy the tmf response in
> vhost_scsi_queue_tm_rsp to our internal vhost-scsi tmf struct for
> when it gets sent to the guest from our worker thread.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>

Is this a fix for
    vhost scsi: Add support for LUN resets.

If so pls add a Fixes: tag.

> ---
>  drivers/vhost/scsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index f22fce5..6ff8a5096 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -220,6 +220,7 @@ struct vhost_scsi_tmf {
>  	struct list_head queue_entry;
>  
>  	struct se_cmd se_cmd;
> +	u8 scsi_resp;
>  	struct vhost_scsi_inflight *inflight;
>  	struct iovec resp_iov;
>  	int in_iovs;
> @@ -426,6 +427,7 @@ static void vhost_scsi_queue_tm_rsp(struct se_cmd *se_cmd)
>  	struct vhost_scsi_tmf *tmf = container_of(se_cmd, struct vhost_scsi_tmf,
>  						  se_cmd);
>  
> +	tmf->scsi_resp = se_cmd->se_tmr_req->response;
>  	transport_generic_free_cmd(&tmf->se_cmd, 0);
>  }
>  
> @@ -1183,7 +1185,7 @@ static void vhost_scsi_tmf_resp_work(struct vhost_work *work)
>  						  vwork);
>  	int resp_code;
>  
> -	if (tmf->se_cmd.se_tmr_req->response == TMR_FUNCTION_COMPLETE)
> +	if (tmf->scsi_resp == TMR_FUNCTION_COMPLETE)
>  		resp_code = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED;
>  	else
>  		resp_code = VIRTIO_SCSI_S_FUNCTION_REJECTED;
> -- 
> 1.8.3.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] vhost scsi: fix lun reset completion handling
  2020-11-18  8:56 ` Michael S. Tsirkin
@ 2020-11-18 16:18   ` Mike Christie
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Christie @ 2020-11-18 16:18 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: stefanha, linux-scsi, target-devel, virtualization

On 11/18/20 2:56 AM, Michael S. Tsirkin wrote:
> On Wed, Nov 18, 2020 at 12:24:20AM -0600, Mike Christie wrote:
>> vhost scsi owns the scsi se_cmd but lio frees the se_cmd->se_tmr
>> before calling release_cmd, so while with normal cmd completion we
>> can access the se_cmd from the vhost work, we can't do the same with
>> se_cmd->se_tmr. This has us copy the tmf response in
>> vhost_scsi_queue_tm_rsp to our internal vhost-scsi tmf struct for
>> when it gets sent to the guest from our worker thread.
>>
>> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> 
> Is this a fix for
>     vhost scsi: Add support for LUN resets.
> 
> If so pls add a Fixes: tag.
> 

It is. Ok, will resend.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-18 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18  6:24 [PATCH 1/1] vhost scsi: fix lun reset completion handling Mike Christie
2020-11-18  8:51 ` Stefan Hajnoczi
2020-11-18  8:56 ` Michael S. Tsirkin
2020-11-18 16:18   ` Mike Christie

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).