Re: [PATCH 13/24] scsi: Kill DRIVER_SENSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/7/21 2:30 PM, Martin K. Petersen wrote:
> 
> Hannes,
> 
>>> Any ideas?
> 
>>> Can you enable SCSI logging via
>>
>> scsi.scsi_logging_level=216
>>
>> on the kernel commandline and send me the output?
> 
> You now effectively set SAM_STAT_CHECK_CONDITION if the scsi_cmnd has a
> sense buffer.
> 
> The original code only set DRIVER_SENSE if the adapter response actually
> contained sense information:
> 
> @@ -161,8 +161,7 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
>                        min_t(u32,
>                              virtio32_to_cpu(vscsi->vdev, resp->sense_len),
>                              VIRTIO_SCSI_SENSE_SIZE));
> -               if (resp->sense_len)
> -                       set_driver_byte(sc, DRIVER_SENSE);
> +               set_status_byte(sc, SAM_STAT_CHECK_CONDITION);
>         }
> 
Oh, I know. But we're checking for a valid sense code during scanning:

			if (scsi_status_is_check_condition(result) &&
			    scsi_sense_valid(&sshdr)) {

so if that makes a difference it would mean that the virtio driver has
some stale sense data which then gets copied over.
Anyway.
Can you test with this patch?

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index fd69a03d6137..0cb1182fd734 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -161,7 +161,8 @@ static void virtscsi_complete_cmd(struct virtio_scsi
*vscsi, void *buf)
                       min_t(u32,
                             virtio32_to_cpu(vscsi->vdev, resp->sense_len),
                             VIRTIO_SCSI_SENSE_SIZE));
-               set_status_byte(sc, SAM_STAT_CHECK_CONDITION);
+               if (resp->sense_len)
+                       set_status_byte(sc, SAM_STAT_CHECK_CONDITION);
        }

        sc->scsi_done(sc);

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		        Kernel Storage Architect
hare@xxxxxxx			               +49 911 74053 688
SUSE Software Solutions Germany GmbH, 90409 Nürnberg
GF: F. Imendörffer, HRB 36809 (AG Nürnberg)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux