diff mbox series

fstests: btrfs: detect regular qgroup for older kernels correctly

Message ID 20240220040134.81084-1-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series fstests: btrfs: detect regular qgroup for older kernels correctly | expand

Commit Message

Qu Wenruo Feb. 20, 2024, 4:01 a.m. UTC
[BUG]
When running an older (vendoer v6.4) kernel, some qgroup test cases
would be skipped:

  btrfs/017 1s ... [not run] not running normal qgroups

[CAUSE]
With the introduce of simple quota mode, there is a new sysfs interface,
/sys/fs/btrfs/<uuid>/qgroups/mode to indicate the currently running
qgroup modes.

And _qgroup_mode() from `common/btrfs` is using that new interface to
detect the mode.

Unfortuantely for older kernels without simple quota support,
_qgroup_mode() would return "disabled" directly, causing those test case
to be skipped.

[FIX]
Fallback to regular qgroup if that sysfs interface is not accessible, as
qgroup is introduced from the very beginning of btrfs, thus the regular
qgroup is always supported.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 common/btrfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Filipe Manana Feb. 20, 2024, 11:11 a.m. UTC | #1
On Tue, Feb 20, 2024 at 4:01 AM Qu Wenruo <wqu@suse.com> wrote:
>
> [BUG]
> When running an older (vendoer v6.4) kernel, some qgroup test cases
> would be skipped:
>
>   btrfs/017 1s ... [not run] not running normal qgroups
>
> [CAUSE]
> With the introduce of simple quota mode, there is a new sysfs interface,
> /sys/fs/btrfs/<uuid>/qgroups/mode to indicate the currently running
> qgroup modes.
>
> And _qgroup_mode() from `common/btrfs` is using that new interface to
> detect the mode.
>
> Unfortuantely for older kernels without simple quota support,
> _qgroup_mode() would return "disabled" directly, causing those test case
> to be skipped.
>
> [FIX]
> Fallback to regular qgroup if that sysfs interface is not accessible, as
> qgroup is introduced from the very beginning of btrfs, thus the regular
> qgroup is always supported.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Looks good, thanks.

> ---
>  common/btrfs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/btrfs b/common/btrfs
> index e1b29c61..0a3f0f0b 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -728,7 +728,7 @@ _qgroup_mode()
>         if _has_fs_sysfs_attr $dev /qgroups/mode; then
>                 _get_fs_sysfs_attr $dev qgroups/mode
>         else
> -               echo "disabled"
> +               echo "qgroup"
>         fi
>  }
>
> --
> 2.42.0
>
>
Anand Jain Feb. 26, 2024, 6:36 a.m. UTC | #2
On 2/20/24 09:31, Qu Wenruo wrote:
> [BUG]
> When running an older (vendoer v6.4) kernel, some qgroup test cases
> would be skipped:
> 
>    btrfs/017 1s ... [not run] not running normal qgroups
> 
> [CAUSE]
> With the introduce of simple quota mode, there is a new sysfs interface,
> /sys/fs/btrfs/<uuid>/qgroups/mode to indicate the currently running
> qgroup modes.
> 
> And _qgroup_mode() from `common/btrfs` is using that new interface to
> detect the mode.
> 
> Unfortuantely for older kernels without simple quota support,
> _qgroup_mode() would return "disabled" directly, causing those test case
> to be skipped.
> 
> [FIX]
> Fallback to regular qgroup if that sysfs interface is not accessible, as
> qgroup is introduced from the very beginning of btrfs, thus the regular
> qgroup is always supported.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>


Reviewed-by: Anand Jain <anand.jain@oracle.com>

Sorry for missing this patch. Now, applied and staged for the next PR.

Thanks.

> ---
>   common/btrfs | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/btrfs b/common/btrfs
> index e1b29c61..0a3f0f0b 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -728,7 +728,7 @@ _qgroup_mode()
>   	if _has_fs_sysfs_attr $dev /qgroups/mode; then
>   		_get_fs_sysfs_attr $dev qgroups/mode
>   	else
> -		echo "disabled"
> +		echo "qgroup"
>   	fi
>   }
>
diff mbox series

Patch

diff --git a/common/btrfs b/common/btrfs
index e1b29c61..0a3f0f0b 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -728,7 +728,7 @@  _qgroup_mode()
 	if _has_fs_sysfs_attr $dev /qgroups/mode; then
 		_get_fs_sysfs_attr $dev qgroups/mode
 	else
-		echo "disabled"
+		echo "qgroup"
 	fi
 }