Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2173122pxb; Fri, 5 Feb 2021 10:39:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3WvG7e0xBiMoouGoEYTvobbwmc5Iu2xoMH50T4jAMLsIpazP/8eg75rtSQjZKXn+SeMhv X-Received: by 2002:a17:906:2755:: with SMTP id a21mr5353528ejd.374.1612550345391; Fri, 05 Feb 2021 10:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612550345; cv=none; d=google.com; s=arc-20160816; b=exy3rZnSVmZsYvLtU5AvwwkbtGghdhtDHQDuPMbXDBKOLo+37DHBkFHhCxp+DqTCgd kc9Y6IgW+Yb8RFrdpAMiHZOaRUAyDTU8MrJr4a4ACrhxn8BL5qeW7l8D7kpSLwLX78eV kFLXevvBODsHpbo81k6kJgAgE7p4s7zjYeAsuDESogiesBa6hz1K4wvKBm4/xo0Vb5P0 QbKSDVHEIKcWZNoQyRNk2gDOATOAkFaFXCUjCfmfQDmgAsE+Yxx9pbc+qoJg4OcLLKQV +ManWOpWxvozBhPk8aJPz9RZI/smvANn0/JDJHjgWisB121HgG/Pg04cFX+jF9WiFkTX 1nZw== 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=uYvWoXXb/xX6WF/cu+UQgzpQ8ORkfD5dpS/I/THEHD4=; b=F1fRw4ygAhlRk5bdxoD5lFW9MlrTKpofeO3kcvJj7dyeEEmku6L3XGI9S1zZadGOwk nNcf9STlgOBI7Q1z3gduonvkoID7UV8ihRCmKPcBVFt0wA8kidWGS7aJqrAkfjEH1K/+ 4cBtzdlEUuIpDY/5TzsDJI9tELJepIq1k3Ae+G9Qb3CV4GkWZFP2GgFNsjzaZuB1qVyu 6Sg3bkL2DF8fw5C5YrCsO2USjA91Dm8+pnf97dGUJ1zfabMLEllvGG1Zv4eIL3ul7VfM zSrg0Y367p6B9c8IZz+Dd7eG1D2F17usL0TG8KaG6Mt2Spl6xVgAD73o4ZzJJrK3EDOr y1JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="EP9d8Ia/"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 h24si6111839ejt.167.2021.02.05.10.38.35; Fri, 05 Feb 2021 10:39:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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="EP9d8Ia/"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 S231428AbhBEQzA (ORCPT + 99 others); Fri, 5 Feb 2021 11:55:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233778AbhBEQw3 (ORCPT ); Fri, 5 Feb 2021 11:52:29 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E209FC061756 for ; Fri, 5 Feb 2021 10:34:09 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id r12so13388311ejb.9 for ; Fri, 05 Feb 2021 10:34:09 -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=uYvWoXXb/xX6WF/cu+UQgzpQ8ORkfD5dpS/I/THEHD4=; b=EP9d8Ia/YdZmFpm+sDPl9mra0JWV7oC4y7q7/Etyx5DLUGvH4zoZjP7OE16EO0gLgH 0kpspq5yeDHrGrUOq1P6prhdfrrd8L9su5807qSjbzf34cMBRCM+57po/ITlS/A5PX2b bzDxY/rbNKK504LkNck37x4VLJbnYLjcpjeLf4rm5R8nSBT1iwIT0dp/Tm4N0tc4wIkL cG2Q//xlI1c0c53j8/Xi6mT5uqPCQovTRBheDkpLNgJD0VAtvr/4tp0Rj2G/blDQFn7J pBFqh1HJymRStHDqy+jjtgktxJnwGTnfhYv4SVCpYnZyx2/a0n1bC1Qo6qgsH6wz3GjJ PB2Q== 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=uYvWoXXb/xX6WF/cu+UQgzpQ8ORkfD5dpS/I/THEHD4=; b=XsGm3TXfj6hgJKQ9h/b8Kkc8YYzGmfvBYzvOrM//tI7Ey3McTTAGVy9y85AEq4a5Xd 4omb4qSi+G0k1wR3NTwhcUO24dbAGqxRI5bpGyvj4vT0cY5QYVb4H8kvwz5a7zSgeEv/ xsDOVhVy7L0drsEnfafUZn5o0Py/gdE7kKsF8qcE6rWNiqz2uB9DIWYKHUtM0e5awfB5 ZVqyG0OUtJ2bEPY/qkQ+zRiVmuqL1sgLAOoYRxvcyUwd5QY6CNwY/EnIYjdGujYXCFRF uNrUeRmNQwpwyJcgSXLZ0TFOOzRkRwW69C+yPfLA/4TXAKvOSO5+GxwqVnJjBSM6fZqt 6akw== X-Gm-Message-State: AOAM530YVdfiHt4rC3/DoB9nOGKY09PGmkDYvCws7xkUGRaOBmSIGf12 zcTwrcJfpDMtNhYiwMmFARLRQIRslIJnmyDyHNS8pZKFcz0= X-Received: by 2002:a17:906:3e42:: with SMTP id t2mr5320518eji.439.1612550048580; Fri, 05 Feb 2021 10:34:08 -0800 (PST) MIME-Version: 1.0 References: <20210202184244.288898-1-Anna.Schumaker@Netapp.com> <20210202184244.288898-5-Anna.Schumaker@Netapp.com> <4eaf0c288d97a2d03c5cd2a7ed728a73085b2719.camel@hammerspace.com> <67497ea4a7d22726112e0083893e85a17f1ca681.camel@hammerspace.com> In-Reply-To: <67497ea4a7d22726112e0083893e85a17f1ca681.camel@hammerspace.com> From: Anna Schumaker Date: Fri, 5 Feb 2021 13:33:52 -0500 Message-ID: Subject: Re: [PATCH v2 4/5] sunrpc: Prepare xs_connect() for taking NULL tasks To: Trond Myklebust Cc: "linux-nfs@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Feb 2, 2021 at 4:59 PM Trond Myklebust wrote: > > On Tue, 2021-02-02 at 16:49 -0500, Trond Myklebust wrote: > > On Tue, 2021-02-02 at 13:42 -0500, schumaker.anna@gmail.com wrote: > > > From: Anna Schumaker > > > > > > We won't have a task structure when we go to change IP addresses, > > > so > > > check for one before calling the WARN_ON() to avoid crashing. > > > > > > Signed-off-by: Anna Schumaker > > > --- > > > net/sunrpc/xprtsock.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c > > > index c56a66cdf4ac..250abf1aa018 100644 > > > --- a/net/sunrpc/xprtsock.c > > > +++ b/net/sunrpc/xprtsock.c > > > @@ -2311,7 +2311,8 @@ static void xs_connect(struct rpc_xprt *xprt, > > > struct rpc_task *task) > > > struct sock_xprt *transport = container_of(xprt, struct > > > sock_xprt, xprt); > > > unsigned long delay = 0; > > > > > > - WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport)); > > > + if (task) > > > + WARN_ON_ONCE(!xprt_lock_connect(xprt, task, > > > transport)); > > > > Nit: That's the same as > > WARN_ON_ONCE(task && !xprt_lock_connect(xprt, task, transport)); > > > > > > > > if (transport->sock != NULL) { > > > dprintk("RPC: xs_connect delayed xprt %p for > > > %lu " > > > > So, the problem with this patch is that you're deliberately > circumventing the process of locking the socket. That's not going to > work. > What you could do is follow the example set by xprt_destroy() and > xs_enable_swap(), to call wait_on_bit_lock() when there is no task. > That should work, but you'd better make sure that your process holds a > reference to the xprt->kref before doing that, or else you could easily > end up deadlocking with xprt_destroy(). I've tried this, and the kref isn't a problem but no matter where I put the wait_on_bit_lock() call it ends up deadlocking. I think it's happening in the xs_tcp_setup_socket() function, but I'm still trying to figure out exactly where. Anna > > -- > Trond Myklebust > Linux NFS client maintainer, Hammerspace > trond.myklebust@hammerspace.com > >