diff options
author | Joe Thornber <ejt@redhat.com> | 2015-08-31 13:20:08 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2015-08-31 15:08:14 -0400 |
commit | 9153df7405ae04c1b0466de720e0a685cfea1a3a (patch) | |
tree | fd347a745c978366deb5521c0c96503fa7145b89 | |
parent | f15f4d720088c140cdf1fee6aeab3549dbdddc41 (diff) |
dm cache: fix leaking of deferred bio prison cells
There were two cases where dm_cell_visit_release() was being called,
which removes the cell from the prison's rbtree, but the callers didn't
also return the cell to the mempool. Fix this by having them call
free_prison_cell().
This leak manifested as the 'kmalloc-96' slab growing until OOM.
Fixes: 651f5fa2a3 ("dm cache: defer whole cells")
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 4.1+
-rw-r--r-- | drivers/md/dm-cache-target.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 8cef66b33243..2f60cbf404e5 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -1730,6 +1730,8 @@ static void remap_cell_to_origin_clear_discard(struct cache *cache, | |||
1730 | remap_to_origin(cache, bio); | 1730 | remap_to_origin(cache, bio); |
1731 | issue(cache, bio); | 1731 | issue(cache, bio); |
1732 | } | 1732 | } |
1733 | |||
1734 | free_prison_cell(cache, cell); | ||
1733 | } | 1735 | } |
1734 | 1736 | ||
1735 | static void remap_cell_to_cache_dirty(struct cache *cache, struct dm_bio_prison_cell *cell, | 1737 | static void remap_cell_to_cache_dirty(struct cache *cache, struct dm_bio_prison_cell *cell, |
@@ -1764,6 +1766,8 @@ static void remap_cell_to_cache_dirty(struct cache *cache, struct dm_bio_prison_ | |||
1764 | remap_to_cache(cache, bio, cblock); | 1766 | remap_to_cache(cache, bio, cblock); |
1765 | issue(cache, bio); | 1767 | issue(cache, bio); |
1766 | } | 1768 | } |
1769 | |||
1770 | free_prison_cell(cache, cell); | ||
1767 | } | 1771 | } |
1768 | 1772 | ||
1769 | /*----------------------------------------------------------------*/ | 1773 | /*----------------------------------------------------------------*/ |