From: Jens Axboe <jens.axboe@oracle.com>
To: James Morris <jmorris@namei.org>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: TCP stalls in current git, possibly splice related
Date: Fri, 13 Jul 2007 11:25:30 +0200 [thread overview]
Message-ID: <20070713092529.GA5328@kernel.dk> (raw)
In-Reply-To: <20070713062624.GE4587@kernel.dk>
On Fri, Jul 13 2007, Jens Axboe wrote:
> On Fri, Jul 13 2007, Jens Axboe wrote:
> > On Thu, Jul 12 2007, James Morris wrote:
> > > On Thu, 12 Jul 2007, David Miller wrote:
> > >
> > > > From: James Morris <jmorris@namei.org>
> > > > Date: Thu, 12 Jul 2007 16:12:25 -0400 (EDT)
> > > >
> > > > > I'm seeing TCP connection stalls with current git, and a bisect found the
> > > > > following as a possible cause:
> > > >
> > > > To add to this James is seeing this with distcc I believe.
> > >
> > > Correct.
> >
> > I'll try and reproduce.
>
> You didn't happen to get a sysrq-t backtrace of that distcc being hung,
> did you?
Does this work for you?
diff --git a/fs/splice.c b/fs/splice.c
index ed2ce99..92646aa 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -491,7 +491,7 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
ret = 0;
spliced = 0;
- while (len) {
+ while (len && !spliced) {
ret = __generic_file_splice_read(in, ppos, pipe, len, flags);
if (ret < 0)
@@ -1051,15 +1051,10 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
sd->flags &= ~SPLICE_F_NONBLOCK;
while (len) {
- size_t read_len, max_read_len;
-
- /*
- * Do at most PIPE_BUFFERS pages worth of transfer:
- */
- max_read_len = min(len, (size_t)(PIPE_BUFFERS*PAGE_SIZE));
+ size_t read_len;
- ret = do_splice_to(in, &sd->pos, pipe, max_read_len, flags);
- if (unlikely(ret < 0))
+ ret = do_splice_to(in, &sd->pos, pipe, len, flags);
+ if (unlikely(ret <= 0))
goto out_release;
read_len = ret;
@@ -1071,26 +1066,17 @@ 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))
goto out_release;
bytes += ret;
len -= ret;
- /*
- * In nonblocking mode, if we got back a short read then
- * that was due to either an IO error or due to the
- * pagecache entry not being there. In the IO error case
- * the _next_ splice attempt will produce a clean IO error
- * return value (not a short read), so in both cases it's
- * correct to break out of the loop here:
- */
- if ((flags & SPLICE_F_NONBLOCK) && (read_len < max_read_len))
- break;
+ if (ret < read_len)
+ goto out_release;
}
pipe->nrbufs = pipe->curbuf = 0;
-
return bytes;
out_release:
@@ -1152,10 +1138,12 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
.pos = *ppos,
.u.file = out,
};
- size_t ret;
+ long ret;
ret = splice_direct_to_actor(in, &sd, direct_splice_actor);
- *ppos = sd.pos;
+ if (ret > 0)
+ *ppos += ret;
+
return ret;
}
--
Jens Axboe
next prev parent reply other threads:[~2007-07-13 9:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-12 20:12 TCP stalls in current git, possibly splice related James Morris
2007-07-12 20:52 ` David Miller
2007-07-13 2:26 ` James Morris
2007-07-13 5:36 ` Jens Axboe
2007-07-13 6:26 ` Jens Axboe
2007-07-13 9:25 ` Jens Axboe [this message]
2007-07-13 10:02 ` Johannes Berg
2007-07-13 11:05 ` Jens Axboe
2007-07-13 12:23 ` James Morris
2007-07-13 21:55 ` Johannes Berg
2007-07-16 8:45 ` Johannes Berg
2007-07-16 12:02 ` Jens Axboe
2007-07-17 22:36 ` Johannes Berg
2007-07-18 10:49 ` Jens Axboe
2007-07-18 10:58 ` Johannes Berg
2007-07-18 21:24 ` Johannes Berg
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=20070713092529.GA5328@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=netdev@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.