Re: [Nbd] BUG: read-command with data size 0 does not return a response header
- To: folkert <folkert@...421...>
- Cc: nbd-general@lists.sourceforge.net
- Subject: Re: [Nbd] BUG: read-command with data size 0 does not return a response header
- From: Wouter Verhelst <w@...112...>
- Date: Wed, 6 Mar 2013 12:54:52 +0100
- Message-id: <20130306115452.GB31421@...3...>
- In-reply-to: <20130304152921.GH14619@...855...>
- References: <20130304152921.GH14619@...855...>
On Mon, Mar 04, 2013 at 04:29:23PM +0100, folkert wrote:
> Hi,
>
> NBD-server v3.2 has a problem: if a client does a read-request of 0
> bytes in length, then the nbd-server does not return a response header.
> This is not in line with a write request which always returns a response
> header.
> This patch solves that behaviour:
applied.
> diff -uNrBbd nbd-3.2.org/nbd-server.c nbd-3.2/nbd-server.c
> --- nbd-3.2.org/nbd-server.c 2012-07-03 22:54:53.000000000 +0200
> +++ nbd-3.2/nbd-server.c 2013-03-04 16:21:04.000000000 +0100
> @@ -1821,11 +1821,11 @@
>
> case NBD_CMD_READ:
> DEBUG("exp->buf, ");
> - memcpy(buf, &reply, sizeof(struct nbd_reply));
> if (client->transactionlogfd != -1)
> writeit(client->transactionlogfd, &reply, sizeof(reply));
> - p = buf + sizeof(struct nbd_reply);
> - writelen = currlen + sizeof(struct nbd_reply);
> + writeit(client->net, &reply, sizeof(reply));
> + p = buf;
> + writelen = currlen;
> while(len > 0) {
> if (expread(request.from, p, currlen, client)) {
> DEBUG("Read failed: %m");
>
> After applying this fix, I measured that nbd-server has a latency of
> 0.02ms which is quite nice!
>
>
> Folkert van Heusden
>
> --
> MultiTail na wan makriki wrokosani fu tan luku den logfile nanga san
> den commando spiti puru. Piki puru spesrutu sani, wroko nanga difrenti
> kroru, tya kon makandra, nanga wan lo moro.
> http://www.vanheusden.com/multitail/
> ----------------------------------------------------------------------
> Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Nbd-general mailing list
> Nbd-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nbd-general
>
--
Copyshops should do vouchers. So that next time some bureaucracy requires you
to mail a form in triplicate, you can mail it just once, add a voucher, and
save on postage.
Reply to: