From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751456AbaEYKSw (ORCPT ); Sun, 25 May 2014 06:18:52 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:61790 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751375AbaEYKSv (ORCPT ); Sun, 25 May 2014 06:18:51 -0400 Date: Sun, 25 May 2014 11:18:40 +0100 From: Hani Benhabiles To: Paul Clements Cc: "nbd-general@lists.sourceforge.net" , kernel list Subject: Re: [PATCH] nbd: Zero from and len fields in NBD_CMD_DISCONNECT. Message-ID: <20140525101840.GA3588@Inspiron-3521> References: <1400283807-27930-1-git-send-email-kroosec@gmail.com> <20140518091113.GA3770@Inspiron-3521> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140518091113.GA3770@Inspiron-3521> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 18, 2014 at 10:11:13AM +0100, Hani Benhabiles wrote: > On Fri, May 16, 2014 at 10:56:33PM -0400, Paul Clements wrote: > > Agreed. But better yet, the request structure should just be zeroed when > > it's allocated. > > > > It is already initialized in __nbd_ioctl() with the blk_rq_init() call which > sets the __sector value to -1 (which is 0xfffffffffffffe00 after the left shifts.) > > This is the only (non-ugly / non-intrusive) way to do it afaict. > Ping! Anything blocking this patch ? Thanks. > > -- > > Paul > > > > > > On Fri, May 16, 2014 at 7:43 PM, Hani Benhabiles wrote: > > > > > Len field is already set to zero, but not the from field which is sent as > > > 0xfffffffffffffe00. This makes no sense, and may cause confuse server > > > implementations doing sanity checks (qemu-nbd is an example.) > > > > > > Signed-off-by: Hani Benhabiles > > > --- > > > drivers/block/nbd.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c > > > index 3a70ea2..657bdac 100644 > > > --- a/drivers/block/nbd.c > > > +++ b/drivers/block/nbd.c > > > @@ -246,7 +246,7 @@ static int nbd_send_req(struct nbd_device *nbd, struct > > > request *req) > > > request.magic = htonl(NBD_REQUEST_MAGIC); > > > request.type = htonl(nbd_cmd(req)); > > > > > > - if (nbd_cmd(req) == NBD_CMD_FLUSH) { > > > + if (nbd_cmd(req) == NBD_CMD_FLUSH || nbd_cmd(req) == NBD_CMD_DISC) > > > { > > > /* Other values are reserved for FLUSH requests. */ > > > request.from = 0; > > > request.len = 0; > > > -- > > > 1.8.3.2 > > > > > >