From 01b452c8ca900c2b4384d6260a0cc5450a65c3d7 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 20 Feb 2008 10:34:51 +0100 Subject: [PATCH] --- yaml --- r: 86717 b: refs/heads/master c: 02cf01aea5af7a4d1a38045712fe11bffcc206b0 h: refs/heads/master i: 86715: ee5d655397137097e97880c95c8b4502344bf879 v: v3 --- [refs] | 2 +- trunk/fs/splice.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index dfd1979c9589..87db8102bfa4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5d87a052c7e5f245bbb3018721b4b0afe0afc252 +refs/heads/master: 02cf01aea5af7a4d1a38045712fe11bffcc206b0 diff --git a/trunk/fs/splice.c b/trunk/fs/splice.c index 9b559ee711a8..0670c915cd35 100644 --- a/trunk/fs/splice.c +++ b/trunk/fs/splice.c @@ -1669,6 +1669,13 @@ static int link_pipe(struct pipe_inode_info *ipipe, i++; } while (len); + /* + * return EAGAIN if we have the potential of some data in the + * future, otherwise just return 0 + */ + if (!ret && ipipe->waiting_writers && (flags & SPLICE_F_NONBLOCK)) + ret = -EAGAIN; + inode_double_unlock(ipipe->inode, opipe->inode); /* @@ -1709,11 +1716,8 @@ static long do_tee(struct file *in, struct file *out, size_t len, ret = link_ipipe_prep(ipipe, flags); if (!ret) { ret = link_opipe_prep(opipe, flags); - if (!ret) { + if (!ret) ret = link_pipe(ipipe, opipe, len, flags); - if (!ret && (flags & SPLICE_F_NONBLOCK)) - ret = -EAGAIN; - } } }