mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: <agk@redhat.com>, <snitzer@kernel.org>, <bmarzins@redhat.com>,
	<dm-devel@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<yangerkun@huawei.com>, <lilingfeng3@huawei.com>
Subject: Re: [PATCH] dm: pass origin bio's bdev to bio_alloc_clone
Date: Sat, 24 Jan 2026 15:23:28 +0800	[thread overview]
Message-ID: <2ae755f4-43ea-1e8d-48f8-dffb38ee9773@huawei.com> (raw)
In-Reply-To: <b3731751-c286-f61e-95ab-c59f9aba98d0@redhat.com>

在 2026/1/24 0:16, Mikulas Patocka 写道:
> 
> 
> On Fri, 23 Jan 2026, Zhihao Cheng wrote:
> 
>> 在 2026/1/16 20:07, Zhihao Cheng 写道:
>>
>> friendly ping
> 
> Hi
> 
> I find it quite hacky to set bi_bdev and overwrite it later. I came up
> with this patch that clones the control group association explictely, it
> fixes your testcase. Please test it and report if it works for you.
> 
> Mikulas
> 

Thanks for the patch, it works.

Tested-by: Zhihao Cheng <chengzhihao1@huawei.com>

> 
> dm: use bio_clone_blkg_association
> 
> The origin bio carries blk-cgroup information which could be set from
> foreground(task_css(css) - wbc->wb->blkcg_css), so the blkcg won't
> control buffer io since commit ca522482e3eaf ("dm: pass NULL bdev to
> bio_alloc_clone"). The synchronous io is still under control by blkcg,
> because 'bio->bi_blkg' is set by io submitting task which has been added
> into 'cgroup.procs'.
> 
> Fix it by using bio_clone_blkg_association when submitting a cloned bio.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=220985
> Fixes: ca522482e3eaf ("dm: pass NULL bdev to bio_alloc_clone")
> Reported-by: Zhihao Cheng <chengzhihao1@huawei.com>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> ---
>   drivers/md/dm.c |    2 ++
>   1 file changed, 2 insertions(+)
> 
> Index: linux-2.6/drivers/md/dm.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/dm.c	2026-01-06 15:55:41.000000000 +0100
> +++ linux-2.6/drivers/md/dm.c	2026-01-23 17:07:50.000000000 +0100
> @@ -1364,6 +1364,8 @@ void dm_submit_bio_remap(struct bio *clo
>   	if (!tgt_clone)
>   		tgt_clone = clone;
>   
> +	bio_clone_blkg_association(tgt_clone, io->orig_bio);
> +
>   	/*
>   	 * Account io->origin_bio to DM dev on behalf of target
>   	 * that took ownership of IO with DM_MAPIO_SUBMITTED.
> 


      reply	other threads:[~2026-01-24  7:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16 12:07 Zhihao Cheng
2026-01-23  1:12 ` Zhihao Cheng
2026-01-23 16:16   ` Mikulas Patocka
2026-01-24  7:23     ` Zhihao Cheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ae755f4-43ea-1e8d-48f8-dffb38ee9773@huawei.com \
    --to=chengzhihao1@huawei.com \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=lilingfeng3@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=yangerkun@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®