From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org
Cc: Bart Van Assche <bart.vanassche@wdc.com>,
Tejun Heo <tj@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
Israel Rukshin <israelr@mellanox.com>,
Max Gurtovoy <maxg@mellanox.com>,
stable@vger.kernel.org
Subject: Re: [PATCH V2] blk-mq: fix race between complete and BLK_EH_RESET_TIMER
Date: Thu, 12 Apr 2018 10:38:56 +0800 [thread overview]
Message-ID: <f63c9def-4fef-5032-814c-5dc142d5be5a@oracle.com> (raw)
In-Reply-To: <20180411233812.18003-1-ming.lei@redhat.com>
Hi Ming
On 04/12/2018 07:38 AM, Ming Lei wrote:
> + *
> + * Cover complete vs BLK_EH_RESET_TIMER race in slow path with
> + * helding queue lock.
> */
> hctx_lock(hctx, &srcu_idx);
> if (blk_mq_rq_aborted_gstate(rq) != rq->gstate)
> __blk_mq_complete_request(rq);
> + else {
> + unsigned long flags;
> + bool need_complete = false;
> +
> + spin_lock_irqsave(q->queue_lock, flags);
> + if (!blk_mq_rq_aborted_gstate(rq))
> + need_complete = true;
> + else
> + blk_mq_rq_update_state(rq, MQ_RQ_COMPLETE_IN_TIMEOUT);
> + spin_unlock_irqrestore(q->queue_lock, flags);
What if the .timeout return BLK_EH_HANDLED during this ?
timeout context irq context
.timeout()
blk_mq_complete_request
set state to MQ_RQ_COMPLETE_IN_TIMEOUT
__blk_mq_complete_request
WARN_ON_ONCE(blk_mq_rq_state(rq)
!= MQ_RQ_IN_FLIGHT);
If further upon blk_mq_free_request, the final freed request maybe changed to MQ_RQ_COMPLETE_IN_TIMEOUT
instead of MQ_RQ_IDLE.
Thanks
Jianchao
next prev parent reply other threads:[~2018-04-12 2:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-11 23:38 [PATCH V2] blk-mq: fix race between complete and BLK_EH_RESET_TIMER Ming Lei
2018-04-12 2:38 ` jianchao.wang [this message]
2018-04-12 7:03 ` Ming Lei
2018-04-12 9:49 ` Ming Lei
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=f63c9def-4fef-5032-814c-5dc142d5be5a@oracle.com \
--to=jianchao.w.wang@oracle.com \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--cc=hch@lst.de \
--cc=israelr@mellanox.com \
--cc=linux-block@vger.kernel.org \
--cc=maxg@mellanox.com \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
--cc=stable@vger.kernel.org \
--cc=tj@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