/[packages]/cauldron/kernel/current/PATCHES/patches/0088-MD-Memory-leak-when-flush-bio-size-is-zero.patch
ViewVC logotype

Contents of /cauldron/kernel/current/PATCHES/patches/0088-MD-Memory-leak-when-flush-bio-size-is-zero.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1329221 - (show annotations) (download)
Fri Nov 9 22:05:45 2018 UTC (5 years, 10 months ago) by tmb
File size: 1664 byte(s)
add fixes from sashas autosel queue
1 From 30208d713d1b57551e43e97edfd69bfcce762efc Mon Sep 17 00:00:00 2001
2 From: Xiao Ni <xni@redhat.com>
3 Date: Sat, 20 Oct 2018 08:09:25 +0800
4 Subject: [PATCH 088/145] MD: Memory leak when flush bio size is zero
5
6 [ Upstream commit af9b926de9c5986ab009e64917de87c9758bab10 ]
7
8 flush_pool is leaked when flush bio size is zero
9
10 Fixes: 5a409b4f56d5 ("MD: fix lock contention for flush bios")
11 Signed-off-by: David Jeffery <djeffery@redhat.com>
12 Signed-off-by: Xiao Ni <xni@redhat.com>
13 Signed-off-by: Shaohua Li <shli@fb.com>
14 Signed-off-by: Sasha Levin <sashal@kernel.org>
15 ---
16 drivers/md/md.c | 10 ++++++----
17 1 file changed, 6 insertions(+), 4 deletions(-)
18
19 diff --git a/drivers/md/md.c b/drivers/md/md.c
20 index 63ceabb4e020..06f68f19b5f3 100644
21 --- a/drivers/md/md.c
22 +++ b/drivers/md/md.c
23 @@ -452,10 +452,11 @@ static void md_end_flush(struct bio *fbio)
24 rdev_dec_pending(rdev, mddev);
25
26 if (atomic_dec_and_test(&fi->flush_pending)) {
27 - if (bio->bi_iter.bi_size == 0)
28 + if (bio->bi_iter.bi_size == 0) {
29 /* an empty barrier - all done */
30 bio_endio(bio);
31 - else {
32 + mempool_free(fi, mddev->flush_pool);
33 + } else {
34 INIT_WORK(&fi->flush_work, submit_flushes);
35 queue_work(md_wq, &fi->flush_work);
36 }
37 @@ -509,10 +510,11 @@ void md_flush_request(struct mddev *mddev, struct bio *bio)
38 rcu_read_unlock();
39
40 if (atomic_dec_and_test(&fi->flush_pending)) {
41 - if (bio->bi_iter.bi_size == 0)
42 + if (bio->bi_iter.bi_size == 0) {
43 /* an empty barrier - all done */
44 bio_endio(bio);
45 - else {
46 + mempool_free(fi, mddev->flush_pool);
47 + } else {
48 INIT_WORK(&fi->flush_work, submit_flushes);
49 queue_work(md_wq, &fi->flush_work);
50 }
51 --
52 2.19.1
53

  ViewVC Help
Powered by ViewVC 1.1.30