[Qemu-devel] [PATCH for 3.1 1/4] scsi/migration: Allow bus load request to fail

Dr. David Alan Gilbert (git) posted 4 patches 7 years, 3 months ago
[Qemu-devel] [PATCH for 3.1 1/4] scsi/migration: Allow bus load request to fail
Posted by Dr. David Alan Gilbert (git) 7 years, 3 months ago
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Allow the load_request method on a bus to fail and error
the migration cleanly.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hw/scsi/scsi-bus.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 5905f6bf29..34a29c2ffd 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -1618,6 +1618,11 @@ static int get_scsi_requests(QEMUFile *f, void *pv, size_t size,
         req->retry = (sbyte == 1);
         if (bus->info->load_request) {
             req->hba_private = bus->info->load_request(f, req);
+
+            if (!req->hba_private) {
+                scsi_req_unref(req);
+                return -1;
+            }
         }
         if (req->ops->load_request) {
             req->ops->load_request(f, req);
-- 
2.17.1


Re: [Qemu-devel] [PATCH for 3.1 1/4] scsi/migration: Allow bus load request to fail
Posted by Cornelia Huck 7 years, 3 months ago
On Mon, 16 Jul 2018 18:37:40 +0100
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:

> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Allow the load_request method on a bus to fail and error
> the migration cleanly.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  hw/scsi/scsi-bus.c | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>