Skip to content
Snippets Groups Projects
Commit 0535d9a3 authored by Joe Thornber's avatar Joe Thornber Committed by Yang Yingliang
Browse files

dm space map common: fix division bug in sm_ll_find_free_block()


stable inclusion
from linux-4.19.191
commit 7cba7ebfd905cae6a50f548477a0e17ccd176ddf

--------------------------------

commit 5208692e80a1f3c8ce2063a22b675dd5589d1d80 upstream.

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>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 8f19789f
No related branches found
No related tags found
No related merge requests found
......@@ -337,6 +337,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;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment