[PATCH for-11.0] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable

Kevin Wolf posted 1 patch 2 days, 13 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260330121635.49205-1-kwolf@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>
scsi/utils.c | 1 -
1 file changed, 1 deletion(-)
[PATCH for-11.0] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable
Posted by Kevin Wolf 2 days, 13 hours ago
When commit bdf9613b introduced scsi_sense_buf_is_guest_recoverable(),
it included LOGICAL UNIT NOT SUPPORTED in the list of guest recoverable
sense codes. It doesn't really explain how the codes to be in the list
were selected.

As the LUN doesn't come from the guest, but from the block backend
(usually the SCSI device on the host that was opened with host_device,
but it could also be the iscsi block driver), there is really no way the
guest could influence this.

It seems that on some storage arrays, LOGICAL UNIT NOT SUPPORTED can
happen during failover operations. When combined with multipath, the
request should be retried on another path instead of being reported to
the guest, which would offline the filesystem in response.

Simply returning false in scsi_sense_buf_is_guest_recoverable() will
enable the retry logic in file-posix, and will also make sure that if
the error persists, the configured error policy is respected so that the
VM can be stopped.

Buglink: https://redhat.atlassian.net/browse/RHEL-158212
Fixes: bdf9613b7f87 ('scsi: explicitly list guest-recoverable sense codes')
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 scsi/utils.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scsi/utils.c b/scsi/utils.c
index 545956f4f95..daee90ecf0e 100644
--- a/scsi/utils.c
+++ b/scsi/utils.c
@@ -373,7 +373,6 @@ static bool scsi_sense_is_guest_recoverable(int key, int asc, int ascq)
     case 0x1a00: /* PARAMETER LIST LENGTH ERROR */
     case 0x2000: /* INVALID OPERATION CODE */
     case 0x2400: /* INVALID FIELD IN CDB */
-    case 0x2500: /* LOGICAL UNIT NOT SUPPORTED */
     case 0x2600: /* INVALID FIELD IN PARAMETER LIST */
 
     case 0x2104: /* UNALIGNED WRITE COMMAND */
-- 
2.53.0
Re: [PATCH for-11.0] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable
Posted by Michael Tokarev 1 day, 3 hours ago
On 30.03.2026 15:16, Kevin Wolf wrote:
> When commit bdf9613b introduced scsi_sense_buf_is_guest_recoverable(),
> it included LOGICAL UNIT NOT SUPPORTED in the list of guest recoverable
> sense codes. It doesn't really explain how the codes to be in the list
> were selected.
> 
> As the LUN doesn't come from the guest, but from the block backend
> (usually the SCSI device on the host that was opened with host_device,
> but it could also be the iscsi block driver), there is really no way the
> guest could influence this.
> 
> It seems that on some storage arrays, LOGICAL UNIT NOT SUPPORTED can
> happen during failover operations. When combined with multipath, the
> request should be retried on another path instead of being reported to
> the guest, which would offline the filesystem in response.
> 
> Simply returning false in scsi_sense_buf_is_guest_recoverable() will
> enable the retry logic in file-posix, and will also make sure that if
> the error persists, the configured error policy is respected so that the
> VM can be stopped.
> 
> Buglink: https://redhat.atlassian.net/browse/RHEL-158212
> Fixes: bdf9613b7f87 ('scsi: explicitly list guest-recoverable sense codes')
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Ditto for this one, - while not a big deal really, but I'm picking it up
for the current stable series.  Please let me know if I shouldn't.

Thanks,

/mjt
Re: [PATCH for-11.0] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable
Posted by Stefan Hajnoczi 2 days, 7 hours ago
On Mon, Mar 30, 2026 at 02:16:35PM +0200, Kevin Wolf wrote:
> When commit bdf9613b introduced scsi_sense_buf_is_guest_recoverable(),
> it included LOGICAL UNIT NOT SUPPORTED in the list of guest recoverable
> sense codes. It doesn't really explain how the codes to be in the list
> were selected.
> 
> As the LUN doesn't come from the guest, but from the block backend
> (usually the SCSI device on the host that was opened with host_device,
> but it could also be the iscsi block driver), there is really no way the
> guest could influence this.
> 
> It seems that on some storage arrays, LOGICAL UNIT NOT SUPPORTED can
> happen during failover operations. When combined with multipath, the
> request should be retried on another path instead of being reported to
> the guest, which would offline the filesystem in response.
> 
> Simply returning false in scsi_sense_buf_is_guest_recoverable() will
> enable the retry logic in file-posix, and will also make sure that if
> the error persists, the configured error policy is respected so that the
> VM can be stopped.
> 
> Buglink: https://redhat.atlassian.net/browse/RHEL-158212
> Fixes: bdf9613b7f87 ('scsi: explicitly list guest-recoverable sense codes')
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  scsi/utils.c | 1 -
>  1 file changed, 1 deletion(-)

