Skip to content

Commit b5357cb

Browse files
adam900710kdave
authored andcommitted
btrfs: qgroup: do not check qgroup inherit if qgroup is disabled
[BUG] After kernel commit 86211ee ("btrfs: qgroup: validate btrfs_qgroup_inherit parameter"), user space tool snapper will fail to create snapshot using its timeline feature. [CAUSE] It turns out that, if using timeline snapper would unconditionally pass btrfs_qgroup_inherit parameter (assigning the new snapshot to qgroup 1/0) for snapshot creation. In that case, since qgroup is disabled there would be no qgroup 1/0, and btrfs_qgroup_check_inherit() would return -ENOENT and fail the whole snapshot creation. [FIX] Just skip the check if qgroup is not enabled. This is to keep the older behavior for user space tools, as if the kernel behavior changed for user space, it is a regression of kernel. Thankfully snapper is also fixing the behavior by detecting if qgroup is running in the first place, so the effect should not be that huge. Link: openSUSE/snapper#894 Fixes: 86211ee ("btrfs: qgroup: validate btrfs_qgroup_inherit parameter") CC: [email protected] # 6.8+ Reviewed-by: Filipe Manana <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 63a6ce5 commit b5357cb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/btrfs/qgroup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,6 +3045,8 @@ int btrfs_qgroup_check_inherit(struct btrfs_fs_info *fs_info,
30453045
struct btrfs_qgroup_inherit *inherit,
30463046
size_t size)
30473047
{
3048+
if (!btrfs_qgroup_enabled(fs_info))
3049+
return 0;
30483050
if (inherit->flags & ~BTRFS_QGROUP_INHERIT_FLAGS_SUPP)
30493051
return -EOPNOTSUPP;
30503052
if (size < sizeof(*inherit) || size > PAGE_SIZE)

0 commit comments

Comments
 (0)