Commit 2bc93fed authored by MORITA Kazutaka's avatar MORITA Kazutaka Committed by Kevin Wolf
Browse files

close all the block drivers before the qemu process exits



This patch calls the close handler of the block driver before the qemu
process exits.

This is necessary because the sheepdog block driver releases the lock
of VM images in the close handler.

Signed-off-by: default avatarMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 08a00559
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -648,6 +648,15 @@ void bdrv_close(BlockDriverState *bs)
    }
}

void bdrv_close_all(void)
{
    BlockDriverState *bs;

    QTAILQ_FOREACH(bs, &bdrv_states, list) {
        bdrv_close(bs);
    }
}

void bdrv_delete(BlockDriverState *bs)
{
    /* remove from list, if necessary */
+1 −0
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
/* Ensure contents are flushed to disk.  */
void bdrv_flush(BlockDriverState *bs);
void bdrv_flush_all(void);
void bdrv_close_all(void);

int bdrv_has_zero_init(BlockDriverState *bs);
int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
+1 −0
Original line number Diff line number Diff line
@@ -1991,6 +1991,7 @@ static void main_loop(void)
            vm_stop(r);
        }
    }
    bdrv_close_all();
    pause_all_vcpus();
}