aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Tao <tao.peng@primarydata.com>2014-11-16 22:05:17 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-11-24 17:14:54 -0500
commit4bd5a980de87d2b5af417485bde97b8eb3d6cf6a (patch)
tree2a6ea37a5b07ab66951519a076d5f2e6c0c6905e
parentcb1410c71e0b6b2eba8c1890645a76ff86169d24 (diff)
nfs41: fix nfs4_proc_layoutget error handling
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 <tao.peng@primarydata.com> Fixes: a47970ff78147 ("NFSv4.1: Hold reference to layout hdr in layoutget") Cc: stable@vger.kernel.org # 3.9+ Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/nfs4proc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 15d5eb52cde8..3138913d1cdf 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7702,6 +7702,9 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags)
7702 7702
7703 dprintk("--> %s\n", __func__); 7703 dprintk("--> %s\n", __func__);
7704 7704
7705 /* nfs4_layoutget_release calls pnfs_put_layout_hdr */
7706 pnfs_get_layout_hdr(NFS_I(inode)->layout);
7707
7705 lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags); 7708 lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags);
7706 if (!lgp->args.layout.pages) { 7709 if (!lgp->args.layout.pages) {
7707 nfs4_layoutget_release(lgp); 7710 nfs4_layoutget_release(lgp);
@@ -7714,9 +7717,6 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags)
7714 lgp->res.seq_res.sr_slot = NULL; 7717 lgp->res.seq_res.sr_slot = NULL;
7715 nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0); 7718 nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0);
7716 7719
7717 /* nfs4_layoutget_release calls pnfs_put_layout_hdr */
7718 pnfs_get_layout_hdr(NFS_I(inode)->layout);
7719
7720 task = rpc_run_task(&task_setup_data); 7720 task = rpc_run_task(&task_setup_data);
7721 if (IS_ERR(task)) 7721 if (IS_ERR(task))
7722 return ERR_CAST(task); 7722 return ERR_CAST(task);