public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johann Felix Soden <johfel@gmx.de>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Patrick McManus <mcmanus@ducksong.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NONBLOCK
Date: Tue, 19 Feb 2008 21:14:51 +0100	[thread overview]
Message-ID: <1203452091.7758.5.camel@localhost> (raw)

From: Johann Felix Soden <johfel@users.sourceforge.net>

With SPLICE_F_NONBLOCK sys_tee should return number of duplicated bytes,
not only -EAGAIN on success.

This patch also solves the problem, which is described on
http://article.gmane.org/gmane.linux.kernel/642502.

Signed-off-by: Johann Felix Soden <johfel@users.sourceforge.net>
---
 fs/splice.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index 9b559ee..184fd66 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1711,7 +1711,7 @@ static long do_tee(struct file *in, struct file *out, size_t len,
 			ret = link_opipe_prep(opipe, flags);
 			if (!ret) {
 				ret = link_pipe(ipipe, opipe, len, flags);
-				if (!ret && (flags & SPLICE_F_NONBLOCK))
+				if (ret < 0 && (flags & SPLICE_F_NONBLOCK))
 					ret = -EAGAIN;
 			}
 		}
-- 
1.5.4.2



             reply	other threads:[~2008-02-19 20:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 20:14 Johann Felix Soden [this message]
2008-02-19 20:25 ` [PATCH] splice: fix problem with sys_tee and SPLICE_F_NONBLOCK Jens Axboe
2008-02-19 21:12   ` Johann Felix Soden
2008-02-19 21:25     ` Jens Axboe
2008-02-19 21:47       ` Johann Felix Soden
2008-02-20  9:35         ` Jens Axboe
2008-02-20 10:07           ` Johann Felix v. Soden-Fr.
2008-02-20 10:39             ` Jens Axboe
2008-02-20 16:31           ` Patrick McManus

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=1203452091.7758.5.camel@localhost \
    --to=johfel@gmx.de \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcmanus@ducksong.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox