]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix unprotected deletion from pending_chunks list
authorFilipe Manana <fdmanana@suse.com>
Tue, 2 Dec 2014 18:07:49 +0000 (18:07 +0000)
committerChris Mason <clm@fb.com>
Wed, 3 Dec 2014 02:35:10 +0000 (18:35 -0800)
commite60184a92a892e7ac8dd74026cf31e7e00b2aa1b
tree88a5485643a8487ca6e3358d65a0a6fb21fa88dc
parent349317a9eb1781c48eb4d794691197ac4a6b02d4
Btrfs: fix unprotected deletion from pending_chunks list

On block group remove if the corresponding extent map was on the
transaction->pending_chunks list, we were deleting the extent map
from that list, through remove_extent_mapping(), without any
synchronization with chunk allocation (which iterates that list
and adds new elements to it). Fix this by ensure that this is done
while the chunk mutex is held, since that's the mutex that protects
the list in the chunk allocation code path.

This applies on top (depends on) of my previous patch titled:
"Btrfs: fix race between fs trimming and block group remove/allocation"

But the issue in fact was already present before that change, it only
became easier to hit after Josef's 3.18 patch that added automatic
removal of empty block groups.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/extent-tree.c