[LTP] [PATCH 08/19] API/cgroup: refuse to mount blkio when io controller is mounted

Petr Vorel pvorel@suse.cz
Tue May 3 17:10:31 CEST 2022


Hi Luke,

> Mounting the v1 blkio controller while v2 io controller is mounted
> unmounts the io controller, triggering a tst_brk that the number of
> controller has gone down.

> Because these controllers don't seem to be compatible, tst_brk with
> TCONF and report that we refused to mount the blkio controller while the
> io controller is mounted.

> Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
> ---
>  lib/tst_cgroup.c | 5 +++++
>  1 file changed, 5 insertions(+)

> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
> index 254f4aaca..6794046e2 100644
> --- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -717,6 +717,11 @@ static void cgroup_mount_v1(struct cgroup_ctrl *const ctrl)
>  	char mnt_path[PATH_MAX];
>  	int made_dir = 0;

> +	if (ctrl->ctrl_indx == CTRL_BLKIO && controllers[CTRL_IO].ctrl_root) {
> +		tst_brk(TCONF,
> +			"IO controller found on V2 root, skipping blkio mount that would unmount IO controller");
Good catch! I'm just not sure if it wouldn't be better to use tst_res(TCONF,
..); return;
Because with tst_brk we're not skipping the test but quiting, right?
That's not true for tst_cgctl.c used in shell API (your changes),
but it'd be for tests which use C API.

Kind regards,
Petr

> +	}
> +
>  	sprintf(mnt_path, "%s%s", cgroup_mount_ltp_prefix, ctrl->ctrl_name);

>  	if (!mkdir(mnt_path, 0777)) {


More information about the ltp mailing list