From: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
Dylan Yudaken <dylany@fb.com>
Subject: Re: [PATCH] block: pop cached rq before potentially blocking rq_qos_throttle()
Date: Thu, 23 Jun 2022 08:56:00 +0000 [thread overview]
Message-ID: <20220623085559.csg72pmamhwgkcbx@shindev> (raw)
In-Reply-To: <65187802-413a-7425-234e-68cf0b281a91@kernel.dk>
On Jun 21, 2022 / 10:07, Jens Axboe wrote:
> If rq_qos_throttle() ends up blocking, then we will have invalidated and
> flushed our current plug. Since blk_mq_get_cached_request() hasn't
> popped the cached request off the plug list just yet, we end holding a
> pointer to a request that is no longer valid. This insta-crashes with
> rq->mq_hctx being NULL in the validity checks just after.
>
> Pop the request off the cached list before doing rq_qos_throttle() to
> avoid using a potentially stale request.
>
> Fixes: 0a5aa8d161d1 ("block: fix blk_mq_attempt_bio_merge and rq_qos_throttle protection")
> Reported-by: Dylan Yudaken <dylany@fb.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Thank you for the fix and sorry for the trouble. The patch passed my test set:
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
BTW, may I know the workload or script which triggers the failure? I'm
interested in if we can add a blktests test case to exercises qos throttle
and prevent similar bugs in the future.
--
Shin'ichiro Kawasaki
next prev parent reply other threads:[~2022-06-23 8:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 16:07 [PATCH] block: pop cached rq before potentially blocking rq_qos_throttle() Jens Axboe
2022-06-21 16:58 ` Dylan Yudaken
2022-06-23 8:56 ` Shinichiro Kawasaki [this message]
2022-06-23 12:05 ` Jens Axboe
2022-06-23 12:33 ` Shinichiro Kawasaki
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=20220623085559.csg72pmamhwgkcbx@shindev \
--to=shinichiro.kawasaki@wdc.com \
--cc=axboe@kernel.dk \
--cc=dylany@fb.com \
--cc=linux-block@vger.kernel.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