Blob Blame History Raw
From: Trond Myklebust <trond.myklebust@hammerspace.com>
Date: Wed, 6 Jan 2021 14:13:22 -0500
Subject: [PATCH] NFS/pNFS: Fix a leak of the layout 'plh_outstanding' counter
Git-commit: cb2856c5971723910a86b7d1d0cf623d6919cbc4
Patch-mainline: v5.11-rc4
References: for-next

If we exit _lgopen_prepare_attached() without setting a layout, we will
currently leak the plh_outstanding counter.

Fixes: 411ae722d10a ("pNFS: Wait for stale layoutget calls to complete in pnfs_update_layout()")
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
@@ -2125,6 +2125,7 @@ static void _lgopen_prepare_attached(str
 					     &rng, GFP_KERNEL);
 	if (!lgp) {
 		pnfs_clear_first_layoutget(lo);
+		nfs_layoutget_end(lo);
 		pnfs_put_layout_hdr(lo);
 		return;
 	}