From patchwork Wed Dec 24 07:13:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5537111 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB4639F301 for ; Wed, 24 Dec 2014 07:14:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFF9D201C7 for ; Wed, 24 Dec 2014 07:14:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A573201B9 for ; Wed, 24 Dec 2014 07:14:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751897AbaLXHON (ORCPT ); Wed, 24 Dec 2014 02:14:13 -0500 Received: from mail-ie0-f176.google.com ([209.85.223.176]:33212 "EHLO mail-ie0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751821AbaLXHOM (ORCPT ); Wed, 24 Dec 2014 02:14:12 -0500 Received: by mail-ie0-f176.google.com with SMTP id tr6so6976627ieb.7 for ; Tue, 23 Dec 2014 23:14:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2Vh5/7oC1Op7NYucu6Ochpy0OYzTsAKrz9otdKCFbMU=; b=HHnypTjh9PVXFaqghsVSjaeJ1X3ZII4Xhso4QCRST22hfz08Lz3hSvJxNZP6groLml Nqw2dRVy2Do0M5cMuCqylkxMAVfbKmoBhbdPdnrXrhqyD+xhNxChC0kA4JivyJCsovFX Iocnvlegsbn0Gzyp/sHOuE71ItDL+JPiqRSacQlMpgwOs9yg5Q2NGUYWAfSARYI35w1p koTJviQO3Q4d1IXY7nPa76tyZi21ri0kbJWzMwK98mC1MafEBAycceivmVHsQfHvFg78 5KKXwnAEwkVrH9cyYpMSV7aacEk0EeBvbfHWZhaN0Vb/5aXI7hNU5HGQON4x24BjyAQm HXFg== X-Gm-Message-State: ALoCoQnJb/i+OJuMhMh47thcYySn2T0ApjZ4JM6yfRZ3TVh8EBHTfDvCG5IM+jt1uwESjN3VxTFS X-Received: by 10.42.12.147 with SMTP id y19mr25169949icy.80.1419405251313; Tue, 23 Dec 2014 23:14:11 -0800 (PST) Received: from localhost.localdomain (c-68-40-185-14.hsd1.mi.comcast.net. [68.40.185.14]) by mx.google.com with ESMTPSA id 37sm8821410iog.39.2014.12.23.23.14.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Dec 2014 23:14:10 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing List Subject: [PATCH v2 38/49] nfs41: add a debug warning if we destroy an unempty layout Date: Tue, 23 Dec 2014 23:13:17 -0800 Message-Id: <1419405208-25975-39-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1419405208-25975-1-git-send-email-loghyr@primarydata.com> References: <1419405208-25975-1-git-send-email-loghyr@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peng Tao So that we can detect the case if some layout segments are still pinned which is surely a bug that we need to fix. Signed-off-by: Peng Tao --- fs/nfs/pnfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 5f7c422..e123cfc 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -242,6 +242,8 @@ pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo) struct inode *inode = lo->plh_inode; if (atomic_dec_and_lock(&lo->plh_refcount, &inode->i_lock)) { + if (!list_empty(&lo->plh_segs)) + WARN_ONCE(1, "NFS: BUG unfreed layout segments.\n"); pnfs_detach_layout_hdr(lo); spin_unlock(&inode->i_lock); pnfs_free_layout_hdr(lo);