public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Zhai Zhaoxuan <kxuanobj@gmail.com>,
	linux-bcache@vger.kernel.org, linux-block@vger.kernel.org
Cc: tang.junhui@zte.com.cn, Michael Lyle <mlyle@lyle.org>
Subject: Re: [PATCH] bcache: fix unmatched generic_end_io_acct() & generic_start_io_acct()
Date: Wed, 3 Jan 2018 13:45:58 +0800	[thread overview]
Message-ID: <58e10ebe-0a40-c866-94d7-50cd7a6872ea@suse.de> (raw)
In-Reply-To: <20180103043937.28235-1-kxuanobj@gmail.com>

On 03/01/2018 12:39 PM, Zhai Zhaoxuan wrote:
> 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 <kxuanobj@gmail.com>

Hi Zhaoxuan,

Nice catch, it makes sense. Thanks.

Reviewed-by: Coly Li <colyli@suse.de>

One more question, do you experience any problem when inflight counter
increases only ? I just wondering.

Coly

> ---
>  drivers/md/bcache/request.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 643c3021624f..83de85fe4542 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -611,8 +611,8 @@ static void request_endio(struct bio *bio)
>  static void bio_complete(struct search *s)
>  {
>  	if (s->orig_bio) {
> -		struct request_queue *q = s->orig_bio->bi_disk->queue;
> -		generic_end_io_acct(q, bio_data_dir(s->orig_bio),
> +		generic_end_io_acct(s->d->disk->queue,
> +				    bio_data_dir(s->orig_bio),
>  				    &s->d->disk->part0, s->start_time);
>  
>  		trace_bcache_request_end(s->d, s->orig_bio);
> 

  reply	other threads:[~2018-01-03  5:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03  4:39 [PATCH] bcache: fix unmatched generic_end_io_acct() & generic_start_io_acct() Zhai Zhaoxuan
2018-01-03  5:45 ` Coly Li [this message]
2018-01-03  7:05   ` Zhaoxuan
2018-01-03  7:21     ` Coly Li
2018-01-03 16:57 ` Michael Lyle
  -- strict thread matches above, loose matches on Subject: below --
2018-01-02 16:43 [PATCH] bcache: fix unmatched generic_end_io_acct() &generic_start_io_acct() tang.junhui

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=58e10ebe-0a40-c866-94d7-50cd7a6872ea@suse.de \
    --to=colyli@suse.de \
    --cc=kxuanobj@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=mlyle@lyle.org \
    --cc=tang.junhui@zte.com.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