Commit 5208692e authored by Joe Thornber's avatar Joe Thornber Committed by Mike Snitzer
Browse files

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: default avatarJoe Thornber <ejt@redhat.com>
Tested-by: default avatarMing-Hung Tsai <mtsai@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent a88b2358
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;