diff options
author | Max Reitz <mreitz@redhat.com> | 2015-02-25 13:08:32 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-03-18 12:07:11 +0100 |
commit | 48c7d80de8863e3436b3b5d5676018b2afaec161 (patch) | |
tree | ea852d59333bedc0694878f566b265479c66352b /nbd.c | |
parent | 9c122adadbf4377eb77195b3944be10a59d9484f (diff) | |
download | qemu-48c7d80de8863e3436b3b5d5676018b2afaec161.zip qemu-48c7d80de8863e3436b3b5d5676018b2afaec161.tar.gz qemu-48c7d80de8863e3436b3b5d5676018b2afaec161.tar.bz2 |
nbd: Fix interpretation of the export flags
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>
Diffstat (limited to 'nbd.c')
-rw-r--r-- | nbd.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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"); |