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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 880B3C433EF for ; Tue, 24 May 2022 11:44:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237055AbiEXLoc (ORCPT ); Tue, 24 May 2022 07:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234556AbiEXLoQ (ORCPT ); Tue, 24 May 2022 07:44:16 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CA8D1209F; Tue, 24 May 2022 04:43:53 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R471e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=tonylu@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VEHxxv7_1653392624; Received: from localhost(mailfrom:tonylu@linux.alibaba.com fp:SMTPD_---0VEHxxv7_1653392624) by smtp.aliyun-inc.com(127.0.0.1); Tue, 24 May 2022 19:43:45 +0800 Date: Tue, 24 May 2022 19:43:44 +0800 From: Tony Lu To: liuyacan@corp.netease.com Cc: kgraul@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, ubraun@linux.ibm.com Subject: Re: [PATCH v2 net] net/smc: postpone sk_refcnt increment in connect() Message-ID: Reply-To: Tony Lu References: <20220523152119.406443-1-liuyacan@corp.netease.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220523152119.406443-1-liuyacan@corp.netease.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 23, 2022 at 11:21:19PM +0800, liuyacan@corp.netease.com wrote: > > >> 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. I am wondering the issue of this ref count. If it is convenient, would you like to provide some more details? syzkaller has reported some issues about ref count, but syzkaller and others' bot don't have RDMA devices, they cannot cover most of the code routines in SMC. We are working on it to provide SMC fuzz test with RDMA environment. So it's very nice to have real world issues. Thanks, Tony Lu