mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] bcache: fix I/O accounting leak
@ 2026-01-27  8:21 zhangshida2026
  2026-01-27  8:21 ` [PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request zhangshida2026
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: zhangshida2026 @ 2026-01-27  8:21 UTC (permalink / raw)
  To: colyli, kent.overstreet, hch, axboe
  Cc: linux-bcache, linux-kernel, zhangshida, starzhangzsd

From: Shida Zhang <zhangshida@kylinos.cn>

This series addresses an I/O accounting leak where detached bcache
devices could report 100% utilization in iostat after completion
of discard requests.

Changes since v2:
- Omitting the dead NULL check for bio_alloc_clone() (suggested by hch).
- Updated the Fixes tag for the accounting leak.

Shida Zhang (2):
  bcache: remove dead code in detached_dev_do_request
  bcache: fix I/O accounting leak in detached_dev_do_request

 drivers/md/bcache/request.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request
  2026-01-27  8:21 [PATCH v3 0/2] bcache: fix I/O accounting leak zhangshida2026
@ 2026-01-27  8:21 ` zhangshida2026
  2026-01-27  8:28   ` Christoph Hellwig
  2026-01-27  8:21 ` [PATCH v3 2/2] bcache: fix I/O accounting leak " zhangshida2026
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: zhangshida2026 @ 2026-01-27  8:21 UTC (permalink / raw)
  To: colyli, kent.overstreet, hch, axboe
  Cc: linux-bcache, linux-kernel, zhangshida, starzhangzsd

From: Shida Zhang <zhangshida@kylinos.cn>

