From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752982AbbJLCc1 (ORCPT ); Sun, 11 Oct 2015 22:32:27 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:21169 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752704AbbJLCcZ (ORCPT ); Sun, 11 Oct 2015 22:32:25 -0400 Subject: Re: [PATCH net-next] RDS-TCP: Reset tcp callbacks if re-using an outgoing socket in rds_tcp_accept_one() To: Sowmini Varadhan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20151011204944.GB14646@oracle.com> Cc: davem@davemloft.net, rds-devel@oss.oracle.com, ajaykumar.hotchandani@oracle.com, igor.maximov@oracle.com From: "santosh.shilimkar@oracle.com" Organization: Oracle Corporation Message-ID: <561B1BB6.2060208@oracle.com> Date: Sun, 11 Oct 2015 19:32:22 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151011204944.GB14646@oracle.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/11/15 1:49 PM, Sowmini Varadhan wrote: > > Consider the following "duelling syn" sequence between two peers A and B: > A B > SYN1 --> > <-- SYN2 > SYN2ACK --> > > Note that the SYN/ACK has already been sent out by TCP before > rds_tcp_accept_one() gets invoked as part of callbacks. > > If the inet_addr(A) is numerically less than inet_addr(B), > the arbitration scheme in rds_tcp_accept_one() will prefer the > TCP connection triggered by SYN1, and will send a CLOSE for the > SYN2 (just after the SYN2ACK was sent). > > Since B also follows the same arbitration scheme, it will send the SYN-ACK > for SYN1 that will set up a healthy ESTABLISHED connection on both sides. > B will also get a CLOSE for SYN2, which should result in the cleanup > of the TCP state machine for SYN2, but it should not trigger any > stale RDS-TCP callbacks (such as ->writespace, ->state_change etc), > that would disrupt the progress of the SYN2 based RDS-TCP connection. > > Thus the arbitration scheme in rds_tcp_accept_one() should restore > rds_tcp callbacks for the winner before setting them up for the > new accept socket, and also make sure that conn->c_outgoing > is set to 0 so that we do not trigger any reconnect attempts on the > passive side of the tcp socket in the future, in conformance with > commit c82ac7e69efe ("net/rds: RDS-TCP: only initiate reconnect attempt > on outgoing TCP socket.") > > Signed-off-by: Sowmini Varadhan > --- Looks fine to me. Acked-by: Santosh Shilimkar