From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64CEDC433DB for ; Sat, 20 Feb 2021 19:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29FA664E04 for ; Sat, 20 Feb 2021 19:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229871AbhBTTda (ORCPT ); Sat, 20 Feb 2021 14:33:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbhBTTd1 (ORCPT ); Sat, 20 Feb 2021 14:33:27 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB2C5C061574; Sat, 20 Feb 2021 11:32:47 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lDXzg-00GPWm-Gc; Sat, 20 Feb 2021 19:32:44 +0000 Date: Sat, 20 Feb 2021 19:32:44 +0000 From: Al Viro To: Cong Wang Cc: Denis Kirjanov , Christoph Hellwig , LKML , Jakub Kicinski , linux-fsdevel Subject: Re: [PATCH 1/8] af_unix: take address assignment/hash insertion into a new helper Message-ID: References: <20210129082524.GA2282796@infradead.org> <20210129131855.GA2346744@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 20, 2021 at 11:12:33AM -0800, Cong Wang wrote: > 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. Why? "Insert into locked and unlock" is fairly common... > And please Cc netdev for networking changes. Sorry about that - I'd ended up emulating git send-email by hand and missed the Cc. Sorted out by now...