[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20120221.000101.921848983774820950.davem@davemloft.net>
Date: Tue, 21 Feb 2012 00:01:01 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: xemul@...allels.com
Cc: eric.dumazet@...il.com, tj@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] datagram: Extend the datagram queue MSG_PEEK-ing
From: Pavel Emelyanov <xemul@...allels.com>
Date: Mon, 20 Feb 2012 16:17:11 +0400
> I was thinking about another option of doing the same, how about introducing
> the peek offset member on sock (get/set via sockopt) which works like
>
> * if == -1, then peek works as before
> * if >= 0, then each peek/recvmsg will increase/decrease the value so that
> the next peek peeks next data
>
> It's questionable what to do if the peek_off points into the middle of a
> datagram however. Here's an example of how this looks for datagram sockets
> (tested on pf_unix), for stream this requires more patching.
>
> What do you think? Does it make sense to go on with this making other
> ->recvmsg handlers support peeking offset?
I think you need to add some kind of locking to this for sanity, for
example right now you're doing test/decide/store decisions over
sk_peek_off inside of __skb_recv_datagram() without the socket lock,
yet another thread can set the SO_PEEK_OFF in parallel.
The locking decision will probably be worse for stream sockets.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists