From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYC73-0007aK-Bk for qemu-devel@nongnu.org; Wed, 18 Mar 2015 07:26:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYC72-0001m5-JF for qemu-devel@nongnu.org; Wed, 18 Mar 2015 07:26:13 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:32774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYC72-0001ly-D5 for qemu-devel@nongnu.org; Wed, 18 Mar 2015 07:26:12 -0400 Received: by wixw10 with SMTP id w10so62153754wix.0 for ; Wed, 18 Mar 2015 04:26:12 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 18 Mar 2015 12:24:58 +0100 Message-Id: <1426677906-51657-12-git-send-email-pbonzini@redhat.com> In-Reply-To: <1426677906-51657-1-git-send-email-pbonzini@redhat.com> References: <1426677906-51657-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 11/19] nbd: Fix interpretation of the export flags List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Max Reitz From: Max Reitz 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 Message-Id: <1424887718-10800-20-git-send-email-mreitz@redhat.com> Signed-off-by: Paolo Bonzini --- nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbd.c b/nbd.c index fb8a4d4..563e820 100644 --- 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"); -- 2.3.0