diff options
author | Joe Thornber <ejt@redhat.com> | 2021-04-13 09:11:53 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2021-04-19 12:48:13 -0400 |
commit | 5208692e80a1f3c8ce2063a22b675dd5589d1d80 (patch) | |
tree | 62b5b0f708c857cc278e8e4ce47f7ae5b126329f /drivers/md | |
parent | a88b2358f1da2c9f9fcc432f2e0a79617fea397c (diff) | |
download | linux-5208692e80a1f3c8ce2063a22b675dd5589d1d80.tar.bz2 |
dm space map common: fix division bug in sm_ll_find_free_block()
This division bug meant the search for free metadata space could skip
the final allocation bitmap's worth of entries. Fix affects DM thinp,
cache and era targets.
Cc: stable@vger.kernel.org
Signed-off-by: Joe Thornber <ejt@redhat.com>
Tested-by: Ming-Hung Tsai <mtsai@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/persistent-data/dm-space-map-common.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c index d8b4125e338c..a213bf11738f 100644 --- a/drivers/md/persistent-data/dm-space-map-common.c +++ b/drivers/md/persistent-data/dm-space-map-common.c @@ -339,6 +339,8 @@ int sm_ll_find_free_block(struct ll_disk *ll, dm_block_t begin, */ begin = do_div(index_begin, ll->entries_per_block); end = do_div(end, ll->entries_per_block); + if (end == 0) + end = ll->entries_per_block; for (i = index_begin; i < index_end; i++, begin = 0) { struct dm_block *blk; |