]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: qgroup: Fix a race in delayed_ref which leads to abort trans
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Mon, 26 Oct 2015 06:11:18 +0000 (14:11 +0800)
committerChris Mason <clm@fb.com>
Tue, 27 Oct 2015 02:44:39 +0000 (19:44 -0700)
commit1bb3a05081982280d684ea06160d5c9848429d18
tree8495bf1ae8236d363579751a63414ba31c498a0d
parent01c010bb9c5d1baa08b5065e0d07f166257fc74a
btrfs: qgroup: Fix a race in delayed_ref which leads to abort trans

Between btrfs_allocerved_file_extent() and
btrfs_add_delayed_qgroup_reserve(), there is a window that delayed_refs
are run and delayed ref head maybe freed before
btrfs_add_delayed_qgroup_reserve().

This will cause btrfs_dad_delayed_qgroup_reserve() to return -ENOENT,
and cause transaction to be aborted.

This patch will record qgroup reserve space info into delayed_ref_head
at btrfs_add_delayed_ref(), to eliminate the race window.

Reported-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ctree.h
fs/btrfs/delayed-ref.c
fs/btrfs/delayed-ref.h
fs/btrfs/extent-tree.c
fs/btrfs/inode.c