From 8886ed9e2bb223eece0229db36130e64d94b9308 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Tue, 11 May 2021 16:33:07 +0800 Subject: [PATCH] pNFS/NFSv4: Fix a layout segment leak in pnfs_layout_process() stable inclusion from linux-4.19.173 commit 8a9ccffb3c1a6ecbfa2c811fe329f8220696dbc0 -------------------------------- [ Upstream commit 814b84971388cd5fb182f2e914265b3827758455 ] If the server returns a new stateid that does not match the one in our cache, then pnfs_layout_process() will leak the layout segments returned by pnfs_mark_layout_stateid_invalid(). Fixes: 9888d837f3cf ("pNFS: Force a retry of LAYOUTGET if the stateid doesn't match our cache") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin Signed-off-by: Yang Yingliang Reviewed-by: Hou Tao Signed-off-by: Yang Yingliang --- fs/nfs/pnfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 46ca5592b8b0..4b165aa5a256 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2320,6 +2320,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) spin_unlock(&ino->i_lock); lseg->pls_layout = lo; NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); + pnfs_free_lseg_list(&free_me); return ERR_PTR(-EAGAIN); } -- GitLab