mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-08 22:49:34 +00:00
btrfs-progs: qgroup: Fix regression leads to corrupted qgroup status
Commit 93dabf211d
Author: Mark Fasheh <mfasheh@suse.de>
Date: Fri Jun 17 13:37:48 2016 -0700
btrfs-progs: check: verify qgroups above level 0
This commit introduced a new regression which corrupts
read_qgroup_status, since it iterate leaf with manually specified slot,
not correct path->slot[0].
This leads to wrong slot[0] and read_qgroup_status() will read out wrong
flags, leading to regression.
Fix read_qgroup_status() by using eb and slot instread of wrong path
strucutre.
Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
85d608f7ec
commit
7c646c538e
@ -874,15 +874,14 @@ static int add_qgroup_relation(u64 memberid, u64 parentid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void read_qgroup_status(struct btrfs_path *path,
|
||||
static void read_qgroup_status(struct extent_buffer *eb, int slot,
|
||||
struct counts_tree *counts)
|
||||
{
|
||||
struct btrfs_qgroup_status_item *status_item;
|
||||
u64 flags;
|
||||
|
||||
status_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
|
||||
struct btrfs_qgroup_status_item);
|
||||
flags = btrfs_qgroup_status_flags(path->nodes[0], status_item);
|
||||
status_item = btrfs_item_ptr(eb, slot, struct btrfs_qgroup_status_item);
|
||||
flags = btrfs_qgroup_status_flags(eb, status_item);
|
||||
/*
|
||||
* Since qgroup_inconsist/rescan_running is just one bit,
|
||||
* assign value directly won't work.
|
||||
@ -946,7 +945,7 @@ loop:
|
||||
}
|
||||
|
||||
if (key.type == BTRFS_QGROUP_STATUS_KEY) {
|
||||
read_qgroup_status(&path, &counts);
|
||||
read_qgroup_status(leaf, i, &counts);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user