All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@comcast.net>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [regression?] distcc says: (dcc_pump_sendfile) ERROR: sendfile returned 0? can't cope (bisected)
Date: Thu, 08 May 2008 23:22:19 -0500	[thread overview]
Message-ID: <1210306939.7205.9.camel@charm-linux> (raw)
In-Reply-To: <1210231275.7301.17.camel@charm-linux>


On Thu, 2008-05-08 at 02:21 -0500, Tom Zanussi wrote:
> On Wed, 2008-05-07 at 23:16 +0200, Jens Axboe wrote:
> > On Wed, May 07 2008, Dan Williams wrote:
> > > Hi Tom, Jens,
> > > 
> > > My build system started reporting these error messages recently.
> > > Reverting commit c3270e577c18b3d0e984c3371493205a4807db9d on top of
> > > 2.6.26-rc1 gets things working for me again.
> > 
> > Irk, that patch did scare me a bit (hence I asked Tom to double check as
> > wel :-). I'll take a look in the morning, all test boxes are off at this
> > point in time.
> > 
> 
> I did, and it still looks ok to me, but obviously it's not, so I'll have
> to do some more digging.
> 
> The only thing I can think of right now that might be a possible cause
> would be in splice_direct_to_actor(), if we had an incomplete transfer,
> the sd->pos returned and assigned would have the value set by the failed
> actor().  Maybe something like the following would take care of that
> case, but I haven't had a chance to test it yet - will do that tomorrow
> night...
> 

Looks like I was on the right track - can you try this patch out
instead?  It makes sure sd.pos is updated correctly if the transfer was
incomplete or failed.  I ran some kernel compiles using distcc while
running blktrace in sendfile mode and didn't see any problems with
either.

Tom

diff --git a/fs/splice.c b/fs/splice.c
index 633f58e..3bd95a7 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -986,7 +986,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
 
 	while (len) {
 		size_t read_len;
-		loff_t pos = sd->pos;
+		loff_t pos = sd->pos, prev_pos = pos;
 
 		ret = do_splice_to(in, &pos, pipe, len, flags);
 		if (unlikely(ret <= 0))
@@ -1001,15 +1001,19 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
 		 * could get stuck data in the internal pipe:
 		 */
 		ret = actor(pipe, sd);
-		if (unlikely(ret <= 0))
+		if (unlikely(ret <= 0)) {
+			sd->pos = prev_pos;
 			goto out_release;
+		}
 
 		bytes += ret;
 		len -= ret;
 		sd->pos = pos;
 
-		if (ret < read_len)
+		if (ret < read_len) {
+			sd->pos = prev_pos + ret;
 			goto out_release;
+		}
 	}
 
 done:



  reply	other threads:[~2008-05-09  4:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-07 21:13 [regression?] distcc says: (dcc_pump_sendfile) ERROR: sendfile returned 0? can't cope (bisected) Dan Williams
2008-05-07 21:16 ` Jens Axboe
2008-05-08  7:21   ` Tom Zanussi
2008-05-09  4:22     ` Tom Zanussi [this message]
2008-05-09 11:26       ` Jens Axboe
2008-05-09 18:01         ` Dan Williams
2008-05-09 19:17           ` Jens Axboe
2008-05-10  4:40             ` Tom Zanussi

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=1210306939.7205.9.camel@charm-linux \
    --to=zanussi@comcast.net \
    --cc=dan.j.williams@intel.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.