login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
February
»
20
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NONBLOCK
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From:
Jens Axboe <jens.axboe@...>
To: Johann Felix v. Soden-Fr. <johfel@...>
Cc: Patrick McManus <mcmanus@...>, <linux-kernel@...>
Subject:
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NONBLOCK
Date: Wednesday, February 20, 2008 - 6:39 am
On Wed, Feb 20 2008, Johann Felix v. Soden-Fr. wrote:
quoted text
> On Wed, Feb 20, 2008 at 10:35:28AM +0100, Jens Axboe wrote: > > On Tue, Feb 19 2008, Johann Felix Soden wrote: > > > > > > Am Dienstag, den 19.02.2008, 22:25 +0100 schrieb Jens Axboe: > > > > On Tue, Feb 19 2008, Johann Felix Soden wrote: > > > > > > On Tue, Feb 19 2008, Johann Felix Soden wrote: > > > > > > > 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. > > > > > > > > > > > > ? > > > > > > > > > > > > The current behaviour is to return bytes tee'd, or return -EAGAIN for > > > > > > zero bytes if SPLICE_F_NONBLOCK is set. It doesn't return "-EAGAIN on > > > > > > success", not sure what you mean there. > > > > > > > > > > > Sorry, my patch description was not correct. > > > > > > > > > > The new behavior of sys_tee with my patch is: > > > > > - return -EAGAIN if there are no data in the pipe, but writer > > > > > connected to the pipe, > > > > > - return 0 if there are not writers connected > > > > > - else return number of duplicated byte > > > > > > > > > > The old behavior was: return -EAGAIN or the number (>0) of duplicated > > > > > bytes. > > > > > > > > Your patch has an odd way of achieving that goal, modify the real > > > > location of the assignment instead of overriding something. That has the > > > > potential to turn into another confusing bug later on, wondering why the > > > > heck your return value isn't being passed back. > > > > > > > > Improvement is welcome though, you can't distuingish -EAGAIN on the > > > > input side from the output side currently. > > > > > > When non-blocking is set, ideally we want to return 0 if there's no hope > > of anymore data and EAGAIN if trying later may yield some data. So how > > about this instead? > > > > diff --git a/fs/splice.c b/fs/splice.c > > index 9b559ee..0670c91 100644 > > --- a/fs/splice.c > > +++ b/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; > > - } > > } > > } > > > > Thanks! This works great. > Add if you want: Tested-by: Johann Felix Soden <johfel@users.sourceforge.net>
Thanks for testing that it works as expected, I'll commit and add your tested-by. -- Jens Axboe --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH] splice: fix problem with sys_tee and SPLICE_F_NONBLOCK
, Johann Felix Soden
, (Tue Feb 19, 4:14 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NO...
, Jens Axboe
, (Tue Feb 19, 4:25 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NO...
, Johann Felix Soden
, (Tue Feb 19, 5:12 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NO...
, Jens Axboe
, (Tue Feb 19, 5:25 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NO...
, Johann Felix Soden
, (Tue Feb 19, 5:47 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NO...
, Jens Axboe
, (Wed Feb 20, 5:35 am)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NO...
, Patrick McManus
, (Wed Feb 20, 12:31 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NO...
, Johann Felix v. Soden-Fr....
, (Wed Feb 20, 6:07 am)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_NO...
, Jens Axboe
, (Wed Feb 20, 6:39 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Bart Van Assche
Integration of SCST in the mainstream Linux kernel
Greg Kroah-Hartman
[PATCH 005/196] Chinese: add translation of SubmittingDrivers
Thomas Kuther
IT821x: no DMA since 2.6.21
Andre Noll
Re: Linus 2.6.23-rc1
git
:
linux-netdev
:
Gerrit Renker
[PATCH 13/37] dccp: Deprecate Ack Ratio sysctl
Corey Minyard
[PATCH 3/3] Convert the UDP hash lock to RCU
Jarek Poplawski
[PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
David Miller
[GIT]: Networking
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
2 users
and
677 guests
online.
Online users
arvindbabu
Calorizator
Syndicate