From: Krystad, Peter <peter.krystad at intel.com>
To: mptcp at lists.01.org
Subject: Re: [MPTCP] [RFC PATCH v3 10/16] mptcp: Add shutdown() socket operation
Date: Wed, 10 Oct 2018 20:42:54 +0000 [thread overview]
Message-ID: <1539204164.19533.35.camel@intel.com> (raw)
In-Reply-To: dab89dd1-671b-32f5-c2fd-0127d9b2d16e@tessares.net
[-- Attachment #1: Type: text/plain, Size: 2421 bytes --]
On Wed, 2018-10-10 at 14:43 +0200, Matthieu Baerts wrote:
> Hi Peter,
>
> On 06/10/2018 00:59, Mat Martineau wrote:
> > From: Peter Krystad <peter.krystad(a)intel.com>
> >
> > Signed-off-by: Peter Krystad <peter.krystad(a)intel.com>
> > ---
> > net/mptcp/protocol.c | 21 ++++++++++++++++++++-
> > 1 file changed, 20 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> > index 2fa9031a77ca..3d10ab287bd6 100644
> > --- a/net/mptcp/protocol.c
> > +++ b/net/mptcp/protocol.c
> > @@ -255,6 +255,25 @@ int mptcp_stream_accept(struct socket *sock, struct socket *newsock, int flags,
> > return inet_accept(sock, newsock, flags, kern);
> > }
> >
> > +int mptcp_stream_shutdown(struct socket *sock, int how)
> > +{
> > + struct mptcp_sock *msk = mptcp_sk(sock->sk);
> > + int ret = 0;
> > +
> > + pr_debug("sk=%p, how=%d", msk, how);
> > +
> > + if (msk->subflow) {
> > + pr_debug("subflow=%p", msk->subflow->sk);
> > + ret = kernel_sock_shutdown(msk->subflow, how);
> > + }
> > + if (msk->connection_list) {
> > + pr_debug("conn_list->subflow=%p", msk->connection_list->sk);
> > + ret = kernel_sock_shutdown(msk->connection_list, how);
>
> Just to be sure, can we have "subflow != NULL" and "connection_list !=
> NULL"?
> Because I saw the possible override of "ret" here but it is not possible
> to have both a "subflow" and a "connection_list" (we could use a "else
> if" here I guess).
Your point is good, it should not be possible for them both to be set.
But in a future commit the connection_list will become a real rcu
linked list of subflows and a single lock will be used to protect the
list and the subflow field. When the in-progress subflow is done
connecting it will be moved to the connection list under lock
protection.
Peter.
> Cheers,
> Matthieu
>
> > + }
> > +
> > + return ret;
> > +}
> > +
> > static struct proto mptcp_prot = {
> > .name = "MPTCP",
> > .owner = THIS_MODULE,
> > @@ -284,7 +303,7 @@ const struct proto_ops mptcp_stream_ops = {
> > .poll = tcp_poll,
> > .ioctl = inet_ioctl,
> > .listen = mptcp_stream_listen,
> > - .shutdown = inet_shutdown,
> > + .shutdown = mptcp_stream_shutdown,
> > .setsockopt = sock_common_setsockopt,
> > .getsockopt = sock_common_getsockopt,
> > .sendmsg = inet_sendmsg,
> >
>
>
next reply other threads:[~2018-10-10 20:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 20:42 Krystad, Peter [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-10-11 11:24 [MPTCP] [RFC PATCH v3 10/16] mptcp: Add shutdown() socket operation Matthieu Baerts
2018-10-10 12:43 Matthieu Baerts
2018-10-05 22:59 Mat Martineau
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=1539204164.19533.35.camel@intel.com \
--to=unknown@example.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.