linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] btrfs: qgroup rescan fixes part 1
@ 2018-05-14  1:38 Qu Wenruo
  2018-05-14  1:38 ` [PATCH v2 1/2] btrfs: qgroup: Search commit root for rescan to avoid missing extent Qu Wenruo
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Qu Wenruo @ 2018-05-14  1:38 UTC (permalink / raw)
  To: linux-btrfs

This patchset is mainly focused on fixing qgroup rescan corruption.

Since the whole btrfs qgroup is based on the modification between 2
transactions, it only has correct qgroup delta.
While if the rescan can't provide a correct result from the very
beginning, qgroup numbers are corrupted.

The patchset is fixing two types of qgroup corruption which could happen
by looping btrfs/017 with some possibility.

1) Not accounting tree blocks
   Caused by the fact that qgroup rescan only searches commit root for
   backref, while we're passing current extent root to search.
   Fix it by also passing commit extent root.

2) Double accounting tree blocks
   Caused by wrong rescan exit condition.
   Currently qgroup only exit when it can't find any leaves beyond
   rescan progress.
   However it could cause problem when new transaction happens after
   last rescan, and old leaves CoWed to new location, and double
   accounting could happen.
   Fix it by checking and leave qgroup rescan if we have hit last leaf,
   instead of leaving it to next leaf rescan.


Changelog:
v2:
  Remove unused tree_mod_seq_elem for the 1st patch.
  Fix double unlock in 2nd patch.
  Thanks Jeff for the update.

Qu Wenruo (2):
  btrfs: qgroup: Search commit root for rescan to avoid missing extent
  btrfs: qgroup: Finish rescan when hit the last leaf of extent tree

 fs/btrfs/qgroup.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

-- 
2.17.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-05-28 16:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-14  1:38 [PATCH v2 0/2] btrfs: qgroup rescan fixes part 1 Qu Wenruo
2018-05-14  1:38 ` [PATCH v2 1/2] btrfs: qgroup: Search commit root for rescan to avoid missing extent Qu Wenruo
2018-05-14  1:38 ` [PATCH v2 2/2] btrfs: qgroup: Finish rescan when hit the last leaf of extent tree Qu Wenruo
2018-05-14 13:37 ` [PATCH v2 0/2] btrfs: qgroup rescan fixes part 1 David Sterba
2018-05-23  7:29 ` [PATCH v3 1/2] btrfs: qgroup: Search commit root for rescan to avoid missing extent Qu Wenruo
2018-05-23  7:32   ` Nikolay Borisov
2018-05-28 16:22     ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).