From patchwork Fri Sep 21 01:35:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 1488651 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4C502DF2D2 for ; Fri, 21 Sep 2012 01:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754491Ab2IUBgE (ORCPT ); Thu, 20 Sep 2012 21:36:04 -0400 Received: from mx2.netapp.com ([216.240.18.37]:58062 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753090Ab2IUBgD (ORCPT ); Thu, 20 Sep 2012 21:36:03 -0400 X-IronPort-AV: E=Sophos;i="4.80,458,1344236400"; d="scan'208";a="692166502" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 20 Sep 2012 18:36:01 -0700 Received: from lade.trondhjem.org.com (lade.trondhjem.org [10.63.233.1] (may be forged)) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q8L1a0bx022580; Thu, 20 Sep 2012 18:36:01 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 01/14] NFSv4.1: Fix a reference leak in pnfs_update_layout Date: Thu, 20 Sep 2012 21:35:44 -0400 Message-Id: <1348191357-44503-1-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.11.4 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If we exit after the call to pnfs_find_alloc_layout(), we have to ensure that we put the struct pnfs_layout_hdr. Signed-off-by: Trond Myklebust --- fs/nfs/pnfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 6656cb4..cbbb0fc 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1070,7 +1070,8 @@ pnfs_update_layout(struct inode *ino, lo = pnfs_find_alloc_layout(ino, ctx, gfp_flags); if (lo == NULL) { dprintk("%s ERROR: can't get pnfs_layout_hdr\n", __func__); - goto out_unlock; + spin_unlock(&ino->i_lock); + return NULL; } /* Do we even need to bother with this? */ @@ -1125,8 +1126,8 @@ pnfs_update_layout(struct inode *ino, spin_unlock(&clp->cl_lock); } atomic_dec(&lo->plh_outstanding); - pnfs_put_layout_hdr(lo); out: + pnfs_put_layout_hdr(lo); dprintk("%s end, state 0x%lx lseg %p\n", __func__, nfsi->layout ? nfsi->layout->plh_flags : -1, lseg); return lseg;