Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp871533ybk; Wed, 13 May 2020 15:39:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxg5IIAjaipSQxTBoRNrkz8hH37n2inEqQZvjRARLPWAXGx+R4wuUqMAepAWvF5iXhqts65 X-Received: by 2002:a50:e704:: with SMTP id a4mr1616245edn.146.1589409572125; Wed, 13 May 2020 15:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589409572; cv=none; d=google.com; s=arc-20160816; b=PKc7DwQdew/1IPEUFULX7erFrA+UyIgg89YDMEkS4cK/yQq5J8g6RGnRInxfid0rsB LvHKIstrWX4xAzfXK1f6bWhpNvxpepdMRS5iFWJWC2Y+GNit3QyLhP/IVYe3tofx1+gJ 8ZbD7eGC9HwXTr/VZxTxmpLIWzeaxxXRyH/M+BL1WjHemudbmmg0ucPXWXpfDqQatABy vHhy0mwx9e7VVhoxtZVpFexubwBfkomjlKPogaZWQKRAvGcfARAa6cf2bOvdElHwoW8Y 5Q42gk5TzmtJgPnFMgeOvEOeTJv8yF8YEr3GOT3V2bEYQm5y4/JnSyHSx7wiDONUoAdl VhZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=QtK709kqenBD5WVU1Um2VTM+3IKczyRnKep3iRgkjjA=; b=0j42uosiyWqxBlWnsrw7dUIWg8qON7Ukq1PZetMuPYcMBk3Mwvb3LBi+oyL2q8HBAJ SRAKZVhLYyhrLg/0bS+/o88ILzH7FaJeC22LNaqiQvJ+dLjpOK6QCL6K0B8QD3xfd5Kv es61faftvh1f9QN7bot1QuiXJlFgHNqMo0VlcmMbjbrys7cw+l7NxzeolU5zlp3aU5T0 810rwesIAtacMJHlJwnGA7DUzDVK7PR8U4wSkBN/QZxdvG0Wl0EQouoEe6pdZxtMwUAv GdszigvDJrljBchj+/sX7lna+ZNSvwm7k+EPMifXG0xZXV911nfaEQ/pLAKyrOSCRIs/ T0oQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oq5si694841ejb.395.2020.05.13.15.38.54; Wed, 13 May 2020 15:39:32 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728841AbgEMWim (ORCPT + 99 others); Wed, 13 May 2020 18:38:42 -0400 Received: from fieldses.org ([173.255.197.46]:57794 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbgEMWim (ORCPT ); Wed, 13 May 2020 18:38:42 -0400 Received: by fieldses.org (Postfix, from userid 2815) id AAFF91508; Wed, 13 May 2020 18:38:41 -0400 (EDT) From: "J. Bruce Fields" To: Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org, "J. Bruce Fields" Subject: [PATCH] SUNRPC: 'Directory with parent 'rpc_clnt' already present!' Date: Wed, 13 May 2020 18:38:40 -0400 Message-Id: <1589409520-1344-1-git-send-email-bfields@redhat.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: "J. Bruce Fields" Each rpc_client has a cl_clid which is allocated from a global ida, and a debugfs directory which is named after cl_clid. We're releasing the cl_clid before we free the debugfs directory named after it. As soon as the cl_clid is released, that value is available for another newly created client. That leaves a window where another client may attempt to create a new debugfs directory with the same name as the not-yet-deleted debugfs directory from the dying client. Symptoms are log messages like Directory 4 with parent 'rpc_clnt' already present! Fixes: 7c4310ff5642 "SUNRPC: defer slow parts of rpc_free_client() to a workqueue." Signed-off-by: J. Bruce Fields --- net/sunrpc/clnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 8350d3a2e9a7..4a7efc00fd83 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -889,6 +889,7 @@ static void rpc_free_client_work(struct work_struct *work) * here. */ rpc_clnt_debugfs_unregister(clnt); + rpc_free_clid(clnt); rpc_clnt_remove_pipedir(clnt); kfree(clnt); @@ -910,7 +911,6 @@ rpc_free_client(struct rpc_clnt *clnt) xprt_put(rcu_dereference_raw(clnt->cl_xprt)); xprt_iter_destroy(&clnt->cl_xpi); put_cred(clnt->cl_cred); - rpc_free_clid(clnt); INIT_WORK(&clnt->cl_work, rpc_free_client_work); schedule_work(&clnt->cl_work); -- 2.26.2