summaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-11-30 11:38:10 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-12-01 17:21:50 -0500
commitabb3e1c8777ec2baffa2c736aa06280821018995 (patch)
treeb3393ac9c9e1f12163d798be1de74fba5939c694 /fs/nfs/pnfs.c
parent4aab97327f35aac17b7f62976ea44b1bacfaa92b (diff)
downloadlinux-abb3e1c8777ec2baffa2c736aa06280821018995.tar.bz2
pNFS: Don't mark the layout as freed if the last lseg is marked for return
Address another memory leak. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r--fs/nfs/pnfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 08acfa49f115..57ec46b57364 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -455,6 +455,8 @@ pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo,
list_del_init(&lseg->pls_list);
/* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */
atomic_dec(&lo->plh_refcount);
+ if (test_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags))
+ return;
if (list_empty(&lo->plh_segs) &&
!test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags) &&
!test_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) {