From patchwork Mon Nov 17 03:05:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Tao X-Patchwork-Id: 5315411 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 67C939F1E1 for ; Mon, 17 Nov 2014 03:05:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7342E2012F for ; Mon, 17 Nov 2014 03:05:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76C2E20125 for ; Mon, 17 Nov 2014 03:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753640AbaKQDFg (ORCPT ); Sun, 16 Nov 2014 22:05:36 -0500 Received: from mail-pd0-f182.google.com ([209.85.192.182]:64029 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751547AbaKQDFf (ORCPT ); Sun, 16 Nov 2014 22:05:35 -0500 Received: by mail-pd0-f182.google.com with SMTP id g10so5129614pdj.41 for ; Sun, 16 Nov 2014 19:05:35 -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; bh=cdnFBDZ2W9A6amtRuOUxCCGY2eSj3D17KS0dxVG2gxw=; b=WNLqIjWJhU7uKfvAByHoIgEqezugE+W67se6nqRQ/ZIj8/HFgG5aud36gIlquibG1b 67PMvfbq4SO70j/TVLc+/XehLpuKzXf+khNHR+pXnzWf4RpsfPOdU9PnDfdYXghfEciN DOwPcjG0YpgPbrk2XXcoxyhdJQm/POVXW8KgF1fMhvQmCfEkdYSWbLLBOFwVFVoLy7tW 68YeUTYBwk+kt2XGqhoWH5/Bs2aoXxeOIzAPSiXYRrsMbk6ee2dyrmyo3ICfjUH2+xkJ fuh58CbxJaHvLlOMk3RPDp58wEL6Y+LSvTP3SnZcQppHoOD2nyE0y1dLZM56vUsAx50P LsqQ== X-Gm-Message-State: ALoCoQkz/0DXqjeQIg20jS3J9MlqJZ+r4UPeePwsCKDEGccnJZI2M5QfnwKoKdWdAif3M7H2QoOs X-Received: by 10.70.90.140 with SMTP id bw12mr1277924pdb.127.1416193535433; Sun, 16 Nov 2014 19:05:35 -0800 (PST) Received: from localhost.localdomain ([125.70.39.146]) by mx.google.com with ESMTPSA id vo10sm33706846pab.19.2014.11.16.19.05.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 16 Nov 2014 19:05:34 -0800 (PST) From: Peng Tao To: linux-nfs@vger.kernel.org Cc: Trond Myklebust , Peng Tao Subject: [PATCH] nfs41: fix nfs4_proc_layoutget error handling Date: Mon, 17 Nov 2014 11:05:17 +0800 Message-Id: <1416193517-14815-1-git-send-email-tao.peng@primarydata.com> X-Mailer: git-send-email 1.9.1 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 nfs4_layoutget_release() drops layout hdr refcnt. Grab the refcnt early so that it is safe to call .release in case nfs4_alloc_pages fails. Signed-off-by: Peng Tao --- fs/nfs/nfs4proc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 405bd95..d14b1f6 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -7709,6 +7709,9 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) dprintk("--> %s\n", __func__); + /* nfs4_layoutget_release calls pnfs_put_layout_hdr */ + pnfs_get_layout_hdr(NFS_I(inode)->layout); + lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags); if (!lgp->args.layout.pages) { nfs4_layoutget_release(lgp); @@ -7721,9 +7724,6 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) lgp->res.seq_res.sr_slot = NULL; nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0); - /* nfs4_layoutget_release calls pnfs_put_layout_hdr */ - pnfs_get_layout_hdr(NFS_I(inode)->layout); - task = rpc_run_task(&task_setup_data); if (IS_ERR(task)) return ERR_CAST(task);