summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.de>2015-06-30 14:42:05 -0700
committerChris Mason <clm@fb.com>2015-07-01 17:17:14 -0700
commitf441460202cb787c49963bcc1f54cb48c52f7512 (patch)
treeb66f909b1cf80dc1e2736f5716fb5566ec368a06 /tools
parent207910ddeeda38fd54544d94f8c8ca5a9632cc25 (diff)
downloadlinux-f441460202cb787c49963bcc1f54cb48c52f7512.tar.gz
btrfs: fix deadlock with extent-same and readpage
->readpage() does page_lock() before extent_lock(), we do the opposite in
extent-same. We want to reverse the order in btrfs_extent_same() but it's
not quite straightforward since the page locks are taken inside btrfs_cmp_data().

So I split btrfs_cmp_data() into 3 parts with a small context structure that
is passed between them. The first, btrfs_cmp_data_prepare() gathers up the
pages needed (taking page lock as required) and puts them on our context
structure. At this point, we are safe to lock the extent range. Afterwards,
we use btrfs_cmp_data() to do the data compare as usual and btrfs_cmp_data_free()
to clean up our context.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions