pNFS/NFSv4: Fix a layout segment leak in pnfs_layout_process()

[ 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: 9888d837f3 ("pNFS: Force a retry of LAYOUTGET if the stateid doesn't match our cache")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Trond Myklebust 2021-01-21 16:34:37 -05:00 committed by Greg Kroah-Hartman
parent a3c5fec1e0
commit f39fce916a
1 changed files with 1 additions and 0 deletions

View File

@ -2388,6 +2388,7 @@ out_forget:
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);
}