summary refs log tree commit diff stats
path: root/qemu-nbd.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-05-16 13:46:37 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:51 +0200
commitb3b5299d58bce4366c647af40374e6b063f371eb (patch)
tree75b11daff436035b154a25cbb4fb61908c47ca44 /qemu-nbd.c
parent3d70ff53b6bf90d9eec6f97024ec9895f6799d9e (diff)
downloadfocaccia-qemu-b3b5299d58bce4366c647af40374e6b063f371eb.tar.gz
focaccia-qemu-b3b5299d58bce4366c647af40374e6b063f371eb.zip
block: Cancel job in bdrv_close_all() callers
Now that we cancel all jobs and not only block jobs on shutdown, doing
that in bdrv_close_all() isn't really appropriate any more. Move the
job_cancel_sync_all() call to the callers, and only assert that there
are no job running in bdrv_close_all().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-nbd.c')
-rw-r--r--qemu-nbd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 0af0560ad1..51b9d38c72 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -482,6 +482,12 @@ static const char *socket_activation_validate_opts(const char *device,
     return NULL;
 }
 
+static void qemu_nbd_shutdown(void)
+{
+    job_cancel_sync_all();
+    bdrv_close_all();
+}
+
 int main(int argc, char **argv)
 {
     BlockBackend *blk;
@@ -928,7 +934,7 @@ int main(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
     bdrv_init();
-    atexit(bdrv_close_all);
+    atexit(qemu_nbd_shutdown);
 
     srcpath = argv[optind];
     if (imageOpts) {