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=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 23221C4338F for ; Thu, 29 Jul 2021 21:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F2DE60C51 for ; Thu, 29 Jul 2021 21:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234153AbhG2V13 (ORCPT ); Thu, 29 Jul 2021 17:27:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233967AbhG2V12 (ORCPT ); Thu, 29 Jul 2021 17:27:28 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26ECAC061765; Thu, 29 Jul 2021 14:27:24 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id c16so8514809plh.7; Thu, 29 Jul 2021 14:27:24 -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=CmUz25v47EVa8gRZMq5MLvl4L4iFYPzewIDb5rn7kIM=; b=SORUYDWsPT1mdtbTKodQJcv9mUm1olu6HMr4QDAkVdC+quIpbsQcHkbJlqdK4TXOSL MtWLhjVlUb1zReImAq0EdZTUjGgE//o1T+UnAHL5a9KIXw5s+qvWDL9LLWESASgQgkwj Ir5R/rcLaHiqf5NzeCffZ/Gs5Ronm9P/VFKO+4HJH1GIoulmE5CUbEiO2RyQr3eO7Rn6 hEuLUZmW/0RrVUShatRfqHxBAmuqMJ8QQhzKOCcGc+zMDUw+lhDVTBVyNt/GLhPvLYim 7In52S/+PV5DBJG+c0dStIuFe+9NcCZ0h0MUP3YbZzbyzvjTxr1ugmv8arPjJiV41HBP MzUg== 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=CmUz25v47EVa8gRZMq5MLvl4L4iFYPzewIDb5rn7kIM=; b=RXKw8AHvbq3BrvZ5MUCC5iN0z8zLlAeP55BJXKhBBU+29xTw9uju5vSPppVs1wefcw aWz9kuSmZuoq26B0R+cPk3Ba994IuiFyblpSXZQvMaMxEAMHP8PBXv2QkXhEHOVb8+cc RJF2F+W1aHFmhFj4Cc9CmNAS5WQmfZenj5JLkrkCyZxpxghrHOBFcwRdbrHIWtKZAMH8 eIPEN7VYj+qzOSMoTf68k6ZBV51hm6fV9ta5E6501yUPMSmR2QnA2VjlSE6YiHxLlvUj xv85CJ2ncSYq791rIXm5kU3feJa03nw8g8xq/gmgPTsiu/LpGKmY53S68+lMUTowmRtH y+kw== X-Gm-Message-State: AOAM531+6vQ46NlP3im7tn60wK9lIZeXGJBPZIuTqEp3F4427j8uD4h2 IL4XzTn/TLLSZVwUs1FcFfVuPp6Fyws0q3t9Uvg= X-Google-Smtp-Source: ABdhPJzcwd8CEaU5dsVlvlXTZD3ucVxwPiCBIwPZZKnWXpoWb19DKemjYFPzIC1Px66OiyySjVG1CK1cfBOjKtHRZT8= X-Received: by 2002:a62:1609:0:b029:3ab:afdb:acf3 with SMTP id 9-20020a6216090000b02903abafdbacf3mr2117397pfw.43.1627594043670; Thu, 29 Jul 2021 14:27:23 -0700 (PDT) MIME-Version: 1.0 References: <20210727001252.1287673-1-jiang.wang@bytedance.com> <20210727001252.1287673-3-jiang.wang@bytedance.com> <6100363add8a9_199a412089@john-XPS-13-9370.notmuch> <6101a56bf2a11_1e1ff620813@john-XPS-13-9370.notmuch> In-Reply-To: <6101a56bf2a11_1e1ff620813@john-XPS-13-9370.notmuch> From: Cong Wang Date: Thu, 29 Jul 2021 14:27:12 -0700 Message-ID: Subject: Re: [PATCH bpf-next v1 2/5] af_unix: add unix_stream_proto for sockmap To: John Fastabend Cc: Jiang Wang , Linux Kernel Network Developers , "Cong Wang ." , Xiongchun Duan , xieyongji@bytedance.com, chaiwen.cc@bytedance.com, "David S. Miller" , Jakub Kicinski , Daniel Borkmann , Jakub Sitnicki , Lorenz Bauer , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Shuah Khan , Johan Almbladh , LKML , bpf , "open list:KERNEL SELFTEST FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 11:44 AM John Fastabend wrote: > > Cong Wang wrote: > > On Tue, Jul 27, 2021 at 9:37 AM John Fastabend wrote: > > > Do we really need an unhash hook for unix_stream? I'm doing some testing > > > now to pull it out of TCP side as well. It seems to be an artifact of old > > > code that is no longer necessary. On TCP side at least just using close() > > > looks to be enough now. > > > > How do you handle the disconnection from remote without ->unhash()? > > Would close() not work for stream/dgram sockets? close() is called when the local closes the sockets, but when the remote closes or disconnects it, unhash() is called. This is why TCP calls unhash() to remove the socket from established socket hash table. unhash() itself might not make much sense for AF_UNIX as it probably does not need a hash table to track established ones, however, the idea is the same, that is, we have to handle remote disconnections here. Thanks.