From patchwork Thu Feb 27 21:12:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410085 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 767F6138D for ; Thu, 27 Feb 2020 21:29:52 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5BC91246A0 for ; Thu, 27 Feb 2020 21:29:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BC91246A0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id B74ED348E8E; Thu, 27 Feb 2020 13:25:38 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id B42BD21FD9A for ; Thu, 27 Feb 2020 13:19:38 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 6960C2C7A; Thu, 27 Feb 2020 16:18:16 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 67B1F46C; Thu, 27 Feb 2020 16:18:16 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:12:11 -0500 Message-Id: <1582838290-17243-264-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 263/622] lnet: properly cleanup lnet debugfs files X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: James Simmons , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" The function lnet_router_debugfs_remove() is suppose to cleanup the lnet specific debugfs files but that is not happening at all. Change lnet_remove_debugfs() from doing the final debugfs lnet and libcfs cleanup to doing specific debugfs file removal. We can make libcfs module unloading to directly finish the entire libcfs and debugfs tree removal instead. With this change we can make lnet_router_debugfs_fini() call lnet_remove_debugfs(). WC-bug-id: https://jira.whamcloud.com/browse/LU-11986 Lustre-commit: 8cb7ccf54e2d ("LU-11986 lnet: properly cleanup lnet debugfs files") Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/34669 Reviewed-by: Sonia Sharma Reviewed-by: Amir Shehata Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- include/linux/libcfs/libcfs.h | 1 + net/lnet/libcfs/module.c | 16 ++++++++++++---- net/lnet/lnet/router_proc.c | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/linux/libcfs/libcfs.h b/include/linux/libcfs/libcfs.h index 33f7477..d3a9754 100644 --- a/include/linux/libcfs/libcfs.h +++ b/include/linux/libcfs/libcfs.h @@ -57,6 +57,7 @@ static inline int notifier_from_ioctl_errno(int err) extern struct workqueue_struct *cfs_rehash_wq; void lnet_insert_debugfs(struct ctl_table *table); +void lnet_remove_debugfs(struct ctl_table *table); /* * Memory diff --git a/net/lnet/libcfs/module.c b/net/lnet/libcfs/module.c index 37a3fee..2e803d6 100644 --- a/net/lnet/libcfs/module.c +++ b/net/lnet/libcfs/module.c @@ -691,12 +691,18 @@ static void lnet_insert_debugfs_links( symlinks->target); } -static void lnet_remove_debugfs(void) +void lnet_remove_debugfs(struct ctl_table *table) { - debugfs_remove_recursive(lnet_debugfs_root); + for (; table && table->procname; table++) { + struct qstr dname = QSTR_INIT(table->procname, + strlen(table->procname)); + struct dentry *dentry; - lnet_debugfs_root = NULL; + dentry = d_hash_and_lookup(lnet_debugfs_root, &dname); + debugfs_remove(dentry); + } } +EXPORT_SYMBOL_GPL(lnet_remove_debugfs); static DEFINE_MUTEX(libcfs_startup); static int libcfs_active; @@ -771,7 +777,9 @@ static void libcfs_exit(void) { int rc; - lnet_remove_debugfs(); + /* Remove everthing */ + debugfs_remove_recursive(lnet_debugfs_root); + lnet_debugfs_root = NULL; if (cfs_rehash_wq) destroy_workqueue(cfs_rehash_wq); diff --git a/net/lnet/lnet/router_proc.c b/net/lnet/lnet/router_proc.c index 45abcfb..8517411 100644 --- a/net/lnet/lnet/router_proc.c +++ b/net/lnet/lnet/router_proc.c @@ -936,4 +936,5 @@ void lnet_router_debugfs_init(void) void lnet_router_debugfs_fini(void) { + lnet_remove_debugfs(lnet_table); }