[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181031230754.29029-77-sashal@kernel.org>
Date: Wed, 31 Oct 2018 19:07:05 -0400
From: Sasha Levin <sashal@...nel.org>
To: stable@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Xiao Ni <xni@...hat.com>, David Jeffery <djeffery@...hat.com>,
Shaohua Li <shli@...com>, Sasha Levin <sashal@...nel.org>
Subject: [PATCH AUTOSEL 4.18 077/126] MD: Memory leak when flush bio size is zero
From: Xiao Ni <xni@...hat.com>
[ Upstream commit af9b926de9c5986ab009e64917de87c9758bab10 ]
flush_pool is leaked when flush bio size is zero
Fixes: 5a409b4f56d5 ("MD: fix lock contention for flush bios")
Signed-off-by: David Jeffery <djeffery@...hat.com>
Signed-off-by: Xiao Ni <xni@...hat.com>
Signed-off-by: Shaohua Li <shli@...com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/md/md.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 994aed2f9dff..e9be5cd9bb96 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -455,10 +455,11 @@ static void md_end_flush(struct bio *fbio)
rdev_dec_pending(rdev, mddev);
if (atomic_dec_and_test(&fi->flush_pending)) {
- if (bio->bi_iter.bi_size == 0)
+ if (bio->bi_iter.bi_size == 0) {
/* an empty barrier - all done */
bio_endio(bio);
- else {
+ mempool_free(fi, mddev->flush_pool);
+ } else {
INIT_WORK(&fi->flush_work, submit_flushes);
queue_work(md_wq, &fi->flush_work);
}
@@ -512,10 +513,11 @@ void md_flush_request(struct mddev *mddev, struct bio *bio)
rcu_read_unlock();
if (atomic_dec_and_test(&fi->flush_pending)) {
- if (bio->bi_iter.bi_size == 0)
+ if (bio->bi_iter.bi_size == 0) {
/* an empty barrier - all done */
bio_endio(bio);
- else {
+ mempool_free(fi, mddev->flush_pool);
+ } else {
INIT_WORK(&fi->flush_work, submit_flushes);
queue_work(md_wq, &fi->flush_work);
}
--
2.17.1
Powered by blists - more mailing lists