From: Trond Myklebust <trond.myklebust@hammerspace.com>
Date: Thu, 21 Jan 2021 16:34:37 -0500
Subject: [PATCH] pNFS/NFSv4: Fix a layout segment leak in
pnfs_layout_process()
Git-commit: 814b84971388cd5fb182f2e914265b3827758455
Patch-mainline: v5.11
References: git-fixes
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 <trond.myklebust@hammerspace.com>
Acked-by: NeilBrown <neilb@suse.com>
---
fs/nfs/pnfs.c | 1 +
1 file changed, 1 insertion(+)
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2031,6 +2031,7 @@ out_forget:
NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
if (!pnfs_layout_is_valid(lo))
nfs_commit_inode(ino, 0);
+ pnfs_free_lseg_list(&free_me);
return ERR_PTR(-EAGAIN);
}