From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28421 invoked by alias); 19 Jun 2007 05:36:41 -0000 Received: (qmail 28413 invoked by uid 22791); 19 Jun 2007 05:36:41 -0000 X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,DNS_FROM_RFC_ABUSE,SPF_PASS,TW_YF X-Spam-Check-By: sourceware.org Received: from e3.ny.us.ibm.com (HELO e3.ny.us.ibm.com) (32.97.182.143) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 19 Jun 2007 05:36:38 +0000 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e3.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id l5J4XZCQ012475 for ; Tue, 19 Jun 2007 00:33:35 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l5J5aYYe551908 for ; Tue, 19 Jun 2007 01:36:34 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l5J5aYoR025041 for ; Tue, 19 Jun 2007 01:36:34 -0400 Received: from [192.168.202.129] (wecm-9-67-39-57.wecm.ibm.com [9.67.39.57]) by d01av02.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l5J5aTrR024956; Tue, 19 Jun 2007 01:36:33 -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 05:36:00 -0000 Message-Id: <1182231301.30702.82.camel@ubuntu> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2007-q2/txt/msg00609.txt.bz2 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; > > > >