Dennis Yang
1773131ec4
dm thin: fix a memory leak when passing discard bio down
commit 948f581a53 upstream.
dm-thin does not free the discard_parent bio after all chained sub
bios finished. The following kmemleak report could be observed after
pool with discard_passdown option processes discard bios in
linux v4.11-rc7. To fix this, we drop the discard_parent bio reference
when its endio (passdown_endio) called.
unreferenced object 0xffff8803d6b29700 (size 256):
comm "kworker/u8:0", pid 30349, jiffies 4379504020 (age 143002.776s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01 00 00 00 00 00 00 f0 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81a5efd9>] kmemleak_alloc+0x49/0xa0
[<ffffffff8114ec34>] kmem_cache_alloc+0xb4/0x100
[<ffffffff8110eec0>] mempool_alloc_slab+0x10/0x20
[<ffffffff8110efa5>] mempool_alloc+0x55/0x150
[<ffffffff81374939>] bio_alloc_bioset+0xb9/0x260
[<ffffffffa018fd20>] process_prepared_discard_passdown_pt1+0x40/0x1c0 [dm_thin_pool]
[<ffffffffa018b409>] break_up_discard_bio+0x1a9/0x200 [dm_thin_pool]
[<ffffffffa018b484>] process_discard_cell_passdown+0x24/0x40 [dm_thin_pool]
[<ffffffffa018b24d>] process_discard_bio+0xdd/0xf0 [dm_thin_pool]
[<ffffffffa018ecf6>] do_worker+0xa76/0xd50 [dm_thin_pool]
[<ffffffff81086239>] process_one_work+0x139/0x370
[<ffffffff810867b1>] worker_thread+0x61/0x450
[<ffffffff8108b316>] kthread+0xd6/0xf0
[<ffffffff81a6cd1f>] ret_from_fork+0x3f/0x70
[<ffffffffffffffff>] 0xffffffffffffffff
Signed-off-by: Dennis Yang <dennisyang@qnap.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-20 14:28:37 +02:00
..
2017-02-23 17:44:36 +01:00
2017-01-06 10:40:16 +01:00
2016-09-21 09:09:44 -07:00
2016-05-04 12:39:35 -07:00
2016-10-09 17:16:18 -07:00
2016-06-10 15:15:44 -04:00
2016-09-22 11:15:05 -04:00
2016-09-22 11:15:02 -04:00
2016-09-22 11:15:02 -04:00
2016-09-22 11:15:03 -04:00
2016-09-22 11:15:02 -04:00
2017-03-12 06:41:44 +01:00
2016-06-10 15:15:44 -04:00
2017-01-06 10:40:15 +01:00
2017-05-20 14:28:37 +02:00
2017-01-06 10:40:15 +01:00
2016-08-07 14:41:02 -06:00
2017-05-08 07:47:55 +02:00
2016-06-10 15:15:44 -04:00
2016-07-28 17:38:16 -07:00
2016-10-07 14:42:05 -07:00
2016-08-24 21:55:05 -04:00
2016-09-29 10:57:07 -04:00
2016-10-14 11:55:17 -04:00
2017-04-12 12:41:13 +02:00
2016-08-07 14:41:02 -06:00
2017-03-12 06:41:44 +01:00
2017-05-20 14:28:37 +02:00
2016-09-15 11:16:05 -04:00
2016-06-07 13:41:38 -06:00
2016-08-07 14:41:02 -06:00
2017-03-12 06:41:44 +01:00
2016-08-07 14:41:02 -06:00
2016-06-10 15:15:44 -04:00
2017-01-06 10:40:15 +01:00
2016-07-28 17:38:16 -07:00
2016-07-20 12:43:35 -04:00
2016-07-20 12:43:35 -04:00
2017-05-20 14:28:37 +02:00
2017-04-12 12:41:12 +02:00
2017-04-12 12:41:12 +02:00
2016-08-07 14:41:02 -06:00
2017-04-08 09:30:36 +02:00
2016-07-20 23:49:49 -04:00
2017-03-12 06:41:52 +01:00
2017-03-12 06:41:52 +01:00
2016-06-10 15:15:44 -04:00
2016-09-21 09:09:44 -07:00
2016-05-09 09:24:03 -07:00
2017-01-12 11:39:35 +01:00
2016-09-21 09:09:44 -07:00
2016-08-07 14:41:02 -06:00
2016-08-07 14:41:02 -06:00
2016-10-28 22:04:04 -07:00
2016-10-28 22:04:03 -07:00
2017-01-09 08:32:22 +01:00
2016-09-06 18:30:23 +02:00
2017-04-08 09:30:36 +02:00
2016-07-19 15:20:28 -07:00