218e99
From d7a6dbe86fbbb30cc8142deb71763089aa1f2b62 Mon Sep 17 00:00:00 2001
218e99
From: Paolo Bonzini <pbonzini@redhat.com>
218e99
Date: Fri, 18 Oct 2013 08:14:49 +0200
218e99
Subject: [PATCH 24/81] block/get_block_status: set *pnum = 0 on error
218e99
218e99
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
218e99
Message-id: <1382084091-16636-25-git-send-email-pbonzini@redhat.com>
218e99
Patchwork-id: 55007
218e99
O-Subject: [RHEL 7.0 qemu-kvm PATCH 24/26] block/get_block_status: set *pnum = 0 on error
218e99
Bugzilla: 989646
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Max Reitz <mreitz@redhat.com>
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
218e99
From: Peter Lieven <pl@kamp.de>
218e99
218e99
if the call is invoked through bdrv_is_allocated the caller might
218e99
expect *pnum = 0 on error. however, a new implementation of
218e99
bdrv_get_block_status might only return a negative exit value on
218e99
error while keeping *pnum untouched.
218e99
218e99
Reviewed-by: Eric Blake <eblake@redhat.com>
218e99
Signed-off-by: Peter Lieven <pl@kamp.de>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
(cherry picked from commit 3e0a233d869e74e78b516be34715b91528508cfc)
218e99
---
218e99
 block.c | 1 +
218e99
 1 file changed, 1 insertion(+)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 block.c |    1 +
218e99
 1 files changed, 1 insertions(+), 0 deletions(-)
218e99
218e99
diff --git a/block.c b/block.c
218e99
index f993b2e..02e111e 100644
218e99
--- a/block.c
218e99
+++ b/block.c
218e99
@@ -3069,6 +3069,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
218e99
 
218e99
     ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum);
218e99
     if (ret < 0) {
218e99
+        *pnum = 0;
218e99
         return ret;
218e99
     }
218e99
 
218e99
-- 
218e99
1.7.1
218e99