[Devel] [PATCH hci-8.2] dm-qcow2: associate worker kthread with request blkcg on submit

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Tue Dec 1 17:04:45 MSK 2026


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dm-qcow2: merge aux_qio lacks QIO_HAS_PARENT_FL, losing blkcg
  association
--

commit 0c8c7773401f0f94f9a8fd9cadaabfa9340d3b77
Author: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>

dm-qcow2: associate worker kthread with request blkcg on submit

dm-qcow2 submits image file I/O from tgt->wq worker kthreads, which belong
to the root cgroup. This patch marks child qios that point to a parent qio
with a new QIO_HAS_PARENT_FL flag. qio_blkcg_css() then walks up to the
embedded root qio and calls kthread_associate_blkcg() around
qcow2_call_rw_iter().

> diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
> --- a/drivers/md/dm-qcow2-map.c
> +++ b/drivers/md/dm-qcow2-map.c
[ ... ]
> +static struct cgroup_subsys_state *qio_blkcg_css(struct qio *qio)
> +{
> +	struct cgroup_subsys_state *css;
> +	struct qcow2_rq *qrq;
> +
> +	while (qio->flags & QIO_HAS_PARENT_FL)
> +		qio = qio->endio_cb_data;
> +
> +	if (qio->endio_cb != qrq_endio)
> +		return NULL;

[Severity: Low]
Does this walk miss the aux_qio created in prepare_backward_merge()? That
function sets endio_cb_data to the parent qio but does not set
QIO_HAS_PARENT_FL:

	aux_qio->flags = QIO_IS_MERGE_FL|QIO_FREE_ON_ENDIO_FL;
	...
	aux_qio->endio_cb = requeue_if_ok;
	aux_qio->endio_cb_data = *qio;

When a read hits a cluster under backward merge, a child qio (for example
the compressed or COW read with merge=true) walks up to aux_qio and stops.
Since requeue_if_ok != qrq_endio, qio_blkcg_css() returns NULL. That I/O is
then submitted from the root-cgroup worker, so the submitter's block cgroup
limits are bypassed on this path.

Should QIO_HAS_PARENT_FL be added to the flags assignment in
prepare_backward_merge() so the walk continues to the original qio?

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261201135205.163133-1-andrey.zhadchenko@virtuozzo.com?part=1



More information about the Devel mailing list