qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 6/8] scsi-disk: Allow READ CAPACITY in standby


From: Hannes Reinecke
Subject: [Qemu-devel] [PATCH 6/8] scsi-disk: Allow READ CAPACITY in standby
Date: Fri, 27 Nov 2015 15:59:04 +0100

SPC does not mandate to allow READ CAPACITY when in standby,
but linux currently relies on a valid capacity. Otherwise
requests will be retried from sd_prep_fn() and I/O will
never complete.

Signed-off-by: Hannes Reinecke <address@hidden>
---
 hw/scsi/scsi-disk.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 59d09e4..b3ab890 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2278,6 +2278,22 @@ static int32_t scsi_disk_emulate_command(SCSIRequest 
*req, uint8_t *buf)
             transition_allowed = false;
             unavailable_allowed = false;
             break;
+        case SERVICE_ACTION_IN_16:
+            /*
+             * READ CAPACITY is not required by SPC,
+             * but Linux (currently) relies on a
+             * valid capacity, otherwise requests will
+             * be retried from sd.c:sd_prep_dn() and
+             * optimized-standby failover won't work.
+             */
+            if ((req->cmd.buf[1] & 0x31) != SAI_READ_CAPACITY_16) {
+                standby_allowed = false;
+            }
+            /* Fallthrough */
+        case READ_CAPACITY_10:
+            transition_allowed = false;
+            unavailable_allowed = false;
+            break;
         default:
             transition_allowed = false;
             unavailable_allowed = false;
-- 
1.8.4.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]