From patchwork Thu May 27 16:53:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Abeni X-Patchwork-Id: 12284905 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D01170 for ; Thu, 27 May 2021 16:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622134398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3+HuBRfU/qb/NiMgJ4TcpPumyAhp4ui4+Pe6lYR3Hsw=; b=LzQW/u28OVomHPSpn5cAj7uhuW+LPorh23z2XDcNKN32+jNcKs4RBPc6Lw0mFsiiwNt7S4 1qQohuk3t2HyzbfiKx8ndISSkzTWtIDUbUMyoX1ifWUvRVGNtYmo+yUVOUHGJ+zmO/yibJ 7FU3nhive+PUgB6aq/P9Q1qNHx1fjKc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-b_us29eDNWCzWDgAgzFGgA-1; Thu, 27 May 2021 12:53:16 -0400 X-MC-Unique: b_us29eDNWCzWDgAgzFGgA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9C3F501E8 for ; Thu, 27 May 2021 16:53:15 +0000 (UTC) Received: from gerbillo.redhat.com (ovpn-114-53.ams2.redhat.com [10.36.114.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FAAE510ED for ; Thu, 27 May 2021 16:53:15 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-next 1/2] mptcp: don't clear MPTCP_DATA_READY in sk_wait_event() Date: Thu, 27 May 2021 18:53:04 +0200 Message-Id: In-Reply-To: References: X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com If we don't flush entirely the receive queue, we need set again such bit later. We can simply avoid clearing it. Signed-off-by: Paolo Abeni --- net/mptcp/protocol.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 1e77d2defd28..a08ea8867716 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1711,7 +1711,7 @@ static void mptcp_wait_data(struct sock *sk, long *timeo) sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); sk_wait_event(sk, timeo, - test_and_clear_bit(MPTCP_DATA_READY, &msk->flags), &wait); + test_bit(MPTCP_DATA_READY, &msk->flags), &wait); sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); remove_wait_queue(sk_sleep(sk), &wait); @@ -2032,10 +2032,8 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, */ if (unlikely(__mptcp_move_skbs(msk))) set_bit(MPTCP_DATA_READY, &msk->flags); - } else if (unlikely(!test_bit(MPTCP_DATA_READY, &msk->flags))) { - /* data to read but mptcp_wait_data() cleared DATA_READY */ - set_bit(MPTCP_DATA_READY, &msk->flags); } + out_err: if (cmsg_flags && copied >= 0) { if (cmsg_flags & MPTCP_CMSG_TS) From patchwork Thu May 27 16:53:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Abeni X-Patchwork-Id: 12284907 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 890D22FB4 for ; Thu, 27 May 2021 16:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622134399; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7c6DRvhA7xGIsqas31NB4sv0D3Dw0lAaj82iUdqhsas=; b=gs8sKo9GEGkwGouNW3CajUgUEnDDogNVU4FQn4dzx3oPI/rDEoYUs+JAUHgYLkmpZwGBJ9 3aUgZXTufcV02k+Xj3xC1Ny16sWQrjpwTmnkthuiSd5Ahzqc37PZ/yFqKtdh3Ap7BndFKU Hu5aIRnwqitoP6p2+coSkiVlXJR/o7Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270-7RP_wAyANMS9SUW5m6fSRQ-1; Thu, 27 May 2021 12:53:17 -0400 X-MC-Unique: 7RP_wAyANMS9SUW5m6fSRQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2EBDE8015F8 for ; Thu, 27 May 2021 16:53:17 +0000 (UTC) Received: from gerbillo.redhat.com (ovpn-114-53.ams2.redhat.com [10.36.114.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B5461349A for ; Thu, 27 May 2021 16:53:16 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-next 2/2] mptcp: drop rendundant test in move_skbs_to_msk() Date: Thu, 27 May 2021 18:53:05 +0200 Message-Id: <627c15b052e2ecf4a2c6a897a83da7e25db55f32.1622132917.git.pabeni@redhat.com> In-Reply-To: References: X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Currently we check the msk state to avoid enqueuing new skbs at msk shutdown time. Such test is racy - as we can't acquire the msk socket lock - and useless, as the caller already checked the subflow field 'disposable', covering the same scenario in a race free manner - read and updated under the ssk socket lock. Signed-off-by: Paolo Abeni --- net/mptcp/protocol.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index a08ea8867716..4ac55e696f52 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -686,9 +686,6 @@ static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk) struct sock *sk = (struct sock *)msk; unsigned int moved = 0; - if (inet_sk_state_load(sk) == TCP_CLOSE) - return false; - mptcp_data_lock(sk); __mptcp_move_skbs_from_subflow(msk, ssk, &moved);