mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hani Benhabiles <kroosec@gmail.com>
To: Paul Clements <paul.clements@us.sios.com>
Cc: "nbd-general@lists.sourceforge.net" 
	<nbd-general@lists.sourceforge.net>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nbd: Zero from and len fields in NBD_CMD_DISCONNECT.
Date: Sun, 18 May 2014 10:11:13 +0100	[thread overview]
Message-ID: <20140518091113.GA3770@Inspiron-3521> (raw)
In-Reply-To: <CAECXXi4_RJ-yk8Ct=sPPe-pq=shdU-4cKvRTT3yNvsoY42-8_Q@mail.gmail.com>

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.

> --
> Paul
> 
> 
> On Fri, May 16, 2014 at 7:43 PM, Hani Benhabiles <kroosec@gmail.com> 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 <hani@linux.com>
> > ---
> >  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
> >
> >

  parent reply	other threads:[~2014-05-18  9:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 23:43 Hani Benhabiles
     [not found] ` <CAECXXi4_RJ-yk8Ct=sPPe-pq=shdU-4cKvRTT3yNvsoY42-8_Q@mail.gmail.com>
2014-05-18  9:11   ` Hani Benhabiles [this message]
2014-05-25 10:18     ` Hani Benhabiles
2014-05-25 18:11       ` Paul Clements
2014-05-25 21:54         ` Hani Benhabiles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140518091113.GA3770@Inspiron-3521 \
    --to=kroosec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd-general@lists.sourceforge.net \
    --cc=paul.clements@us.sios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome