Skip to content

Commit b40503e

Browse files
Kxuanaxboe
authored andcommitted
bcache: fix unmatched generic_end_io_acct() & generic_start_io_acct()
The function cached_dev_make_request() and flash_dev_make_request() call generic_start_io_acct() with (struct bcache_device)->disk when they start a closure. Then the function bio_complete() calls generic_end_io_acct() with (struct search)->orig_bio->bi_disk when the closure has done. Since the `bi_disk` is not the bcache device, the generic_end_io_acct() is called with a wrong device queue. It causes the "inflight" (in struct hd_struct) counter keep increasing without decreasing. This patch fix the problem by calling generic_end_io_acct() with (struct bcache_device)->disk. Signed-off-by: Zhai Zhaoxuan <[email protected]> Reviewed-by: Michael Lyle <[email protected]> Reviewed-by: Coly Li <[email protected]> Reviewed-by: Tang Junhui <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent ce439bf commit b40503e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/bcache/request.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,8 @@ static void request_endio(struct bio *bio)
633633
static void bio_complete(struct search *s)
634634
{
635635
if (s->orig_bio) {
636-
struct request_queue *q = s->orig_bio->bi_disk->queue;
637-
generic_end_io_acct(q, bio_data_dir(s->orig_bio),
636+
generic_end_io_acct(s->d->disk->queue,
637+
bio_data_dir(s->orig_bio),
638638
&s->d->disk->part0, s->start_time);
639639

640640
trace_bcache_request_end(s->d, s->orig_bio);

0 commit comments

Comments
 (0)