|
|
ae23c9 |
From dcfa2a8c812791ab69e0ac9656fc3613d750e00d Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Date: Tue, 26 Jun 2018 09:48:24 +0200
|
|
|
ae23c9 |
Subject: [PATCH 116/268] block: Cancel job in bdrv_close_all() callers
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180626094856.6924-42-kwolf@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 81098
|
|
|
ae23c9 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 41/73] block: Cancel job in bdrv_close_all() callers
|
|
|
ae23c9 |
Bugzilla: 1513543
|
|
|
ae23c9 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Now that we cancel all jobs and not only block jobs on shutdown, doing
|
|
|
ae23c9 |
that in bdrv_close_all() isn't really appropriate any more. Move the
|
|
|
ae23c9 |
job_cancel_sync_all() call to the callers, and only assert that there
|
|
|
ae23c9 |
are no job running in bdrv_close_all().
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit b3b5299d58bce4366c647af40374e6b063f371eb)
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
block.c | 4 +---
|
|
|
ae23c9 |
qemu-nbd.c | 8 +++++++-
|
|
|
ae23c9 |
vl.c | 1 +
|
|
|
ae23c9 |
3 files changed, 9 insertions(+), 4 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/block.c b/block.c
|
|
|
ae23c9 |
index a83787f..afe30ca 100644
|
|
|
ae23c9 |
--- a/block.c
|
|
|
ae23c9 |
+++ b/block.c
|
|
|
ae23c9 |
@@ -3374,9 +3374,7 @@ static void bdrv_close(BlockDriverState *bs)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
void bdrv_close_all(void)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
- /* TODO We do want to cancel all jobs instead of just block jobs on
|
|
|
ae23c9 |
- * shutdown, but bdrv_close_all() isn't the right place any more. */
|
|
|
ae23c9 |
- job_cancel_sync_all();
|
|
|
ae23c9 |
+ assert(job_next(NULL) == NULL);
|
|
|
ae23c9 |
nbd_export_close_all();
|
|
|
ae23c9 |
|
|
|
ae23c9 |
/* Drop references from requests still in flight, such as canceled block
|
|
|
ae23c9 |
diff --git a/qemu-nbd.c b/qemu-nbd.c
|
|
|
ae23c9 |
index 0af0560..51b9d38 100644
|
|
|
ae23c9 |
--- a/qemu-nbd.c
|
|
|
ae23c9 |
+++ b/qemu-nbd.c
|
|
|
ae23c9 |
@@ -482,6 +482,12 @@ static const char *socket_activation_validate_opts(const char *device,
|
|
|
ae23c9 |
return NULL;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+static void qemu_nbd_shutdown(void)
|
|
|
ae23c9 |
+{
|
|
|
ae23c9 |
+ job_cancel_sync_all();
|
|
|
ae23c9 |
+ bdrv_close_all();
|
|
|
ae23c9 |
+}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
int main(int argc, char **argv)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
BlockBackend *blk;
|
|
|
ae23c9 |
@@ -928,7 +934,7 @@ int main(int argc, char **argv)
|
|
|
ae23c9 |
exit(EXIT_FAILURE);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
bdrv_init();
|
|
|
ae23c9 |
- atexit(bdrv_close_all);
|
|
|
ae23c9 |
+ atexit(qemu_nbd_shutdown);
|
|
|
ae23c9 |
|
|
|
ae23c9 |
srcpath = argv[optind];
|
|
|
ae23c9 |
if (imageOpts) {
|
|
|
ae23c9 |
diff --git a/vl.c b/vl.c
|
|
|
ae23c9 |
index ce7d04d..f253876 100644
|
|
|
ae23c9 |
--- a/vl.c
|
|
|
ae23c9 |
+++ b/vl.c
|
|
|
ae23c9 |
@@ -4766,6 +4766,7 @@ int main(int argc, char **argv, char **envp)
|
|
|
ae23c9 |
/* No more vcpu or device emulation activity beyond this point */
|
|
|
ae23c9 |
vm_shutdown();
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+ job_cancel_sync_all();
|
|
|
ae23c9 |
bdrv_close_all();
|
|
|
ae23c9 |
|
|
|
ae23c9 |
res_free();
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|