Re: race in skb_splice_bits?
From: Evgeniy Polyakov <hidden>
Date: 2008-05-28 08:52:57
On Wed, May 28, 2008 at 02:59:30AM +0300, Octavian Purdila (opurdila@ixiacom.com) wrote:
One doubt though: suppose that while we drop the lock the skb gets aggregated with the one after it. If the original skb is fully consumed in the receive actor, then the we will eat the new, aggregated skb, loosing data.
How can it be aggregated with another skb? It is only possible that some other reader consumes the data, but in that case sequence number will not match and we will not find skb.
Here is a patch, based on your idea, which tries to cope with the above scenario. The !skb check was added for the case in which the actor does not consume anything in the current interration.
If it does not get any data, then skb will likely exists and will be consumed in the next run. I preserved old semantic, when we free skb only if we read it whole or in case of fin. With your changes we can also free skb, if it was partially consumed and do not free it at all if skb was not processed becuase it is too old (i.e. it lives in receive queue, but we already read data siwth sequnce number, which corresponds to it), no? -- Evgeniy Polyakov