Paolo: Are you taking this through your SCSI tree or would you like
Peter to merge it directly?

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Re: [PATCH for-11.0] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable
Posted by Kevin Wolf 1 day, 12 hours ago
Am 30.03.2026 um 20:18 hat Stefan Hajnoczi geschrieben:
> On Mon, Mar 30, 2026 at 02:16:35PM +0200, Kevin Wolf wrote:
> > When commit bdf9613b introduced scsi_sense_buf_is_guest_recoverable(),
> > it included LOGICAL UNIT NOT SUPPORTED in the list of guest recoverable
> > sense codes. It doesn't really explain how the codes to be in the list
> > were selected.
> > 
> > As the LUN doesn't come from the guest, but from the block backend
> > (usually the SCSI device on the host that was opened with host_device,
> > but it could also be the iscsi block driver), there is really no way the
> > guest could influence this.
> > 
> > It seems that on some storage arrays, LOGICAL UNIT NOT SUPPORTED can
> > happen during failover operations. When combined with multipath, the
> > request should be retried on another path instead of being reported to
> > the guest, which would offline the filesystem in response.
> > 
> > Simply returning false in scsi_sense_buf_is_guest_recoverable() will
> > enable the retry logic in file-posix, and will also make sure that if
> > the error persists, the configured error policy is respected so that the
> > VM can be stopped.
> > 
> > Buglink: https://redhat.atlassian.net/browse/RHEL-158212
> > Fixes: bdf9613b7f87 ('scsi: explicitly list guest-recoverable sense codes')
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  scsi/utils.c | 1 -
> >  1 file changed, 1 deletion(-)
> 
> Paolo: Are you taking this through your SCSI tree or would you like
> Peter to merge it directly?

I'll send a PR today anyway, so now that it has the R-b from both of
you, I can take it through the block tree.

Kevin
Re: [PATCH for-11.0] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable
Posted by Paolo Bonzini 2 days, 12 hours ago
On 3/30/26 14:16, Kevin Wolf wrote:
> When commit bdf9613b introduced scsi_sense_buf_is_guest_recoverable(),
> it included LOGICAL UNIT NOT SUPPORTED in the list of guest recoverable
> sense codes. It doesn't really explain how the codes to be in the list
> were selected.

I think I mostly looked at what codes QEMU generates itself and excluded 
those.  But if LUN_NOT_SUPPORTED happens like that for storage arrays, 
that is the correct thing to do.


> As the LUN doesn't come from the guest, but from the block backend
> (usually the SCSI device on the host that was opened with host_device,
> but it could also be the iscsi block driver), there is really no way the
> guest could influence this.
> 
> It seems that on some storage arrays, LOGICAL UNIT NOT SUPPORTED can
> happen during failover operations. When combined with multipath, the
> request should be retried on another path instead of being reported to
> the guest, which would offline the filesystem in response.
> 
> Simply returning false in scsi_sense_buf_is_guest_recoverable() will
> enable the retry logic in file-posix, and will also make sure that if
> the error persists, the configured error policy is respected so that the
> VM can be stopped.
> 
> Buglink: https://redhat.atlassian.net/browse/RHEL-158212
> Fixes: bdf9613b7f87 ('scsi: explicitly list guest-recoverable sense codes')
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

> ---
>   scsi/utils.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/scsi/utils.c b/scsi/utils.c
> index 545956f4f95..daee90ecf0e 100644
> --- a/scsi/utils.c
> +++ b/scsi/utils.c
> @@ -373,7 +373,6 @@ static bool scsi_sense_is_guest_recoverable(int key, int asc, int ascq)
>       case 0x1a00: /* PARAMETER LIST LENGTH ERROR */
>       case 0x2000: /* INVALID OPERATION CODE */
>       case 0x2400: /* INVALID FIELD IN CDB */
> -    case 0x2500: /* LOGICAL UNIT NOT SUPPORTED */
>       case 0x2600: /* INVALID FIELD IN PARAMETER LIST */
>   
>       case 0x2104: /* UNALIGNED WRITE COMMAND */