Re: Splice on blocking TCP sockets again..
From: Eric Dumazet <hidden>
Date: 2009-09-30 06:00:14
Eric Dumazet a écrit :
Jason Gunthorpe a écrit :quoted
quoted
One way to handle this is to switch tcp_read() to use the underlying file O_NONBLOCK flag, as other socket operations do. And let SPLICE_F_NONBLOCK control the pipe output only.arg, this was tcp_splice_read() of coursequoted
Thanks Eric, this seems reasonable from my userspace perspective. I admit I don't understand why SPLICE_F_NONBLOCK exists, it seems very un-unixy to have a syscall completely ignore the NONBLOCK flag of the fd it is called on. Ie setting NONBLOCK on the pipe itself does nothing when using splice..Hmm, good question, I dont have the answer but I'll digg one.
commit 29e350944fdc2dfca102500790d8ad6d6ff4f69d splice: add SPLICE_F_NONBLOCK flag It doesn't make the splice itself necessarily nonblocking (because the actual file descriptors that are spliced from/to may block unless they have the O_NONBLOCK flag set), but it makes the splice pipe operations nonblocking. Signed-off-by: Linus Torvalds <torvalds@osdl.org> See Linus intention was pretty clear : O_NONBLOCK should be taken into account by 'actual file that are spliced from/to', regardless of SPLICE_F_NONBLOCK flag