1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

[device/bcache] fix bug in _alloc_block

This commit is contained in:
Joe Thornber 2018-02-02 14:34:45 +00:00 committed by David Teigland
parent 1563b93691
commit 19647d1cd4

View File

@ -449,8 +449,10 @@ static void _exit_free_list(struct bcache *cache)
static struct block *_alloc_block(struct bcache *cache)
{
struct block *b = dm_list_struct_base(_list_pop(&cache->free), struct block, list);
return b;
if (dm_list_empty(&cache->free))
return NULL;
return dm_list_struct_base(_list_pop(&cache->free), struct block, list);
}
/*----------------------------------------------------------------