Skip to content

Commit

Permalink
dm space map common: fix division bug in sm_ll_find_free_block()
Browse files Browse the repository at this point in the history
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: [email protected]
Signed-off-by: Joe Thornber <[email protected]>
Tested-by: Ming-Hung Tsai <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
  • Loading branch information
jthornber authored and snitm committed Apr 19, 2021
1 parent a88b235 commit 5208692
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/md/persistent-data/dm-space-map-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5208692

Please sign in to comment.