From: David Miller <davem@davemloft.net>
To: xemul@parallels.com
Cc: eric.dumazet@gmail.com, tj@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] datagram: Extend the datagram queue MSG_PEEK-ing
Date: Tue, 21 Feb 2012 00:01:01 -0500 (EST) [thread overview]
Message-ID: <20120221.000101.921848983774820950.davem@davemloft.net> (raw)
In-Reply-To: <4F4239C7.6040905@parallels.com>
From: Pavel Emelyanov <xemul@parallels.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.
prev parent reply other threads:[~2012-02-21 5:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 13:54 [PATCH] datagram: Extend the datagram queue MSG_PEEK-ing Pavel Emelyanov
2012-02-10 14:41 ` Eric Dumazet
2012-02-10 14:52 ` Pavel Emelyanov
2012-02-15 20:52 ` David Miller
2012-02-20 12:17 ` Pavel Emelyanov
2012-02-21 5:01 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120221.000101.921848983774820950.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tj@kernel.org \
--cc=xemul@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).