]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dm btree: fix a recursion depth bug in btree walking code
authorJoe Thornber <ejt@redhat.com>
Mon, 10 Nov 2014 15:03:24 +0000 (15:03 +0000)
committerJiri Slaby <jslaby@suse.cz>
Wed, 19 Nov 2014 17:38:21 +0000 (18:38 +0100)
commitd0960e2100d219b38ac94bddcca37c04281f31e9
treef7a52637bae2a0e436a33b96debd8570da710567
parentd1bb12f652136abaa633ca8a8e2cd700c960fefb
dm btree: fix a recursion depth bug in btree walking code

commit 9b460d3699324d570a4d4161c3741431887f102f upstream.

The walk code was using a 'ro_spine' to hold it's locked btree nodes.
But this data structure is designed for the rolling lock scheme, and
as such automatically unlocks blocks that are two steps up the call
chain.  This is not suitable for the simple recursive walk algorithm,
which retraces its steps.

This code is only used by the persistent array code, which in turn is
only used by dm-cache.  In order to trigger it you need to have a
mapping tree that is more than 2 levels deep; which equates to 8-16
million cache blocks.  For instance a 4T ssd with a very small block
size of 32k only just triggers this bug.

The fix just places the locked blocks on the stack, and stops using
the ro_spine altogether.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/md/persistent-data/dm-btree-internal.h
drivers/md/persistent-data/dm-btree-spine.c
drivers/md/persistent-data/dm-btree.c