From patchwork Fri Nov 3 16:32:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 10040683 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 22811602D8 for ; Fri, 3 Nov 2017 16:32:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11CCD29682 for ; Fri, 3 Nov 2017 16:32:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05D472942E; Fri, 3 Nov 2017 16:32:32 +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.9 required=2.0 tests=BAYES_00,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 649542942E for ; Fri, 3 Nov 2017 16:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309AbdKCQca (ORCPT ); Fri, 3 Nov 2017 12:32:30 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:10288 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbdKCQca (ORCPT ); Fri, 3 Nov 2017 12:32:30 -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 vA3GWOMK007410; Fri, 3 Nov 2017 19:32:25 +0300 (MSK) From: Vasily Averin Subject: [PATCH] lockd: added cleanup checks in exit_net hook To: linux-nfs@vger.kernel.org, "J. Bruce Fields" , Jeff Layton Message-ID: Date: Fri, 3 Nov 2017 19:32:23 +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. [ 2355.129218] per-netns lockd_manager.list is not empty [ 2355.130483] WARNING: CPU: 7 PID: 97 at fs/lockd/svc.c:682 lockd_exit_net+0x52/0x80 [lockd] ... [ 2355.148073] per-netns grace_period_end dealyed work was not cancelled [ 2355.149205] WARNING: CPU: 7 PID: 97 at fs/lockd/svc.c:686 lockd_exit_net+0x78/0x80 [lockd] 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..119af0a 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), + "per-netns lockd_manager.list is not empty\n"); + WARN(!list_empty(&ln->nsm_handles), + "per-netns nsm_handles list is not empty\n"); + WARN(delayed_work_pending(&ln->grace_period_end), + "per-netns grace_period_end dealyed work was not cancelled\n"); } static struct pernet_operations lockd_net_ops = {