bio_alloc_clone() with GFP_NOIO and a mempool will not return NULL.
Remove the unnecessary NULL check.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
---
 drivers/md/bcache/request.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index a02aecac05c..c2f38907a2a 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1113,11 +1113,6 @@ static void detached_dev_do_request(struct bcache_device *d,
 
 	clone_bio = bio_alloc_clone(dc->bdev, orig_bio, GFP_NOIO,
 				    &d->bio_detached);
-	if (!clone_bio) {
-		orig_bio->bi_status = BLK_STS_RESOURCE;
-		bio_endio(orig_bio);
-		return;
-	}
 
 	ddip = container_of(clone_bio, struct detached_dev_io_private, bio);
 	/* Count on the bcache device */
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 2/2] bcache: fix I/O accounting leak in detached_dev_do_request
  2026-01-27  8:21 [PATCH v3 0/2] bcache: fix I/O accounting leak zhangshida2026
  2026-01-27  8:21 ` [PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request zhangshida2026
@ 2026-01-27  8:21 ` zhangshida2026
  2026-01-27  8:29   ` Christoph Hellwig
  2026-01-29  1:54 ` Re:[PATCH v3 0/2] bcache: fix I/O accounting leak zhangshida2026
  2026-01-29  2:07 ` [PATCH " Jens Axboe
  3 siblings, 1 reply; 7+ messages in thread
From: zhangshida2026 @ 2026-01-27  8:21 UTC (permalink / raw)
  To: colyli, kent.overstreet, hch, axboe
  Cc: linux-bcache, linux-kernel, zhangshida, starzhangzsd

From: Shida Zhang <zhangshida@kylinos.cn>

When a bcache device is detached, discard requests are completed
immediately. However, the I/O accounting started in
cached_dev_make_request() is not ended, leading to 100% disk
utilization reports in iostat. Add the missing bio_end_io_acct() call.

Fixes: cafe56359144 ("bcache: A block layer cache")
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
Acked-by: Coly Li <colyli@fnnas.com>
---
 drivers/md/bcache/request.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index c2f38907a2a..3fa3b13a410 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1107,6 +1107,7 @@ static void detached_dev_do_request(struct bcache_device *d,
 
 	if (bio_op(orig_bio) == REQ_OP_DISCARD &&
 	    !bdev_max_discard_sectors(dc->bdev)) {
+		bio_end_io_acct(orig_bio, start_time);
 		bio_endio(orig_bio);
 		return;
 	}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request
  2026-01-27  8:21 ` [PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request zhangshida2026
@ 2026-01-27  8:28   ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2026-01-27  8:28 UTC (permalink / raw)
  To: zhangshida2026
  Cc: colyli, kent.overstreet, hch, axboe, linux-bcache, linux-kernel,
	zhangshida, starzhangzsd

On Tue, Jan 27, 2026 at 04:21:11PM +0800, zhangshida2026@163.com wrote:
> From: Shida Zhang <zhangshida@kylinos.cn>
> 
> bio_alloc_clone() with GFP_NOIO and a mempool will not return NULL.
> Remove the unnecessary NULL check.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] bcache: fix I/O accounting leak in detached_dev_do_request
  2026-01-27  8:21 ` [PATCH v3 2/2] bcache: fix I/O accounting leak " zhangshida2026
@ 2026-01-27  8:29   ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2026-01-27  8:29 UTC (permalink / raw)
  To: zhangshida2026
  Cc: colyli, kent.overstreet, hch, axboe, linux-bcache, linux-kernel,
	zhangshida, starzhangzsd

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re:[PATCH v3 0/2] bcache: fix I/O accounting leak
  2026-01-27  8:21 [PATCH v3 0/2] bcache: fix I/O accounting leak zhangshida2026
  2026-01-27  8:21 ` [PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request zhangshida2026
  2026-01-27  8:21 ` [PATCH v3 2/2] bcache: fix I/O accounting leak " zhangshida2026
@ 2026-01-29  1:54 ` zhangshida2026
  2026-01-29  2:07 ` [PATCH " Jens Axboe
  3 siblings, 0 replies; 7+ messages in thread
From: zhangshida2026 @ 2026-01-29  1:54 UTC (permalink / raw)
  To: colyli, kent.overstreet, hch, axboe
  Cc: linux-bcache, linux-kernel, zhangshida, starzhangzsd


















At 2026-01-27 16:21:10, zhangshida2026@163.com wrote:
>From: Shida Zhang <zhangshida@kylinos.cn>
>
>This series addresses an I/O accounting leak where detached bcache
>devices could report 100% utilization in iostat after completion
>of discard requests.
>
>Changes since v2:
>- Omitting the dead NULL check for bio_alloc_clone() (suggested by hch).
>- Updated the Fixes tag for the accounting leak.
>
>Shida Zhang (2):
>  bcache: remove dead code in detached_dev_do_request
>  bcache: fix I/O accounting leak in detached_dev_do_request
>
> drivers/md/bcache/request.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)

>


Hi Jens,

The patches have been reviewed by Christoph and acked by Coly. 
Given that we are now at rc7, I wanted to see if you would consider picking 
these up for the 6.19 cycle?

Thank you for your time and for all your work.

Best regards,
Shida Zhang

>-- 
>2.34.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/2] bcache: fix I/O accounting leak
  2026-01-27  8:21 [PATCH v3 0/2] bcache: fix I/O accounting leak zhangshida2026
                   ` (2 preceding siblings ...)
  2026-01-29  1:54 ` Re:[PATCH v3 0/2] bcache: fix I/O accounting leak zhangshida2026
@ 2026-01-29  2:07 ` Jens Axboe
  3 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2026-01-29  2:07 UTC (permalink / raw)
  To: colyli, kent.overstreet, hch, zhangshida2026
  Cc: linux-bcache, linux-kernel, zhangshida, starzhangzsd


On Tue, 27 Jan 2026 16:21:10 +0800, zhangshida2026@163.com wrote:
> This series addresses an I/O accounting leak where detached bcache
> devices could report 100% utilization in iostat after completion
> of discard requests.
> 
> Changes since v2:
> - Omitting the dead NULL check for bio_alloc_clone() (suggested by hch).
> - Updated the Fixes tag for the accounting leak.
> 
> [...]

Applied, thanks!

[1/2] bcache: remove dead code in detached_dev_do_request
      commit: 6ea84d7a92cb0b30aaf7d2066a69e28e27932332
[2/2] bcache: fix I/O accounting leak in detached_dev_do_request
      commit: 4da7c5c3ec34d839bba6e035c3d05c447a2f9d4f

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-29  2:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-27  8:21 [PATCH v3 0/2] bcache: fix I/O accounting leak zhangshida2026
2026-01-27  8:21 ` [PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request zhangshida2026
2026-01-27  8:28   ` Christoph Hellwig
2026-01-27  8:21 ` [PATCH v3 2/2] bcache: fix I/O accounting leak " zhangshida2026
2026-01-27  8:29   ` Christoph Hellwig
2026-01-29  1:54 ` Re:[PATCH v3 0/2] bcache: fix I/O accounting leak zhangshida2026
2026-01-29  2:07 ` [PATCH " Jens Axboe

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®