summaryrefslogtreecommitdiff
path: root/nbd.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-04-19 11:59:11 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-04-19 17:19:37 +0200
commite25ceb76e5b90ec4197cbe1cb859200bf6ee1284 (patch)
tree8e8f621867f93a431e3b45fb13bef8c0629a13cc /nbd.c
parent38ceff0412621a35fa618fb46cd7f0f6ff037c13 (diff)
downloadqemu-e25ceb76e5b90ec4197cbe1cb859200bf6ee1284.tar.gz
qemu-e25ceb76e5b90ec4197cbe1cb859200bf6ee1284.tar.bz2
qemu-e25ceb76e5b90ec4197cbe1cb859200bf6ee1284.zip
nbd: obey FUA on reads
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'nbd.c')
-rw-r--r--nbd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nbd.c b/nbd.c
index d4dafc6019..153709f628 100644
--- a/nbd.c
+++ b/nbd.c
@@ -842,6 +842,15 @@ static void nbd_trip(void *opaque)
case NBD_CMD_READ:
TRACE("Request type is READ");
+ if (request.type & NBD_CMD_FLAG_FUA) {
+ ret = bdrv_co_flush(exp->bs);
+ if (ret < 0) {
+ LOG("flush failed");
+ reply.error = -ret;
+ goto error_reply;
+ }
+ }
+
ret = bdrv_read(exp->bs, (request.from + exp->dev_offset) / 512,
req->data, request.len / 512);
if (ret < 0) {