Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3417393imm; Mon, 8 Oct 2018 03:48:00 -0700 (PDT) X-Google-Smtp-Source: ACcGV62krGV8bPZrcg8gOaJalDeZzodavE3d8KUPxMC1oBdi5S3Et4noE9m5OqdbP2SRHybK1VJe X-Received: by 2002:a17:902:8d94:: with SMTP id v20-v6mr23531139plo.20.1538995680006; Mon, 08 Oct 2018 03:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538995679; cv=none; d=google.com; s=arc-20160816; b=1DFwwkX6XJlrdRFcM+zRip57jMpt3o3l31DHOAyT03dLLdEIfwCemi8rN8bxoaCWUn YmrSAO97B2iuBq+m+3EFKhJ7qrSdHgsJjnBxzRUHCn3FABWdjk3fW0LpUlFCn85gjKBm xxSF3MfrTAsUDSZfxE/xDe8zoExoZwmrPONbFNt6/gnvdrIZy8pUFZ86+0UdLaOB5O+F i+xgz1DRMV4cKLYEmAFIglc5lm3SLNeXARQrohg1lA8xbDtRZfhZ9xGELxllgLxzl3BD rDU6338/0KOnKTV0TDg1pRsEHGwqPVmDk3uUz7q1hPe/bUKJygkGnVSl8Gy4hkgka+ew dxKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZmZ99y/DfzRA1qs+Wb/NKLl8zjP0Bp7IulNups37Sjo=; b=0tMB1s/Q1A/yy+K5OqixVSj3iLv6ze+okqfAz9NEsd7WeXRy162Def1bQRZiW6eaDs 9x3ckEeleRRWYrvxJqTxRd5j1hoz92t/F5guKfpKTPJQAKansmzrqy845qDhBb2+pHKp jVizYhSDfDawqD2kmCVQdkPAyAqeIv9ipsALfVcpFkhBEta9yXiQFlvCtJ93dzxrs3AL /r9EI1RXgW34taK7ZROD7M2fJgySMxYocvs46LQ1oN4NEoEZJG8CGmUEQOQZB83UiDd/ vGcG4wgkyy2uieyfkyL8sB7mWET6Y6feDCCmFqlyCaKm+JAS+sApECkmuyGp0OjKooQ+ eDuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sy2juLN8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6-v6si16704171plt.152.2018.10.08.03.47.44; Mon, 08 Oct 2018 03:47:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sy2juLN8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727384AbeJHR6m (ORCPT + 99 others); Mon, 8 Oct 2018 13:58:42 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:35668 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726612AbeJHR6m (ORCPT ); Mon, 8 Oct 2018 13:58:42 -0400 Received: by mail-it1-f193.google.com with SMTP id p64-v6so11226010itp.0; Mon, 08 Oct 2018 03:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZmZ99y/DfzRA1qs+Wb/NKLl8zjP0Bp7IulNups37Sjo=; b=sy2juLN8aEx72Woy4nJCp8GiIxeqga0QeYMIOHAvpq2iBcJ/PPBxY+YezxJbRJM2Rd aHwFQbSYY4gsb1Aplnjm+oN6c/OEslr/jE3XPwYSgGITBrHsOlTx+OnSErBGznxvwYOX BLLhqT1OkZtpF/llUBK++xNZyeNPH6cclIMwyPAPluN9fuJNUt/fm6WbXcMzD2GNQwjP n5/0mbQ9hS9Uj/Czi+FsOzZ7WDzIjS5dyduy3gPXN8pn7I0mQjKjITXdXFrly6PW1AM6 ZkUjKVa0Jlrc2Y54nB/HwEe28avSKHE2mGfvVopEtS8k8o3etNSylRke0XAIX/BSuFZl TVLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZmZ99y/DfzRA1qs+Wb/NKLl8zjP0Bp7IulNups37Sjo=; b=KZrGqaCqzxTixEYj/1tnn+7tzC6Tswzmh6vRiqkVixV+QtvqWoPdwNJczlJKPgMG7N gfUUpB+Tj9aR0LOC65CbEJsHiZ0HVacsfP6qTlDZd9vib6DiDfNnWN2M8lvM0S8ZECwM 3TaNzn72ghjadGeG+JA2dDuBgEbUMu+qTEFil7V7ZIss1ZIDvugXKK4JYMcz+74ZqeBM 0JOxseNUFnjaFw75GEpmt6wx/cbw19s31kdfEuGwxU5rP45z1yrO6z9K7LVgVgzqnv0A sKIdS8lD0Cc8mGzhX5KbFj7lpzsBcoRc1zXN9vmgAno6qSpr8IaqMJKI3lw5bFbPxL45 CfYA== X-Gm-Message-State: ABuFfoi3y0coakfbOu2z05iixtV3uvfb/HoO7zpzU6db+BxnOtKPSgmQ OoxlcMTebCOap/jRSk05b3CmK5sMt7nxB0PyBMILdCz0WvI= X-Received: by 2002:a24:3dd2:: with SMTP id n201-v6mr9526910itn.75.1538995655480; Mon, 08 Oct 2018 03:47:35 -0700 (PDT) MIME-Version: 1.0 References: <1538919405-3093-1-git-send-email-laoar.shao@gmail.com> <0652963b-90ac-06a7-3a35-50a307465cf9@gmail.com> In-Reply-To: <0652963b-90ac-06a7-3a35-50a307465cf9@gmail.com> From: Yafang Shao Date: Mon, 8 Oct 2018 18:46:58 +0800 Message-ID: Subject: Re: [PATCH v2 net-next] inet: do not set backlog if listen fails To: Eric Dumazet Cc: Eric Dumazet , David Miller , netdev , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 8, 2018 at 1:39 AM Eric Dumazet wrote: > > > > On 10/07/2018 06:36 AM, Yafang Shao wrote: > > We don't need to set the backlog if listen fails. > > The sk_max_ack_backlog will be set in the caller inet_listen() and > > dccp_listen_start() if inet_csk_listen_start() return without error. > > So just remove this line to avoid this unnecessary operation. > > > > Regarding sk_ack_backlog, we have to set it before a TCP/DCCP socket is > > ready to accept new flows to avoid race, because dccp and tcp have lockless > > listeners > > > > Really could you not add irrelevant stuff in the changelog ? > Sure, I will remove it. > This patch simply removes one redundant setting, you do not have to explain > about dccp/tcp being lockless and that sk_ack_backlog is not touched by this patch. > > Also the title is misleading, since we will still set the backlog even if the listen > fails. > > If you really want sk_max_ack_backlog being not changed if listen() fails, > then I am afraid you will need to submit a different patch. After this patch, sk_max_ack_backlog will only be set after the sk is successfully added to listening hash table, and then 0 is returned, that means listen() is successful. Take inet_listen() for example, if (old_state != TCP_LISTEN) { err = inet_csk_listen_start(sk, backlog); if (err) goto out; } // it can only be set if err is 0. sk->sk_max_ack_backlog = backlog; err = 0; out: return err; Pls. correct me if I missed something. Thanks Yafang