After clearing our state (memset()-ing it to 0), we should re-initialize objects that need it. Specifically, that applies to s->lock, which is originally initialized in qcow2_open().
Given qemu_co_mutex_init() is just a memset() to 0, this is functionally a no-op, but still seems like the right thing to do. Signed-off-by: Hanna Czenczek <[email protected]> --- block/qcow2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 4aa9f9e068..d6e38926c8 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2873,6 +2873,8 @@ qcow2_co_invalidate_cache(BlockDriverState *bs, Error **errp) data_file = s->data_file; memset(s, 0, sizeof(BDRVQcow2State)); s->data_file = data_file; + /* Re-initialize objects initialized in qcow2_open() */ + qemu_co_mutex_init(&s->lock); options = qdict_clone_shallow(bs->options); -- 2.51.1
