All of lore.kernel.org
 help / color / mirror / Atom feed
From: trondmy@kernel.org
To: linux-nfs@vger.kernel.org
Subject: [PATCH 05/10] NFS: Fix memory leaks in nfs_pageio_stop_mirroring()
Date: Wed,  1 Apr 2020 14:56:47 -0400	[thread overview]
Message-ID: <20200401185652.1904777-6-trondmy@kernel.org> (raw)
In-Reply-To: <20200401185652.1904777-5-trondmy@kernel.org>

From: Trond Myklebust <trond.myklebust@hammerspace.com>

If we just set the mirror count to 1 without first clearing out
the mirrors, we can leak queued up requests.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/pagelist.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 99eb839c5778..1fd4862217e0 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -900,15 +900,6 @@ static void nfs_pageio_setup_mirroring(struct nfs_pageio_descriptor *pgio,
 	pgio->pg_mirror_count = mirror_count;
 }
 
-/*
- * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1)
- */
-void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio)
-{
-	pgio->pg_mirror_count = 1;
-	pgio->pg_mirror_idx = 0;
-}
-
 static void nfs_pageio_cleanup_mirroring(struct nfs_pageio_descriptor *pgio)
 {
 	pgio->pg_mirror_count = 1;
@@ -1334,6 +1325,14 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)
 	}
 }
 
+/*
+ * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1)
+ */
+void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio)
+{
+	nfs_pageio_complete(pgio);
+}
+
 int __init nfs_init_nfspagecache(void)
 {
 	nfs_page_cachep = kmem_cache_create("nfs_page",
-- 
2.25.1


  reply	other threads:[~2020-04-01 18:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01 18:56 [PATCH 00/10] NFS: Fix a number of memory leaks and use-after-free trondmy
2020-04-01 18:56 ` [PATCH 01/10] NFS: Fix a page leak in nfs_destroy_unlinked_subrequests() trondmy
2020-04-01 18:56   ` [PATCH 02/10] NFS: Fix races nfs_page_group_destroy() vs nfs_destroy_unlinked_subrequests() trondmy
2020-04-01 18:56     ` [PATCH 03/10] NFS: Fix use-after-free issues in nfs_pageio_add_request() trondmy
2020-04-01 18:56       ` [PATCH 04/10] NFS: Fix a request reference leak in nfs_direct_write_clear_reqs() trondmy
2020-04-01 18:56         ` trondmy [this message]
2020-04-01 18:56           ` [PATCH 06/10] NFS: Remove the redundant function nfs_pgio_has_mirroring() trondmy
2020-04-01 18:56             ` [PATCH 07/10] NFS: Clean up nfs_lock_and_join_requests() trondmy
2020-04-01 18:56               ` [PATCH 08/10] NFS: Reverse the submission order of requests in __nfs_pageio_add_request() trondmy
2020-04-01 18:56                 ` [PATCH 09/10] NFS: Refactor nfs_lock_and_join_requests() trondmy
2020-04-01 18:56                   ` [PATCH 10/10] NFS: Try to join page groups before an O_DIRECT retransmission trondmy
2020-04-02 16:14           ` [PATCH 05/10] NFS: Fix memory leaks in nfs_pageio_stop_mirroring() Anna Schumaker
2020-04-02 16:54             ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200401185652.1904777-6-trondmy@kernel.org \
    --to=trondmy@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.