public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Yufen Yu <yuyufen@huawei.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: <josef@toxicpanda.com>, <axboe@kernel.dk>,
	<linux-block@vger.kernel.org>, <nbd@other.debian.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] nbd: make starting request more reasonable
Date: Mon, 23 Mar 2020 22:08:51 +0800	[thread overview]
Message-ID: <b990c260-ddf6-efa9-0856-9110aa4dd8a4@huawei.com> (raw)
In-Reply-To: <20200316153033.GA11016@ming.t460p>

Hi, Ming

On 2020/3/16 23:30, Ming Lei wrote:
> On Mon, Mar 16, 2020 at 08:26:35PM +0800, Yufen Yu wrote:
>> Ping and Cc to more expert in blk-mq.
>>
>> On 2020/3/3 21:08, Yufen Yu wrote:
>>> Our test robot reported a warning for refcount_dec trying to decrease
>>> value '0'. The reason is that blk_mq_dispatch_rq_list() try to complete
>>> the failed request from nbd driver, while the request have finished in
>>> nbd timeout handle function. The race as following:
>>>
>>> CPU1                             CPU2
>>>
>>> //req->ref = 1
>>> blk_mq_dispatch_rq_list
>>> nbd_queue_rq
>>>     nbd_handle_cmd
>>>       blk_mq_start_request
>>>                                    blk_mq_check_expired
>>>                                      //req->ref = 2
>>>                                      blk_mq_rq_timed_out
>>>                                        nbd_xmit_timeout
> 
> This shouldn't happen in reality, given rq->deadline is just updated
> in blk_mq_start_request(), suppose you use the default 30 sec timeout.
> How can the race be triggered in so short time? >
> Could you explain a bit your test case?
>
In fact, this is reported by syzkaller. We have not actually test case.
But, I think nbd driver should not start request in case of failure. So fix it.

Thanks,
Yufen

      parent reply	other threads:[~2020-03-23 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 13:08 [PATCH] nbd: make starting request more reasonable Yufen Yu
2020-03-03 21:18 ` Josef Bacik
2020-03-04  2:10   ` Yufen Yu
2020-03-16 12:26 ` Yufen Yu
2020-03-16 15:30   ` Ming Lei
2020-03-16 16:02     ` Keith Busch
2020-03-17  2:41       ` Ming Lei
2020-03-23 14:08     ` Yufen Yu [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=b990c260-ddf6-efa9-0856-9110aa4dd8a4@huawei.com \
    --to=yuyufen@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=nbd@other.debian.org \
    /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