Received: from eggs.gnu.org ([2001:4830:134:3::10]:39448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bU9M9-0007Xu-BO for qemu-devel@nongnu.org; Mon, 01 Aug 2016 05:17:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bU9M8-0003I5-F5 for qemu-devel@nongnu.org; Mon, 01 Aug 2016 05:17:53 -0400 References: <1469129688-22848-1-git-send-email-eblake@redhat.com> <1469129688-22848-3-git-send-email-eblake@redhat.com> From: Paolo Bonzini Message-ID: Date: Mon, 1 Aug 2016 11:17:42 +0200 MIME-Version: 1.0 In-Reply-To: <1469129688-22848-3-git-send-email-eblake@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/4] nbd: Limit nbdflags to 16 bits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, pl@kamp.de, qemu-stable@nongnu.org, Kevin Wolf , Max Reitz On 21/07/2016 21:34, Eric Blake wrote: > Furthermore, upstream NBD has never passed the global flags to > the kernel via ioctl(NBD_SET_FLAGS) (the ioctl was first > introduced in NBD 2.9.22; then a latent bug in NBD 3.1 actually > tried to OR the global flags with the transmission flags, with > the disaster that the addition of NBD_FLAG_NO_ZEROES in 3.9 > caused all earlier NBD 3.x clients to treat every export as > read-only; NBD 3.10 and later intentionally clip things to 16 > bits to pass only transmission flags). Qemu should follow suit, > since the current two global flags (NBD_FLAG_FIXED_NEWSTYLE > and NBD_FLAG_NO_ZEROES) have no impact on the kernel's behavior > during transmission. Should squash this in too: diff --git a/nbd/server.c b/nbd/server.c index 80fbb4d..6fa2f9c 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -575,7 +575,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) oldStyle = client->exp != NULL && !client->tlscreds; if (oldStyle) { - TRACE("advertising size %" PRIu64 " and flags %x", + TRACE("advertising size %" PRIu64 " and flags %" PRIx16, client->exp->size, client->exp->nbdflags | myflags); stq_be_p(buf + 8, NBD_CLIENT_MAGIC); stq_be_p(buf + 16, client->exp->size); @@ -605,7 +605,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data) goto fail; } - TRACE("advertising size %" PRIu64 " and flags %x", + TRACE("advertising size %" PRIu64 " and flags %" PRIx16, client->exp->size, client->exp->nbdflags | myflags); stq_be_p(buf + 18, client->exp->size); stw_be_p(buf + 26, client->exp->nbdflags | myflags);