return;
}
- if (blk->config_wce) {
- error_setg(errp, "device is incompatible with x-data-plane, "
- "use config-wce=off");
- return;
- }
-
/* If dataplane is (re-)enabled while the guest is running there could be
* block jobs that can conflict.
*/
struct virtio_blk_config blkcfg;
memcpy(&blkcfg, config, sizeof(blkcfg));
+
+ aio_context_acquire(bdrv_get_aio_context(s->bs));
bdrv_set_enable_write_cache(s->bs, blkcfg.wce != 0);
+ aio_context_release(bdrv_get_aio_context(s->bs));
}
static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features)
* s->bs would erroneously be placed in writethrough mode.
*/
if (!(features & (1 << VIRTIO_BLK_F_CONFIG_WCE))) {
- bdrv_set_enable_write_cache(s->bs, !!(features & (1 << VIRTIO_BLK_F_WCE)));
+ aio_context_acquire(bdrv_get_aio_context(s->bs));
+ bdrv_set_enable_write_cache(s->bs,
+ !!(features & (1 << VIRTIO_BLK_F_WCE)));
+ aio_context_release(bdrv_get_aio_context(s->bs));
}
}