diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2016-10-18 09:31:29 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-11-30 13:45:21 +0100 |
commit | 824d8dff8846533c9f1f9b1eabb0c03959e989ca (patch) | |
tree | a3d9d7e292fce8c02d945d5e774e0f754a255114 /fs/btrfs/delayed-ref.c | |
parent | 33d1f05ccb698aa92db3e64a639ce523cf18a408 (diff) | |
download | op-kernel-dev-824d8dff8846533c9f1f9b1eabb0c03959e989ca.zip op-kernel-dev-824d8dff8846533c9f1f9b1eabb0c03959e989ca.tar.gz |
btrfs: qgroup: Fix qgroup data leaking by using subtree tracing
Commit 62b99540a1d91e464 (btrfs: relocation: Fix leaking qgroups numbers
on data extents) only fixes the problem partly.
The previous fix is to trace all new data extents at transaction commit
time when balance finishes.
However balance is not done in a large transaction, every path
replacement can happen in its own transaction.
This makes the fix useless if transaction commits during relocation.
For example:
relocate_block_group()
|-merge_reloc_roots()
| |- merge_reloc_root()
| |- btrfs_start_transaction() <- Trans X
| |- replace_path() <- Cause leak
| |- btrfs_end_transaction_throttle() <- Trans X commits here
| | Leak not fixed
| |
| |- btrfs_start_transaction() <- Trans Y
| |- replace_path() <- Cause leak
| |- btrfs_end_transaction_throttle() <- Trans Y ends
| but not committed
|-btrfs_join_transaction() <- Still trans Y
|-qgroup_fix() <- Only fixes data leak
| in trans Y
|-btrfs_commit_transaction() <- Trans Y commits
In that case, qgroup fixup can only fix data leak in trans Y, data leak
in trans X is out of fix.
So the correct fix should happen in the same transaction of
replace_path().
This patch fixes it by tracing both subtrees of tree block swap, so it
can fix the problem and ensure all leaking and fix are in the same
transaction, so no leak again.
Reported-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-and-Tested-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/delayed-ref.c')
0 files changed, 0 insertions, 0 deletions