From: Sagi Grimberg <sagi@grimberg.me>
To: James Smart <james.smart@broadcom.com>,
linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH v2 7/8] nvme-rdma: fix timeout handler
Date: Tue, 18 Aug 2020 17:38:32 -0700 [thread overview]
Message-ID: <49496213-73da-d642-d146-c8e8f5bf6916@grimberg.me> (raw)
In-Reply-To: <37c1a34b-9956-b9b6-8e06-f44c99470a73@broadcom.com>
>> +static void nvme_rdma_complete_timed_out(struct request *rq)
>> +{
>> + struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
>> + struct nvme_rdma_queue *queue = req->queue;
>> + struct nvme_rdma_ctrl *ctrl = queue->ctrl;
>> +
>> + /* fence other contexts that may complete the command */
>> + mutex_lock(&ctrl->teardown_lock);
>> + nvme_rdma_stop_queue(queue);
>> + if (blk_mq_request_completed(rq))
>> + goto out;
>> + nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
>> + blk_mq_complete_request(rq);
>> +out:
>> + mutex_unlock(&ctrl->teardown_lock);
>> +}
>> +
>
> I believe there should be some comment explaining why it's ok to leave
> the rdma queue stopped.
> I think it's ok as:
> resetting: the controller will be reset, so the queue will be deleted
> connecting: init io failures will teardown partially initialized
> controller, so the queue will be deleted
I can add this comment.
>
>> static enum blk_eh_timer_return
>> nvme_rdma_timeout(struct request *rq, bool reserved)
>> {
>> @@ -1961,29 +1979,43 @@ nvme_rdma_timeout(struct request *rq, bool
>> reserved)
>> dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n",
>> rq->tag, nvme_rdma_queue_idx(queue));
>> - /*
>> - * Restart the timer if a controller reset is already scheduled. Any
>> - * timed out commands would be handled before entering the
>> connecting
>> - * state.
>> - */
>> - if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
>> + switch (ctrl->ctrl.state) {
>> + case NVME_CTRL_RESETTING:
>> + if (!nvme_rdma_queue_idx(queue)) {
>> + /*
>> + * if we are in teardown we must complete immediately
>> + * because we may block the teardown sequence (e.g.
>> + * nvme_disable_ctrl timed out).
>> + */
>> + nvme_rdma_complete_timed_out(rq);
>> + return BLK_EH_DONE;
>> + }
>> + /*
>> + * Restart the timer if a controller reset is already scheduled.
>> + * Any timed out commands would be handled before entering the
>> + * connecting state.
>> + */
>> return BLK_EH_RESET_TIMER;
>
> If you're in RESETTING, why do you need to qualify ios only on the admin
> queue. Can't all ios, regardless of queue, just be complete_timed_out()
> ? Isn't this just a race between the io timeout and the resetting
> routine reaching the io ?
You are correct, given that we are serialized against the reset/error
recovery we can just do the same for both. The request is going to
be cancelled anyways.
>
>
>> -
>> - if (ctrl->ctrl.state != NVME_CTRL_LIVE) {
>> + case NVME_CTRL_CONNECTING:
>> + if (reserved || !nvme_rdma_queue_idx(queue)) {
>> + /*
>> + * if we are connecting we must complete immediately
>> + * connect (reserved) or admin requests because we may
>> + * block controller setup sequence.
>> + */
>> + nvme_rdma_complete_timed_out(rq);
>> + return BLK_EH_DONE;
>> + }
>
> This is reasonable. But I'm wondering why this too isn't just
> completing any io that timed out. For the non-controller create/init
> ios - they'll either bounce back to the multipather or will requeue.
> With the requeue, there's an opportunity for Viktor Gladko'vs "reject
> I/O to offline device" to bounce it if it's been waiting a while.
You are right, I can do that to any state that is not LIVE.
Thanks for the review!
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-08-19 0:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-06 19:11 [PATCH v2 0/8] fix possible controller reset hangs in nvme-tcp/nvme-rdma Sagi Grimberg
2020-08-06 19:11 ` [PATCH v2 1/8] nvme-fabrics: allow to queue requests for live queues Sagi Grimberg
2020-08-14 6:44 ` Christoph Hellwig
2020-08-14 7:08 ` Sagi Grimberg
2020-08-14 7:22 ` Christoph Hellwig
2020-08-14 15:55 ` James Smart
2020-08-14 17:49 ` Sagi Grimberg
2020-08-06 19:11 ` [PATCH v2 2/8] nvme: have nvme_wait_freeze_timeout return if it timed out Sagi Grimberg
2020-08-14 6:45 ` Christoph Hellwig
2020-08-14 7:09 ` Sagi Grimberg
2020-08-06 19:11 ` [PATCH v2 3/8] nvme-tcp: serialize controller teardown double completion Sagi Grimberg
2020-08-06 19:11 ` [PATCH v2 4/8] nvme-tcp: fix timeout handler Sagi Grimberg
2020-08-06 19:11 ` [PATCH v2 5/8] nvme-tcp: fix reset hang if controller died in the middle of a reset Sagi Grimberg
2020-08-06 19:11 ` [PATCH v2 6/8] nvme-rdma: serialize controller teardown sequences Sagi Grimberg
2020-08-14 6:45 ` Christoph Hellwig
2020-08-14 21:12 ` James Smart
2020-08-19 0:35 ` Sagi Grimberg
2020-08-06 19:11 ` [PATCH v2 7/8] nvme-rdma: fix timeout handler Sagi Grimberg
2020-08-14 6:52 ` Christoph Hellwig
2020-08-14 7:14 ` Sagi Grimberg
2020-08-14 23:19 ` James Smart
2020-08-19 0:26 ` Sagi Grimberg
2020-08-14 23:27 ` James Smart
2020-08-14 23:30 ` James Smart
2020-08-19 0:39 ` Sagi Grimberg
2020-08-19 0:38 ` Sagi Grimberg [this message]
2020-08-06 19:11 ` [PATCH v2 8/8] nvme-rdma: fix reset hang if controller died in the middle of a reset Sagi Grimberg
2020-08-14 6:53 ` Christoph Hellwig
2020-08-11 22:16 ` [PATCH v2 0/8] fix possible controller reset hangs in nvme-tcp/nvme-rdma Sagi Grimberg
2020-08-13 15:39 ` Christoph Hellwig
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=49496213-73da-d642-d146-c8e8f5bf6916@grimberg.me \
--to=sagi@grimberg.me \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).