Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm array: fix unreleased btree blocks on closing a faulty array cursor

The cached block pointer in dm_array_cursor might be NULL if it reaches
an unreadable array block, or the array is empty. Therefore,
dm_array_cursor_end() should call dm_btree_cursor_end() unconditionally,
to prevent leaving unreleased btree blocks.

This fix can be verified using the "array_cursor/iterate/empty" test
in dm-unit:
dm-unit run /pdata/array_cursor/iterate/empty --kernel-dir <KERNEL_DIR>

Signed-off-by: Ming-Hung Tsai <mtsai@redhat.com>
Fixes: fdd1315aa5f0 ("dm array: introduce cursor api")
Reviewed-by: Joe Thornber <thornber@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

authored by

Ming-Hung Tsai and committed by
Mike Snitzer
626f128e f2893c08

+3 -3
+3 -3
drivers/md/persistent-data/dm-array.c
··· 960 960 961 961 void dm_array_cursor_end(struct dm_array_cursor *c) 962 962 { 963 - if (c->block) { 963 + if (c->block) 964 964 unlock_ablock(c->info, c->block); 965 - dm_btree_cursor_end(&c->cursor); 966 - } 965 + 966 + dm_btree_cursor_end(&c->cursor); 967 967 } 968 968 EXPORT_SYMBOL_GPL(dm_array_cursor_end); 969 969