[1/2] block: Let blockdev-create return 0 on success
diff mbox series

Message ID 20190823184733.18929-2-mreitz@redhat.com
State New
Headers show
Series
  • block: Let blockdev-create return 0 on success
Related show

Commit Message

Max Reitz Aug. 23, 2019, 6:47 p.m. UTC
Block drivers should let their .bdrv_co_create() implementation return a
non-negative value to indicate success.  However, jobs should return
exactly 0.  Thus, we need to translate positive return values to 0 in
blockdev_create_run().

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/create.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/block/create.c b/block/create.c
index 1bd00ed5f8..4b23672e1b 100644
--- a/block/create.c
+++ b/block/create.c
@@ -48,7 +48,8 @@  static int coroutine_fn blockdev_create_run(Job *job, Error **errp)
 
     qapi_free_BlockdevCreateOptions(s->opts);
 
-    return ret;
+    /* Jobs must return 0 to indicate success */
+    return ret < 0 ? ret : 0;
 }
 
 static const JobDriver blockdev_create_job_driver = {