Message ID | 20200629182642.1170387-10-its@irrelevant.dk |
---|---|
State | New |
Headers | show |
Series | None | expand |
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 39e680a15c56..c2507d8836fd 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1153,6 +1153,10 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) break; case NVME_VOLATILE_WRITE_CACHE: + if (!(dw11 & 0x1) && blk_enable_write_cache(n->conf.blk)) { + blk_flush(n->conf.blk); + } + blk_set_enable_write_cache(n->conf.blk, dw11 & 1); break; case NVME_NUMBER_OF_QUEUES: