From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> commit 0e39c9e524479b85c1b83134df0cfc6e3cb5353a upstream. 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: 5343cd9364ea ("btrfs: qgroup: simple quota auto hierarchy for nested subvolumes") CC: stable@xxxxxxxxxxxxxxx # 6.7+ Reviewed-by: Qu Wenruo <wqu@xxxxxxxx> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/qgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -3129,7 +3129,7 @@ static int qgroup_auto_inherit(struct bt 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; Patches currently in stable-queue which might be from dan.carpenter@xxxxxxxxxx are queue-6.9/btrfs-qgroup-fix-initialization-of-auto-inherit-array.patch