mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
btrfs: qgroup: do not treat "ret > 0" as error when deleting a qgroup
[BUG]
There is a bug report that when removing a child qgroup, if removing the
qgroup requires a rescan, it will delete the on-disk relation and qgroup
items but not the in-memory qgroup rb entry.
This makes all later qgroup rescan to fail.
[CAUSE]
The call chain looks like the following:
btrfs_remove_qgroup()
|- __del_qgroup_relation()
| |- quick_update_accounting()
| Which returns 1, showing this operation will require
| a qgroup rescan
|- if (ret) goto out;
Which skips the del_qgroup_rb() call, leaving the in-memory qgroup
rb entry still intact.
Then later qgroup rescan/update will always fail and mark qgroup
inconsistent:
btrfs_run_qgroups()
|- update_qgroup_info_item()
| |- btrfs_search_slot()
| Which returns -ENOENT, as the qgroup info item is already
| deleted.
|- qgroup_mark_inconsistent()
|- return -ENOENT;
[FIX]
Do not treat "ret > 0" as an error.
Reported-by: c.f.a@posteo.de
Link: https://lore.kernel.org/linux-btrfs/14846642-85d3-4afb-ad99-1b74b22f5f90@posteo.de/
Fixes: 9c8b35b1ba ("btrfs: quota: Automatically update related qgroups or mark INCONSISTENT flags when assigning/deleting a qgroup relations.")
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
95e3b8dc32
commit
dd906477cc
|
|
@ -1853,7 +1853,7 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
|
|||
struct btrfs_qgroup_list, next_group);
|
||||
ret = __del_qgroup_relation(trans, qgroupid,
|
||||
list->group->qgroupid);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user