linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 0/2] btrfs: qgroup rescan fixes part 1
Date: Mon, 14 May 2018 09:38:11 +0800	[thread overview]
Message-ID: <20180514013813.30763-1-wqu@suse.com> (raw)

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


             reply	other threads:[~2018-05-14  1:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14  1:38 Qu Wenruo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180514013813.30763-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).