From: colyli@fnnas.com
To: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org
Cc: Coly Li <colyli@fnnas.com>, Shida Zhang <zhangshida@kylinos.cn>,
Christoph Hellwig <hch@infradead.org>,
Jia-Ju Bai <baijiaju1990@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH] bcache: call bio_endio() to replace directly calling bio->bi_end_io()
Date: Sun, 30 Nov 2025 23:08:54 +0800 [thread overview]
Message-ID: <20251130150855.1681-1-colyli@fnnas.com> (raw)
From: Coly Li <colyli@fnnas.com>
When a bcache device is not attached to a cache device, current code
calls the request's bi_end_io() callback directly. The correct method is
to call bio_endio(bio) instead of bio->bi_end_io(bio).
This patch fixes the incorrect calling.
Fixes: bc082a55d25c ("bcache: fix inaccurate io state for detached bcache devices")
Fixes: 40f567bbb3b0 ("md: bcache: check the return value of kzalloc() in detached_dev_do_request()")
Reported-by: Shida Zhang <zhangshida@kylinos.cn>
Closes: https://lore.kernel.org/linux-block/20251121081748.1443507-1-zhangshida@kylinos.cn/
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: stable@vger.kernel.org #4.17+
Signed-off-by: Coly Li <colyli@fnnas.com>
---
drivers/md/bcache/request.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index af345dc6fde1..7b815064db54 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1104,7 +1104,7 @@ static void detached_dev_end_io(struct bio *bio)
}
kfree(ddip);
- bio->bi_end_io(bio);
+ bio_endio(bio);
}
static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
@@ -1121,7 +1121,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
if (!ddip) {
bio->bi_status = BLK_STS_RESOURCE;
- bio->bi_end_io(bio);
+ bio_endio(bio);
return;
}
@@ -1136,7 +1136,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
if ((bio_op(bio) == REQ_OP_DISCARD) &&
!bdev_max_discard_sectors(dc->bdev))
- bio->bi_end_io(bio);
+ bio_endio(bio);
else
submit_bio_noacct(bio);
}
--
2.47.3
next reply other threads:[~2025-11-30 15:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-30 15:08 colyli [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-12-01 2:49 [PATCH] bcache: call bio_endio() to replace directly calling bio->bi_end_io() Stephen Zhang
2025-12-01 5:42 ` Coly Li
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=20251130150855.1681-1-colyli@fnnas.com \
--to=colyli@fnnas.com \
--cc=baijiaju1990@gmail.com \
--cc=hch@infradead.org \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=zhangshida@kylinos.cn \
/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