Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3579343lfo; Mon, 23 May 2022 08:22:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwge7Q9KawX7uuVvT5PdvNVmFA1pvbW9mnE3wnQUr/1IWyqSU+heJ8vlD6qG7R1DITql91G X-Received: by 2002:a17:902:ab05:b0:15f:3aad:6269 with SMTP id ik5-20020a170902ab0500b0015f3aad6269mr23646321plb.23.1653319362078; Mon, 23 May 2022 08:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653319362; cv=none; d=google.com; s=arc-20160816; b=vIW6NHNRq8h+gRIy5B72fbMIP88ECNyg8MDaVP6B13DKbMP4gmsoiS4GPV/RYgI1xd xQKFfGw30bfkgk9TuvQ9SgPTmhJNY74OeCZKSdB7KfWzVFyS09KddHbiwuhlIGjApf9J DUcNfb7/TFoJ/Q/moMEjRDDOww+H+7+CMsAeFU/xbv/PAoctjqX5jmVYSlJwaiOzfHmo FdcmTPZ2pfE2B5yiqXeieG30Nxgc4Yl0Jwxv4rKuu4JjSNr2y0cWhepH6VPivVTrXluU beZagX2KMCBp7psservpdtv0gYk1a1jXIeKY0o8KQNl5+GTI33VTiTMyWSkfsImOs9/4 RCgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R3zygWyvjLx8PkoAiXgkSSLytNNRrxTxeZe8vycXt/8=; b=mppdsqembSbBWOEREKirZH5ZbNyj/7pAogKDhvJoy5jwbxxScITOYMVs8MFhCjkvdh 8Eiu3n0ovUH5NmKBTxa4lesvp8xKPqMdDpUbx3puQpnbH5Ao4FI/rPoxWoIVYgWpCqUU hLeZMJGtShOcSGK3edXsOBfhxnkRC64bQIRkgtye0+OMjgGEpKOLV5lXmlHOIRKDRYww slibzGNISU5fVJIbhX7b8A2boEukzfugJ7DpGEw0mEUzKmZbo8RB0kfNRZLcFxU6Kbdu EpyMvkAhQBUiazdJm9nS0LXugLm7SNxZCtkDqRNCJck9HDhzYRZaUSljcvObbkljqlvI bADA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@corp.netease.com header.s=s210401 header.b=MsiMme38; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=corp.netease.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f8-20020a636a08000000b003fa8e741384si1416976pgc.727.2022.05.23.08.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 08:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@corp.netease.com header.s=s210401 header.b=MsiMme38; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=corp.netease.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 377C7286EA; Mon, 23 May 2022 08:21:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237797AbiEWPVj (ORCPT + 99 others); Mon, 23 May 2022 11:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237717AbiEWPVe (ORCPT ); Mon, 23 May 2022 11:21:34 -0400 Received: from corp-front08-corp.i.nease.net (corp-front08-corp.i.nease.net [59.111.134.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 152A9286ED; Mon, 23 May 2022 08:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corp.netease.com; s=s210401; h=Received:From:To:Cc:Subject: Date:Message-Id:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=R3zygWyvjLx8PkoAiXgkSSLytNNRrxTxeZ e8vycXt/8=; b=MsiMme38qLMldGXcrNpZ+HfPCVvoG6s7ic4m0iTDfvm4e/B7ny sFuG7yvO/VIlFg74aXL+7q9VoZb5Rd0v4uRCVcAgIAU6jsX2jo7bttH8+gMlUEzE ZTeVtxobWba7M9JIiO12kP7x7nwQCKDT4NZwjgkF51XkWQBHTKsdc68+o= Received: from pubt1-k8s74.yq.163.org (unknown [115.238.122.38]) by corp-front08-corp.i.nease.net (Coremail) with SMTP id nhDICgBXlABvpotibIJhAA--.8009S2; Mon, 23 May 2022 23:21:19 +0800 (HKT) From: liuyacan@corp.netease.com To: kgraul@linux.ibm.com Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, liuyacan@corp.netease.com, netdev@vger.kernel.org, pabeni@redhat.com, ubraun@linux.ibm.com Subject: Re: [PATCH v2 net] net/smc: postpone sk_refcnt increment in connect() Date: Mon, 23 May 2022 23:21:19 +0800 Message-Id: <20220523152119.406443-1-liuyacan@corp.netease.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: nhDICgBXlABvpotibIJhAA--.8009S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Jw4xuF4xtF47ur4xArWDJwb_yoWkGFcEga 9akrykCr4rXFWrJayvkF4rGw43K3yjk348XF4kJr47Jw1rXrWkGrZ8urnaqryxJFWfKrsx Gw4rta4Iy342kjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAU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Xa7VUUna93UUUUU== X-CM-SenderInfo: 5olx5txfdqquhrush05hwht23hof0z/1tbiBQAPCVt760qFUgAesL X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > >> This is a rather unusual problem that can come up when fallback=true BEFORE smc_connect() > >> is called. But nevertheless, it is a problem. > >> > >> Right now I am not sure if it is okay when we NOT hold a ref to smc->sk during all fallback > >> processing. This change also conflicts with a patch that is already on net-next (3aba1030). > > > > Do you mean put the ref to smc->sk during all fallback processing unconditionally and remove > > the fallback branch sock_put() in __smc_release()? > > What I had in mind was to eventually call sock_put() in __smc_release() even if sk->sk_state == SMC_INIT > (currently the extra check in the if() for sk->sk_state != SMC_INIT prevents the sock_put()), but only > when it is sure that we actually reached the sock_hold() in smc_connect() before. > > But maybe we find out that the sock_hold() is not needed for fallback sockets, I don't know... I do think the sock_hold()/sock_put() for smc->sk is a bit complicated, Emm, I'm not sure if it can be simplified.. In fact, I'm sure there must be another ref count issue in my environment,but I haven't caught it yet.