]> git.proxmox.com Git - mirror_qemu.git/commitdiff
nbd: Fix interpretation of the export flags
authorMax Reitz <mreitz@redhat.com>
Wed, 25 Feb 2015 18:08:32 +0000 (13:08 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 18 Mar 2015 11:07:11 +0000 (12:07 +0100)
The export flags are a 16 bit value, so be16_to_cpu() has to be used to
interpret them correctly. This makes discard and flush actually work
for named NBD exports (they did not work before, because the client
always assumed them to be unsupported because of the bug fixed by this
patch).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <1424887718-10800-20-git-send-email-mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd.c

diff --git a/nbd.c b/nbd.c
index fb8a4d47f351df5ac5a475d81dac7387c776d38f..563e8207d1534d5f258f26666208a13eb3eeb881 100644 (file)
--- a/nbd.c
+++ b/nbd.c
@@ -625,7 +625,7 @@ int nbd_receive_negotiate(int csock, const char *name, uint32_t *flags,
             error_setg(errp, "Failed to read export flags");
             goto fail;
         }
-        *flags |= be32_to_cpu(tmp);
+        *flags |= be16_to_cpu(tmp);
     }
     if (read_sync(csock, &buf, 124) != 124) {
         error_setg(errp, "Failed to read reserved block");