From patchwork Fri Nov 3 18:55:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 10041077 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 D83B2602D8 for ; Fri, 3 Nov 2017 18:55:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8E6B29868 for ; Fri, 3 Nov 2017 18:55:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB7692986A; Fri, 3 Nov 2017 18:55:46 +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=-5.9 required=2.0 tests=BAYES_00,HEXHASH_WORD, RCVD_IN_DNSWL_HI 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 0375029868 for ; Fri, 3 Nov 2017 18:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752371AbdKCSzo (ORCPT ); Fri, 3 Nov 2017 14:55:44 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:47446 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290AbdKCSzn (ORCPT ); Fri, 3 Nov 2017 14:55:43 -0400 Received: from [172.16.24.21] (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id vA3IteBk018657; Fri, 3 Nov 2017 21:55:40 +0300 (MSK) From: Vasily Averin Subject: [PATCH v2] lockd: added cleanup checks in exit_net hook To: linux-nfs@vger.kernel.org, "J. Bruce Fields" , Jeff Layton Message-ID: <05af9114-e36b-996e-1822-9d7da06e0140@virtuozzo.com> Date: Fri, 3 Nov 2017 21:55:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-US 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 Patch generates warnings if exit_net hook detects that structures initialized in init_net hook are still in use. [ 9313.047796] NFSD: starting 90-second grace period (net ffff880e307fe240) [ 9317.257203] nfsd: last server has exited, flushing export cache [ 9320.059256] net ffff880e307fe240 exit: lockd_manager.list is not empty [ 9320.060434] WARNING: CPU: 5 PID: 1556 at fs/lockd/svc.c:682 lockd_exit_net+0x5c/0x90 [lockd] ... [ 9320.077346] net ffff880e307fe240 exit: grace_period_end was not canceled [ 9320.078494] WARNING: CPU: 5 PID: 1556 at fs/lockd/svc.c:686 lockd_exit_net+0x88/0x90 [lockd] v2: net pointer was added to output Signed-off-by: Vasily Averin --- fs/lockd/svc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 809cbcc..2f28850 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -690,6 +690,14 @@ static int lockd_init_net(struct net *net) static void lockd_exit_net(struct net *net) { + struct lockd_net *ln = net_generic(net, lockd_net_id); + + WARN(!list_empty(&ln->lockd_manager.list), + "net %p exit: lockd_manager.list is not empty\n", net); + WARN(!list_empty(&ln->nsm_handles), + "net %p exit: nsm_handles list is not empty\n", net); + WARN(delayed_work_pending(&ln->grace_period_end), + "net %p exit: grace_period_end was not canceled\n", net); } static struct pernet_operations lockd_net_ops = {