Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket O_NONBLOCK

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Evgeniy Polyakov <johnpol@...>
Cc: <netdev@...>, <linux-kernel@...>
Date: Thursday, July 17, 2008 - 5:52 pm

On Thursday 17 July 2008, Evgeniy Polyakov wrote:

You lost me here :)

The way I interpret the man page text is that it is ok for splice to block, 
even if SPLICE_F_NONBLOCK is set. The comments near SPLICE_F_NONBLOCK says 
the same thing:

#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
                                 /* we may still block on the fd we splice */
                                 /* from/to, of course */

Am I missing something?


For this "program":

x=splice(socket, pipe, size, flags=0); 
if (x > 0)
	splice(pipe, file, x, flags=0);

it is hard to come up with a non tiny value for size that does not deadlock 
the program, because the pipe size is measured in packets and not bytes and 
we have no control over the packet sizes.

For example, if we set size=17 and we are unlucky and get 16 packets of 1 byte 
in a row, at the right time, the first splice call will block - and the 
program will deadlock since we can't reach the consumer. 

Thanks,
tavi
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Evgeniy Polyakov, (Thu Jul 17, 10:21 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Octavian Purdila, (Thu Jul 17, 10:47 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Octavian Purdila, (Thu Jul 17, 5:52 pm)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Octavian Purdila, (Fri Jul 18, 10:04 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Evgeniy Polyakov, (Fri Jul 18, 10:32 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Octavian Purdila, (Fri Jul 18, 11:50 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Evgeniy Polyakov, (Fri Jul 18, 12:00 pm)