public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Lei Lei2 Yin <yinlei2@lenovo.com>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"axboe@fb.com" <axboe@fb.com>, "hch@lst.de" <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>
Cc: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"cybeyond@foxmail.com" <cybeyond@foxmail.com>
Subject: Re: [PATCH v2] nvme: fix double blk_mq_complete_request for timeout request with low probability
Date: Sat, 8 Apr 2023 08:04:01 +0000	[thread overview]
Message-ID: <a5cfe4e4-62b8-5cea-c4bc-06d905ffccf1@nvidia.com> (raw)
In-Reply-To: <PS1PR03MB49397BF066FA9BC5BC5EE72488979@PS1PR03MB4939.apcprd03.prod.outlook.com>

On 4/8/23 00:44, Lei Lei2 Yin wrote:
>  From 5148d52554d6bcf6134786d40f1c6f9f22e18978 Mon Sep 17 00:00:00 2001
> From: Lei Yin <yinlei2@lenovo.com>
> Date: Thu, 6 Apr 2023 23:39:11 +0800
> Subject: [PATCH v2] nvme: fix double blk_mq_complete_request for timeout
>   request with low probability
>
> When nvme_cancel_tagset traverses all tagsets and executes
> nvme_cancel_request, this request may be executing blk_mq_free_request
> that is called by nvme_rdma_complete_timed_out/nvme_tcp_complete_timed_out.
> When blk_mq_free_request executes to WRITE_ONCE(rq->state, MQ_RQ_IDLE) and
> __blk_mq_free_request(rq), it will cause double blk_mq_complete_request for
> this request, and it will cause a null pointer error in the second
> execution of this function because rq->mq_hctx has set to NULL in first
> execution.
>
> With multipath, by injecting a large number of requests timed out, I have
> reproduced the issue that caused kernel crashes in three versions of the
> kernel(include 5.10.167, 6.2.10 and upstream version which compiled by
> myself). The error stack is as follows:
>
> [ 2777.253091]  <TASK>
> [ 2777.253102]  nvme_failover_req+0x10a/0x120 [nvme_core]
> [ 2777.255302]  blk_complete_reqs+0x3e/0x60
> [ 2777.255726]  __do_softirq+0xb6/0x2ad
> [ 2777.256139]  ? __pfx_smpboot_thread_fn+0x10/0x10
> [ 2777.256556]  run_ksoftirqd+0x28/0x40
> [ 2777.256978]  smpboot_thread_fn+0xdb/0x1d0
> [ 2777.257399]  kthread+0xd7/0x100
> [ 2777.257827]  ? __pfx_kthread+0x10/0x10
> [ 2777.258253]  ret_from_fork+0x29/0x50
> [ 2777.258695]  </TASK>
>
> Signed-off-by: Lei Yin <yinlei2@lenovo.com>
> ---
>

Can you please add blktests for this fix under nvme category ?

Looks good, it also addresses Sagi's comment about

nvmf_complete_timed_out_request().

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



  reply	other threads:[~2023-04-08  8:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08  7:44 [PATCH v2] nvme: fix double blk_mq_complete_request for timeout request with low probability Lei Lei2 Yin
2023-04-08  8:04 ` Chaitanya Kulkarni [this message]
2023-04-08  8:14   ` Chaitanya Kulkarni

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=a5cfe4e4-62b8-5cea-c4bc-06d905ffccf1@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=axboe@fb.com \
    --cc=cybeyond@foxmail.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=yinlei2@lenovo.com \
    /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