Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp514213pxb; Sat, 20 Feb 2021 11:17:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9tkDi0iF5TxYuaB29ZLxzN4/8XXA8+z3ZaiiQGQYbrhM44Cc6kCEp+gGp9ltcOmqeJ4jU X-Received: by 2002:a17:906:3f96:: with SMTP id b22mr13972180ejj.478.1613848651375; Sat, 20 Feb 2021 11:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613848651; cv=none; d=google.com; s=arc-20160816; b=E9pchngIFYPodUtoOcX4Wb9qFnFDRJzlQAw1YHp1lXKwvvWJrvMxdW9JNv1zKWQ9dc vgPTzfN2g/P/X6UOePMvtv/tJMf9n8cKiuJ5wdPLDGgl0BGC+eShCndI4ME5L9tgUOc7 vRAXIkEEwxQngtBafjXhoeEW6OP7v23QGLGWLdgF+tOWBB9VPt9Hml1cR0Za8wYhkOxA JIdNPUFuCWOXCc/I4DeQWerHSIGwoW7cz1RPidHSc8X2wa+BMd+Fbydko/ENbf/q85Ip ChxhZOqjfzryH6J/6SSpy0OsiPqt6xbWwgiU0HKQGL8fQ0aX7ybFYD+PfYQJn26sJQn4 RDQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RCUJuiuY9ImPZDy5gp8HkT1sX9iXGmZBVPPpZjV0Ekk=; b=h04PDYOCt15ghopFhNAOizcggy75lrKPDqFbqWj3cFfVTMz/lCxXECfj0pGzLyaF6W blkPwzj3Rp5kPT6mh62sLPEJCua1xlzxzyn6GTILal7NqIwd2MzZHO2T3ku9sP3jUG9d 9Ec9/qax2UKa3JMnO4n7Mt9NW/ikwWuzVWCM0yOPPQcexLmd1Oe/r9HNWcfyh1SkKKI+ 4meBxi6AW/JH2S4BVSdBvI4N7l3sjODpJaI2GcMSdLyEwSwTwYdRSwcTYva+JjHOpQRK jaI4+rs7sTP6+XVBY0JKX7R/32OP6EXz3DV8owooHdUpiZPyD+bS4zx6L9DVszWZ0kRS DFCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="qzN/R/a4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n9si8302527ejz.28.2021.02.20.11.17.08; Sat, 20 Feb 2021 11:17:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="qzN/R/a4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230010AbhBTTNe (ORCPT + 99 others); Sat, 20 Feb 2021 14:13:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbhBTTNY (ORCPT ); Sat, 20 Feb 2021 14:13:24 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E2CC061574; Sat, 20 Feb 2021 11:12:44 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id b145so4069667pfb.4; Sat, 20 Feb 2021 11:12:44 -0800 (PST) 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=RCUJuiuY9ImPZDy5gp8HkT1sX9iXGmZBVPPpZjV0Ekk=; b=qzN/R/a4nQ4sWoBSqu8DusatbUCaG9iu98obAWoqdH89gN5BTbKJ0EphpRPKVU9JdH SulpF7DRdLV9jgmNQtYBZjjoVADUu0oD9tjVuju7p59tbe3N9f2u3bNHljMlVOzED9TM b/1S4wzAUQwGBK3ToBfZeHekI7oujbkRSWRuylQY+F8aPvxmeouOJSuoCfi38S0wH1XY PfWli9UEWmMerM4rE/3NE+le8EDuPX3QddDrFUk3KhacPUNd+G2+8uOPE+magTHcX3LC Z28GyHEcJiVti3tcSKa6ifZsQVxC1umOjCxg9rSRMNEfUvWixb99RkWQNgXdizE3mumh MKuA== 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=RCUJuiuY9ImPZDy5gp8HkT1sX9iXGmZBVPPpZjV0Ekk=; b=E5qunurTE6SzgPtNz7ZIjlmeH/bSU49Usn3F15xG7Px1ZRIeJkK8Er1bqnQP3bYo/N hSEDvPoNDKOV3tgLGgK7TV+763O9CwERgQ/D3A19z3JA5tsmvz2+9wtFa3dGrbJZMag2 /WqZimtoSVdY49c1Kh6uT/7At0mdDs5Y4ueXrScajEvNEMs+lk8i/rJ6su43EMW4jY+r cTLFZ8krL+WuzLCrDlIoENMWfo9WJo498hcbxQ1eDEfPVoD9fFxPnoV0f7ccKAdzHlFX oYFgkNoocxmMJFtQeG+XfLbzBtfaa0urh3/bHQruItMLvgBPlowsnNTBGchdRjgCN1M0 ZeXg== X-Gm-Message-State: AOAM530BMkju7GBwOGIN9Wcd6++HF/EcpnRVUg0qd4d/uoVntJCN2fZt mr8j5xa6gGWxHQukwTUo5Z3IV4sIxO7lbFQoaX8= X-Received: by 2002:a63:e109:: with SMTP id z9mr13566082pgh.5.1613848364207; Sat, 20 Feb 2021 11:12:44 -0800 (PST) MIME-Version: 1.0 References: <20210125154937.26479-1-kda@linux-powerpc.org> <20210127175742.GA1744861@infradead.org> <20210129082524.GA2282796@infradead.org> <20210129131855.GA2346744@infradead.org> In-Reply-To: From: Cong Wang Date: Sat, 20 Feb 2021 11:12:33 -0800 Message-ID: Subject: Re: [PATCH 1/8] af_unix: take address assignment/hash insertion into a new helper To: Al Viro Cc: Denis Kirjanov , Christoph Hellwig , LKML , Jakub Kicinski , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 18, 2021 at 8:22 PM Al Viro wrote: > > Duplicated logics in all bind variants (autobind, bind-to-path, > bind-to-abstract) gets taken into a common helper. > > Signed-off-by: Al Viro > --- > net/unix/af_unix.c | 30 +++++++++++++++--------------- > 1 file changed, 15 insertions(+), 15 deletions(-) > > diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c > index 41c3303c3357..179b4fe837e6 100644 > --- a/net/unix/af_unix.c > +++ b/net/unix/af_unix.c > @@ -262,6 +262,16 @@ static void __unix_insert_socket(struct hlist_head *list, struct sock *sk) > sk_add_node(sk, list); > } > > +static void __unix_set_addr(struct sock *sk, struct unix_address *addr, > + unsigned hash) > + __releases(&unix_table_lock) > +{ > + __unix_remove_socket(sk); > + smp_store_release(&unix_sk(sk)->addr, addr); > + __unix_insert_socket(&unix_socket_table[hash], sk); > + spin_unlock(&unix_table_lock); Please take the unlock out, it is clearly an anti-pattern. And please Cc netdev for networking changes. Thanks.