From: Trond Myklebust Date: Wed, 30 Nov 2016 16:38:10 +0000 (-0500) Subject: pNFS: Don't mark the layout as freed if the last lseg is marked for return X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=abb3e1c8777ec2baffa2c736aa06280821018995;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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)) {