Skip to content

Commit

Permalink
btrfs: qgroup: Fix dead judgement on qgroup_rescan_leaf() return value.
Browse files Browse the repository at this point in the history
Old qgroup_rescan_leaf() comment indicates ret == 2 as complete and
cleared INCONSISTENT flag.

This is not true since it will never return 2, and inside it no codes
will clear INCONSISTENT flag.
The flag clearance is done in btrfs_qgroup_rescan_work().
This caused the bug that INCONSISTENT flag is never cleared.

So change the comment and fix the dead judgment.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
  • Loading branch information
Qu Wenruo authored and Chris Mason committed Apr 13, 2015
1 parent e09fe2d commit 3393168
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -2560,7 +2560,7 @@ void assert_qgroups_uptodate(struct btrfs_trans_handle *trans)

/*
* returns < 0 on error, 0 when more leafs are to be scanned.
* returns 1 when done, 2 when done and FLAG_INCONSISTENT was cleared.
* returns 1 when done.
*/
static int
qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
Expand Down Expand Up @@ -2707,7 +2707,7 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)
mutex_lock(&fs_info->qgroup_rescan_lock);
fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_RESCAN;

if (err == 2 &&
if (err > 0 &&
fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT) {
fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
} else if (err < 0) {
Expand All @@ -2717,7 +2717,7 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)

if (err >= 0) {
btrfs_info(fs_info, "qgroup scan completed%s",
err == 2 ? " (inconsistency flag cleared)" : "");
err > 0 ? " (inconsistency flag cleared)" : "");
} else {
btrfs_err(fs_info, "qgroup scan failed with %d", err);
}
Expand Down

0 comments on commit 3393168

Please sign in to comment.