From patchwork Fri Jan 20 08:48:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 9527751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C1CC160459 for ; Fri, 20 Jan 2017 08:50:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3F0B2865D for ; Fri, 20 Jan 2017 08:50:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A648C28678; Fri, 20 Jan 2017 08:50:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B3772865D for ; Fri, 20 Jan 2017 08:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751499AbdATIuc (ORCPT ); Fri, 20 Jan 2017 03:50:32 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35176 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751437AbdATIub (ORCPT ); Fri, 20 Jan 2017 03:50:31 -0500 Received: by mail-pg0-f67.google.com with SMTP id 204so6416546pge.2 for ; Fri, 20 Jan 2017 00:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=4NoUMByEoCuQF2Ecfx0vHz2RTlLEKWegEf7hJK1j9qk=; b=LrzNsvttE9KE336OCw9/aOqUo116XCd08TWWLWhcxaoBDA4qyxgmPk5VOk21mIncrL gqDwG/0KP/cSzn+QCXriQ8QQe2yFW0XF33n+UGWqpgXvezrvd+OenSKwLDJWAFLD5S5D e0Z8brq6cTBA6PEPfdlJBUmIVyeX2EcW3gdd3vC+ANVObXIxCPIrREyTV1fopd4NhR+J N2+uDFUvBTWc1IR3oDvAnt1ib6sjv8/oJGr6nPEc5LW6eTdtyeG+V5n7Ms0NQ2s7ZTJ9 SSx0++WHIkGUov3KGEGb04/ITjuHIxzp+VY2l66pc7dDAtsQqqyMsaaFLMDM1eAIs4aF WfUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=4NoUMByEoCuQF2Ecfx0vHz2RTlLEKWegEf7hJK1j9qk=; b=B158Lmm1spTK0udpJYdJ7PaE2iQSAHY7UNn9A2V+m/gwoG/vu9JiIpS0bJ1v9AdvAV xueId1NcLYFpVrR1eFSwUkliRqSReiiU/XKIcml53oXLdKaWGShcXGudF76M7LwClXBD XX/q3W9Ry5RaVZ2uF3GFWCOIL7s7z701afqAgr8CPD/xAC/zu7FyEqOkdoKFpUGlWBRi Y8wH8doXyMohx4yxmUSzBHSldxF/C4esVvnlHnhOVjXgST+fIZx2jXokpmco9Xull/+r qKtZvC336VtKyGELv0Mxvh2Z7JOy8v6t9KQEg1ffK/ZxYVTc/N+r/ErGl+VTi3Pq3EZP 9HAg== X-Gm-Message-State: AIkVDXIl/K97LWD/8CL3blcZZ8GVbGRtF3cBHUeVHBY8fkEitNCEOyWQesS24aN9T3R7ig== X-Received: by 10.84.248.70 with SMTP id e6mr20107506pln.179.1484902130389; Fri, 20 Jan 2017 00:48:50 -0800 (PST) Received: from [192.168.0.107] ([183.228.29.47]) by smtp.gmail.com with ESMTPSA id q2sm14750647pga.8.2017.01.20.00.48.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jan 2017 00:48:49 -0800 (PST) From: Kinglong Mee Subject: [PATCH] SUNRPC: cleanup ida information when removing sunrpc module To: Trond Myklebust , "J. Bruce Fields" , linux-nfs@vger.kernel.org Cc: Kinglong Mee Message-ID: Date: Fri, 20 Jan 2017 16:48:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After removing sunrpc module, I get many kmemleak information as, unreferenced object 0xffff88003316b1e0 (size 544): comm "gssproxy", pid 2148, jiffies 4294794465 (age 4200.081s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [] kmemleak_alloc+0x4a/0xa0 [] kmem_cache_alloc+0x15e/0x1f0 [] ida_pre_get+0xaa/0x150 [] ida_simple_get+0xad/0x180 [] nlmsvc_lookup_host+0x4ab/0x7f0 [lockd] [] lockd+0x4d/0x270 [lockd] [] param_set_timeout+0x55/0x100 [lockd] [] svc_defer+0x114/0x3f0 [sunrpc] [] svc_defer+0x2d7/0x3f0 [sunrpc] [] rpc_show_info+0x8a/0x110 [sunrpc] [] proc_reg_write+0x7f/0xc0 [] __vfs_write+0xdf/0x3c0 [] vfs_write+0xef/0x240 [] SyS_write+0xad/0x130 [] entry_SYSCALL_64_fastpath+0x1a/0xa9 [] 0xffffffffffffffff I found, the ida information (dynamic memory) isn't cleanup. Signed-off-by: Kinglong Mee --- include/linux/sunrpc/clnt.h | 1 + net/sunrpc/clnt.c | 5 +++++ net/sunrpc/sunrpc_syms.c | 1 + 3 files changed, 7 insertions(+) diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 85cc819..333ad11 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -216,5 +216,6 @@ void rpc_clnt_xprt_switch_put(struct rpc_clnt *); void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *, struct rpc_xprt *); bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt, const struct sockaddr *sap); +void rpc_cleanup_clids(void); #endif /* __KERNEL__ */ #endif /* _LINUX_SUNRPC_CLNT_H */ diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 1efbe48..1dc9f3b 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -336,6 +336,11 @@ static int rpc_client_register(struct rpc_clnt *clnt, static DEFINE_IDA(rpc_clids); +void rpc_cleanup_clids(void) +{ + ida_destroy(&rpc_clids); +} + static int rpc_alloc_clid(struct rpc_clnt *clnt) { int clid; diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index d1c330a..c73de18 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c @@ -119,6 +119,7 @@ init_sunrpc(void) static void __exit cleanup_sunrpc(void) { + rpc_cleanup_clids(); rpcauth_remove_module(); cleanup_socket_xprt(); svc_cleanup_xprt_sock();