mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
3d70ff53b6
commit
b3b5299d58
4
block.c
4
block.c
|
@ -3362,9 +3362,7 @@ static void bdrv_close(BlockDriverState *bs)
|
||||||
|
|
||||||
void bdrv_close_all(void)
|
void bdrv_close_all(void)
|
||||||
{
|
{
|
||||||
/* TODO We do want to cancel all jobs instead of just block jobs on
|
assert(job_next(NULL) == NULL);
|
||||||
* shutdown, but bdrv_close_all() isn't the right place any more. */
|
|
||||||
job_cancel_sync_all();
|
|
||||||
nbd_export_close_all();
|
nbd_export_close_all();
|
||||||
|
|
||||||
/* Drop references from requests still in flight, such as canceled block
|
/* Drop references from requests still in flight, such as canceled block
|
||||||
|
|
|
@ -482,6 +482,12 @@ static const char *socket_activation_validate_opts(const char *device,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void qemu_nbd_shutdown(void)
|
||||||
|
{
|
||||||
|
job_cancel_sync_all();
|
||||||
|
bdrv_close_all();
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
BlockBackend *blk;
|
BlockBackend *blk;
|
||||||
|
@ -928,7 +934,7 @@ int main(int argc, char **argv)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
bdrv_init();
|
bdrv_init();
|
||||||
atexit(bdrv_close_all);
|
atexit(qemu_nbd_shutdown);
|
||||||
|
|
||||||
srcpath = argv[optind];
|
srcpath = argv[optind];
|
||||||
if (imageOpts) {
|
if (imageOpts) {
|
||||||
|
|
1
vl.c
1
vl.c
|
@ -4683,6 +4683,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
/* No more vcpu or device emulation activity beyond this point */
|
/* No more vcpu or device emulation activity beyond this point */
|
||||||
vm_shutdown();
|
vm_shutdown();
|
||||||
|
|
||||||
|
job_cancel_sync_all();
|
||||||
bdrv_close_all();
|
bdrv_close_all();
|
||||||
|
|
||||||
res_free();
|
res_free();
|
||||||
|
|
Loading…
Reference in New Issue