Skip to content

Commit

Permalink
btrfs: qgroup: fix initialization of auto inherit array
Browse files Browse the repository at this point in the history
The "i++" was accidentally left out so it just sets qgids[0] over and
over.

This can lead to unexpected problems, as the groups[1:] would be all 0,
leading to later find_qgroup_rb() unable to find a qgroup and cause
snapshot creation failure.

Fixes: 5343cd9 ("btrfs: qgroup: simple quota auto hierarchy for nested subvolumes")
CC: stable@vger.kernel.org # 6.7+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Dan Carpenter authored and David Sterba committed May 7, 2024
1 parent bc00965 commit 0e39c9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -3123,7 +3123,7 @@ static int qgroup_auto_inherit(struct btrfs_fs_info *fs_info,
qgids = res->qgroups;

list_for_each_entry(qg_list, &inode_qg->groups, next_group)
qgids[i] = qg_list->group->qgroupid;
qgids[i++] = qg_list->group->qgroupid;

*inherit = res;
return 0;
Expand Down

0 comments on commit 0e39c9e

Please sign in to comment.