From: Himanshu Madhani <himanshu.madhani@oracle.com>
To: James Smart <james.smart@broadcom.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH 4/4] nvme_fc: track error_recovery while connecting
Date: Mon, 19 Oct 2020 09:54:33 -0500 [thread overview]
Message-ID: <8332227D-4103-42D6-B40F-772EE1C2871C@oracle.com> (raw)
In-Reply-To: <20201016212729.49138-5-james.smart@broadcom.com>
> On Oct 16, 2020, at 4:27 PM, James Smart <james.smart@broadcom.com> wrote:
>
> Whenever there are errors during CONNECTING, the driver recovers by
> aborting all outstanding ios and counts on the io completion to fail them
> and thus the connection/association they are on. However, the connection
> failure depends on a failure state from the core routines. Not all
> commands that are issued by the core routine are guaranteed to cause a
> failure of the core routine. They may be treated as a failure status and
> the status is then ignored.
>
> As such, whenever the transport enters error_recovery while CONNECTING,
> it will set a new flag indicating an association failed. The
> create_association routine which creates and initializes the controller,
> will monitor the state of the flag as well as the core routine error
> status and ensure the association fails if there was an error.
>
> Signed-off-by: James Smart <james.smart@broadcom.com>
> ---
> drivers/nvme/host/fc.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index b2f9b3752df7..6352068c0c4a 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -142,7 +142,8 @@ struct nvme_fc_rport {
>
> /* fc_ctrl flags values - specified as bit positions */
> #define ASSOC_ACTIVE 0
> -#define FCCTRL_TERMIO 1
> +#define ASSOC_FAILED 1
> +#define FCCTRL_TERMIO 2
>
> struct nvme_fc_ctrl {
> spinlock_t lock;
> @@ -2498,6 +2499,7 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
> */
> if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
> __nvme_fc_abort_outstanding_ios(ctrl, true);
> + set_bit(ASSOC_FAILED, &ctrl->flags);
> return;
> }
>
> @@ -3030,6 +3032,8 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
> ctrl->cnum, ctrl->lport->localport.port_name,
> ctrl->rport->remoteport.port_name, ctrl->ctrl.opts->subsysnqn);
>
> + clear_bit(ASSOC_FAILED, &ctrl->flags);
> +
> /*
> * Create the admin queue
> */
> @@ -3058,7 +3062,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
> */
>
> ret = nvme_enable_ctrl(&ctrl->ctrl);
> - if (ret)
> + if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
> goto out_disconnect_admin_queue;
>
> ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments;
> @@ -3068,7 +3072,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
> blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
>
> ret = nvme_init_identify(&ctrl->ctrl);
> - if (ret)
> + if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
> goto out_disconnect_admin_queue;
>
> /* sanity checks */
> @@ -3113,9 +3117,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
> ret = nvme_fc_create_io_queues(ctrl);
> else
> ret = nvme_fc_recreate_io_queues(ctrl);
> - if (ret)
> - goto out_term_aen_ops;
> }
> + if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
> + goto out_term_aen_ops;
>
> changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
>
> --
> 2.26.2
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
Looks fine.
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
--
Himanshu Madhani Oracle Linux Engineering
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
prev parent reply other threads:[~2020-10-19 14:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-16 21:27 [PATCH 0/4] nvme-fc: clean up error recovery implementation James Smart
2020-10-16 21:27 ` [PATCH 1/4] nvme-fc: remove err_work work item James Smart
2020-10-19 14:43 ` Himanshu Madhani
2020-10-16 21:27 ` [PATCH 2/4] nvme-fc: eliminate terminate_io use by nvme_fc_error_recovery James Smart
2020-10-19 14:49 ` Himanshu Madhani
2020-10-16 21:27 ` [PATCH 3/4] nvme-fc: remove nvme_fc_terminate_io() James Smart
2020-10-19 14:51 ` Himanshu Madhani
2020-10-16 21:27 ` [PATCH 4/4] nvme_fc: track error_recovery while connecting James Smart
2020-10-19 14:54 ` Himanshu Madhani [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=8332227D-4103-42D6-B40F-772EE1C2871C@oracle.com \
--to=himanshu.madhani@oracle.com \
--cc=james.smart@broadcom.com \
--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).