From: Jeff Garzik <jeff@garzik.org>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: Re: [Patch 1/2] tabled: fix bugs in streaming of data
Date: Tue, 05 Jan 2010 04:13:36 -0500 [thread overview]
Message-ID: <4B4302C0.9080007@garzik.org> (raw)
In-Reply-To: <20100105002749.4e13eb50@redhat.com>
On 01/05/2010 02:27 AM, Pete Zaitcev wrote:
> This patch fixes 3 plain coding bugs in the streaming mechanism.
>
> 1. Whenever we loop back to "restart" label, we have to clear n_iov.
> Otherwise, the loop that fills iov[] writes beyond the end of the
> array. The result is binary garbage on console and a hang.
>
> Behold the evils of initialized variables. Fix is obvious.
>
> BTW, array indexes are signed.
>
> 2. When we consume a queue element partially, we ought to advance its
> buffer pointer when we decrement the length. Otherwise, we resend
> the data that was sent already, causing a corruption in transfer.
>
> The fix is obvious (add tmp->buf += sz).
>
> 3. The accounting (through unfortunately named write_cnt) was incorrect
> because wr->len may be decremented by the time the element is freed.
>
> Since we're at it, we implement a couple of safety improvements.
> First, we change the API to the callback a little. From now on, it
> does not have access to the struct client_write anymore, and cannot
> accidentially rely on wr->buf (which can be changed now).
> Also, we renamed "len" into "togo" and named the new member "length",
> to make sure that all use instances for "len" were reviewed.
>
> Signed-Off-By: Pete Zaitcev<zaitcev@redhat.com>
>
> ---
> server/object.c | 8 +++-----
> server/server.c | 31 ++++++++++++++++---------------
> server/tabled.h | 11 ++++++-----
> 3 files changed, 25 insertions(+), 25 deletions(-)
applied... chunkd needs these fixes also, yes?
next prev parent reply other threads:[~2010-01-05 9:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-05 7:27 [Patch 1/2] tabled: fix bugs in streaming of data Pete Zaitcev
2010-01-05 9:13 ` Jeff Garzik [this message]
2010-01-06 4:02 ` Pete Zaitcev
2010-01-07 22:10 ` Jeff Garzik
2010-01-07 22:27 ` Pete Zaitcev
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=4B4302C0.9080007@garzik.org \
--to=jeff@garzik.org \
--cc=hail-devel@vger.kernel.org \
--cc=zaitcev@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.