From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Steven Whitehouse <swhiteho@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
rdenis@simphalempin.com, netdev@vger.kernel.org
Subject: Re: [PATCH 1/3] net: sendmmsg should only return an error if no messages were sent
Date: Fri, 5 Aug 2011 11:40:27 -0300 [thread overview]
Message-ID: <20110805144027.GA7560@ghostprotocols.net> (raw)
In-Reply-To: <1312532408.2762.4.camel@menhir>
Em Fri, Aug 05, 2011 at 09:20:08AM +0100, Steven Whitehouse escreveu:
> On Fri, 2011-08-05 at 12:57 +0900, Tetsuo Handa wrote:
> > Anton Blanchard wrote:
> > > sendmmsg uses a similar error return strategy as recvmmsg but it
> > > turns out to be a confusing way to communicate errors.
> > >
> > > The current code stores the error code away and returns it on the next
> > > sendmmsg call. This means a call with completely valid arguments could
> > > get an error from a previous call.
> > >
> > > Change things so we only return an error if no datagrams could be sent.
> > > If less than the requested number of messages were sent, the application
> > > must retry starting at the first failed one and if the problem is
> > > persistent the error will be returned.
> > >
> > > This matches the behaviour of other syscalls like read/write - it
> > > is not an error if less than the requested number of elements are sent.
> >
> > OK. David S. Miller suggested this behavior and Anton Blanchard agreed with
> > this behavior.
> >
> > Quoting from commit a2e27255 "net: Introduce recvmmsg socket syscall":
> > | . R?mi Denis-Courmont & Steven Whitehouse: If we receive N < vlen
> > | datagrams and then recvmsg returns an error, recvmmsg will return
> > | the successfully received datagrams, store the error and return it
> > | in the next call.
> >
> > R?mi Denis-Courmont, Steven Whitehouse and Arnaldo Carvalho de Melo, do you
> > want to change recvmmsg()'s behaviour as well?
>
> Since I've joined this part way through it seems, I'm assuming that if
> something was sent/received then that will be returned and the error
> stored until the next call. If nothing was sent/received then the error
> can be returned immediately.
>
> That is what I'd expect to be the case, since otherwise it is impossible
> to know how much has been successfully sent/received in the partial
> failure case, I think. Also it means that sendmmesg/recvmmsg matches
> sendmsg/recvmsg in terms of expected return values and thus the
> principle of least surprise.
>
> So if thats what is being proposed, then it sounds good to me,
Sounds sane to me too.
- Arnaldo
next prev parent reply other threads:[~2011-08-05 14:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-05 0:07 [PATCH 0/3] sendmmsg fixes Anton Blanchard
2011-08-05 0:07 ` [PATCH 1/3] net: sendmmsg should only return an error if no messages were sent Anton Blanchard
2011-08-05 3:57 ` Tetsuo Handa
2011-08-05 8:20 ` Steven Whitehouse
2011-08-05 14:40 ` Arnaldo Carvalho de Melo [this message]
2011-08-05 0:07 ` [PATCH 2/3] net: Cap number of elements for sendmmsg Anton Blanchard
2011-08-05 4:29 ` Tetsuo Handa
2011-08-05 4:46 ` Anton Blanchard
2011-08-05 5:50 ` Tetsuo Handa
2011-08-05 0:07 ` [PATCH 3/3] net: Fix security_socket_sendmsg() bypass problem Anton Blanchard
2011-08-05 0:38 ` Casey Schaufler
2011-08-05 10:31 ` [PATCH 0/3] sendmmsg fixes David Miller
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=20110805144027.GA7560@ghostprotocols.net \
--to=acme@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=rdenis@simphalempin.com \
--cc=swhiteho@redhat.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).