All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] virtio_scsi: do not overwrite SCSI status
@ 2021-06-22  9:11 Hannes Reinecke
  2021-06-23  1:50 ` Martin K. Petersen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hannes Reinecke @ 2021-06-22  9:11 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Guenter Roeck, Jiri Slaby

When a sense code is present we should not override the scsi status;
the driver already sets it based on the response from the hypervisor.

Fixes:  464a00c9e0ad ("scsi: core: Kill DRIVER_SENSE")
Signed-off-by: Hannes Reinecke <hare@suse.de>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Jiri Slaby <jirislaby@kernel.org>
---
 drivers/scsi/virtio_scsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index fd69a03d6137..ad78bf631900 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -156,12 +156,11 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
 
 	WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) >
 		VIRTIO_SCSI_SENSE_SIZE);
-	if (sc->sense_buffer) {
+	if (resp->sense_len) {
 		memcpy(sc->sense_buffer, resp->sense,
 		       min_t(u32,
 			     virtio32_to_cpu(vscsi->vdev, resp->sense_len),
 			     VIRTIO_SCSI_SENSE_SIZE));
-		set_status_byte(sc, SAM_STAT_CHECK_CONDITION);
 	}
 
 	sc->scsi_done(sc);
-- 
2.29.2


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

* Re: [PATCHv2] virtio_scsi: do not overwrite SCSI status
  2021-06-22  9:11 [PATCHv2] virtio_scsi: do not overwrite SCSI status Hannes Reinecke
@ 2021-06-23  1:50 ` Martin K. Petersen
  2021-06-23  5:33   ` [Re: " Christian Borntraeger
  2021-06-29  4:10 ` Martin K. Petersen
  2021-07-03 18:35 ` Guenter Roeck
  2 siblings, 1 reply; 6+ messages in thread
From: Martin K. Petersen @ 2021-06-23  1:50 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Guenter Roeck, Jiri Slaby


Hannes,

> When a sense code is present we should not override the scsi status;
> the driver already sets it based on the response from the hypervisor.

Applied to 5.14/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* [Re: [PATCHv2] virtio_scsi: do not overwrite SCSI status
  2021-06-23  1:50 ` Martin K. Petersen
@ 2021-06-23  5:33   ` Christian Borntraeger
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Borntraeger @ 2021-06-23  5:33 UTC (permalink / raw)
  To: martin.petersen
  Cc: hare, hch, james.bottomley, jirislaby, linux-scsi, linux, borntraeger

> Applied to 5.14/scsi-staging, thanks!

This fixes virtio-scsi for me.
Thanks.

Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>

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

* Re: [PATCHv2] virtio_scsi: do not overwrite SCSI status
  2021-06-22  9:11 [PATCHv2] virtio_scsi: do not overwrite SCSI status Hannes Reinecke
  2021-06-23  1:50 ` Martin K. Petersen
@ 2021-06-29  4:10 ` Martin K. Petersen
  2021-07-03 18:35 ` Guenter Roeck
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2021-06-29  4:10 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K . Petersen, linux-scsi, James Bottomley, Jiri Slaby,
	Guenter Roeck, Christoph Hellwig

On Tue, 22 Jun 2021 11:11:53 +0200, Hannes Reinecke wrote:

> When a sense code is present we should not override the scsi status;
> the driver already sets it based on the response from the hypervisor.

Applied to 5.14/scsi-queue, thanks!

[1/1] virtio_scsi: do not overwrite SCSI status
      https://git.kernel.org/mkp/scsi/c/c43ddbf97f46

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCHv2] virtio_scsi: do not overwrite SCSI status
  2021-06-22  9:11 [PATCHv2] virtio_scsi: do not overwrite SCSI status Hannes Reinecke
  2021-06-23  1:50 ` Martin K. Petersen
  2021-06-29  4:10 ` Martin K. Petersen
@ 2021-07-03 18:35 ` Guenter Roeck
  2021-07-03 22:09   ` Martin K. Petersen
  2 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2021-07-03 18:35 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Jiri Slaby

Hi,

On Tue, Jun 22, 2021 at 11:11:53AM +0200, Hannes Reinecke wrote:
> When a sense code is present we should not override the scsi status;
> the driver already sets it based on the response from the hypervisor.
> 
> Fixes:  464a00c9e0ad ("scsi: core: Kill DRIVER_SENSE")
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Tested-by: Guenter Roeck <linux@roeck-us.net>
> Tested-by: Jiri Slaby <jirislaby@kernel.org>
> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>

This patch didn't make it into mainline, but commit 464a00c9e0ad is
there. This means that virtio_scsi is now broken in mainline (as of
v5.13-9356-g4b820e167bf6). Did it get lost, or is it still queued
somewhere ?

Thanks,
Guenter

> ---
>  drivers/scsi/virtio_scsi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
> index fd69a03d6137..ad78bf631900 100644
> --- a/drivers/scsi/virtio_scsi.c
> +++ b/drivers/scsi/virtio_scsi.c
> @@ -156,12 +156,11 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
>  
>  	WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) >
>  		VIRTIO_SCSI_SENSE_SIZE);
> -	if (sc->sense_buffer) {
> +	if (resp->sense_len) {
>  		memcpy(sc->sense_buffer, resp->sense,
>  		       min_t(u32,
>  			     virtio32_to_cpu(vscsi->vdev, resp->sense_len),
>  			     VIRTIO_SCSI_SENSE_SIZE));
> -		set_status_byte(sc, SAM_STAT_CHECK_CONDITION);
>  	}
>  
>  	sc->scsi_done(sc);

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

* Re: [PATCHv2] virtio_scsi: do not overwrite SCSI status
  2021-07-03 18:35 ` Guenter Roeck
@ 2021-07-03 22:09   ` Martin K. Petersen
  0 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2021-07-03 22:09 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Hannes Reinecke, Martin K. Petersen, Christoph Hellwig,
	James Bottomley, linux-scsi, Jiri Slaby


Guenter,

> This patch didn't make it into mainline, but commit 464a00c9e0ad is
> there. This means that virtio_scsi is now broken in mainline (as of
> v5.13-9356-g4b820e167bf6). Did it get lost, or is it still queued
> somewhere ?

It's still in 5.14/scsi-queue:

https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/log/?h=5.14/scsi-queue

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-07-03 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  9:11 [PATCHv2] virtio_scsi: do not overwrite SCSI status Hannes Reinecke
2021-06-23  1:50 ` Martin K. Petersen
2021-06-23  5:33   ` [Re: " Christian Borntraeger
2021-06-29  4:10 ` Martin K. Petersen
2021-07-03 18:35 ` Guenter Roeck
2021-07-03 22:09   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.