Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758106AbXFSFgq (ORCPT ); Tue, 19 Jun 2007 01:36:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753042AbXFSFgg (ORCPT ); Tue, 19 Jun 2007 01:36:36 -0400 Received: from e6.ny.us.ibm.com ([32.97.182.146]:51780 "EHLO e6.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752311AbXFSFgf (ORCPT ); Tue, 19 Jun 2007 01:36:35 -0400 Subject: Re: [PATCH] relay-file-read-start-pos-fix.patch From: Tom Zanussi To: Masami Hiramatsu Cc: David Wilder , linux-kernel@vger.kernel.org, systemtap@sources.redhat.com, Yumiko Sugita , Satoshi Oshima , Hideo Aoki In-Reply-To: <467750E9.4090808@hitachi.com> References: <4676109F.8020202@us.ibm.com> <467750E9.4090808@hitachi.com> Content-Type: text/plain Date: Tue, 19 Jun 2007 00:35:00 -0500 Message-Id: <1182231301.30702.82.camel@ubuntu> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2035 Lines: 68 On Tue, 2007-06-19 at 12:43 +0900, Masami Hiramatsu wrote: > Hi David and Tom, > > David Wilder wrote: > > This patch fixes a bug in the relay read interface causing the number > > of consumed bytes to be set incorrectly. > > Thank you. Your patch fixes one of my concerns. > However there is another bug I found. > When I use relayfs with "overwrite" mode, read() still set incorrect > number of consumed bytes. > I tried to fix that. Please review it. Hi, Could you send more info on how to reproduce the problem you're seeing? And does this patch fix it? Thanks, Tom > > Signed-off-by: Masami Hiramatsu > > --- > kernel/relay.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > Index: linux-2.6.22-rc4-mm2/kernel/relay.c > =================================================================== > --- linux-2.6.22-rc4-mm2.orig/kernel/relay.c 2007-06-13 20:22:02.000000000 +0900 > +++ linux-2.6.22-rc4-mm2/kernel/relay.c 2007-06-18 23:00:54.000000000 +0900 > @@ -812,7 +812,10 @@ > } > > buf->bytes_consumed += bytes_consumed; > - read_subbuf = read_pos / buf->chan->subbuf_size; > + if (!read_pos) > + read_subbuf = buf->subbufs_consumed; > + else > + read_subbuf = read_pos / buf->chan->subbuf_size; > if (buf->bytes_consumed + buf->padding[read_subbuf] == subbuf_size) { > if ((read_subbuf == buf->subbufs_produced % n_subbufs) && > (buf->offset == subbuf_size)) > @@ -841,8 +844,9 @@ > } > > if (unlikely(produced - consumed >= n_subbufs)) { > - consumed = (produced / n_subbufs) * n_subbufs; > + consumed = produced - n_subbufs + 1; > buf->subbufs_consumed = consumed; > + buf->bytes_consumed = 0; > } > > produced = (produced % n_subbufs) * subbuf_size + buf->offset; > > > > - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/