Re: [PATCH] scsi: storvsc: set max_segment_size as UINT_MAX explicitly

Laurence Oberman
2025-06-21T00:12:21Z

On Tue, 2025-06-17 at 07:02 +0200, Christoph Hellwig wrote:
> Please try this proper fix instead:
>
> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> index e021f1106bea..09f5fb5b2fb1 100644
> --- a/drivers/scsi/hosts.c
> +++ b/drivers/scsi/hosts.c
> @@ -473,7 +473,9 @@ struct Scsi_Host *scsi_host_alloc(const struct
> scsi_host_template *sht, int priv
>         else
>                 shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
>
> -       if (sht->max_segment_size)
> +       if (sht->virt_boundary_mask)
> +               shost->virt_boundary_mask = sht->virt_boundary_mask;
> +       else if (sht->max_segment_size)
>                 shost->max_segment_size = sht->max_segment_size;
>         else
>                 shost->max_segment_size = BLK_MAX_SEGMENT_SIZE;
> @@ -492,9 +494,6 @@ struct Scsi_Host *scsi_host_alloc(const struct
> scsi_host_template *sht, int priv
>         else
>                 shost->dma_boundary = 0xffffffff;
>
> -       if (sht->virt_boundary_mask)
> -               shost->virt_boundary_mask = sht->virt_boundary_mask;
> -
>         device_initialize(&shost->shost_gendev);
>         dev_set_name(&shost->shost_gendev, "host%d", shost->host_no);
>         shost->shost_gendev.bus = &scsi_bus_type;
>

Hello

Not sure what you folks will decide as the final fix but Christoph's
patch prevents the REDO corruption as well.
Ran it long enough to know its clean from corruption with this patch
above

Tested-by: Laurence Oberman <loberman@redhat.com>

Thanks vey mauch as always folks

Regards
Laurence