summaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-20 21:25:19 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-28 16:03:10 -0400
commit830ffb565760234eb984e4343ad82575e96728de (patch)
treeb4d1be236d51d30624bc9b2bb5cacb75a640d7fd /fs/nfs
parent1dfed2737d8cfe2f2378fddfb3bed126ff5474e7 (diff)
downloadlinux-3.10-830ffb565760234eb984e4343ad82575e96728de.tar.gz
linux-3.10-830ffb565760234eb984e4343ad82575e96728de.tar.bz2
linux-3.10-830ffb565760234eb984e4343ad82575e96728de.zip
NFSv4.1: Fix a reference leak in pnfs_update_layout
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 <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 2c59da5511d..d7a8f03e729 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1067,8 +1067,10 @@ pnfs_update_layout(struct inode *ino,
spin_lock(&ino->i_lock);
lo = pnfs_find_alloc_layout(ino, ctx, gfp_flags);
- if (lo == NULL)
- goto out_unlock;
+ if (lo == NULL) {
+ spin_unlock(&ino->i_lock);
+ goto out;
+ }
/* Do we even need to bother with this? */
if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
@@ -1122,6 +1124,7 @@ pnfs_update_layout(struct inode *ino,
spin_unlock(&clp->cl_lock);
}
atomic_dec(&lo->plh_outstanding);
+out_put_layout_hdr:
pnfs_put_layout_hdr(lo);
out:
dprintk("%s: inode %s/%llu pNFS layout segment %s for "
@@ -1135,7 +1138,7 @@ out:
return lseg;
out_unlock:
spin_unlock(&ino->i_lock);
- goto out;
+ goto out_put_layout_hdr;
}
EXPORT_SYMBOL_GPL(pnfs_update_layout);