nvme-fc: shorten reconnect delay if possible for FC
Subsystems (2)
PATCH 1/1 nvme-fc: shorten reconnect delay if possible for FC
We've had several complaints about a 10s reconnect delay (the default) when there was an error while there is connectivity to a subsystem. The max_reconnects and reconnect_delay are set in common code prior to calling the transport to create the controller.
This change checks if the default reconnect delay is being used, and if so, it adjusts it to a shorter period (2s) for the nvme-fc transport. It does so by calculating the controller loss tmo window, changing the value of the reconnect delay, and then recalculating the maximum number of reconnect attempts allowed.
--- drivers/nvme/host/fc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/nvme/host/fc.c +18 -1
@@ -26,6 +26,10 @@ enum nvme_fc_queue_flags { };#define NVME_FC_DEFAULT_DEV_LOSS_TMO 60/* seconds */ +#define NVME_FC_DEFAULT_RECONNECT_TMO 2/* delay between reconnects +* when connected and a +* connection failure. +*/ struct nvme_fc_queue {struct nvme_fc_ctrl *ctrl;
@@ -3387,7 +3391,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, {struct nvme_fc_ctrl *ctrl;unsigned long flags; -int ret, idx; +int ret, idx, ctrl_loss_tmo;if (!(rport->remoteport.port_role & (FC_PORT_ROLE_NVME_DISCOVERY |FC_PORT_ROLE_NVME_TARGET ))) {
@@ -3413,6 +3417,19 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, goto out_free_ctrl; } +/* +* if ctrl_loss_tmo is being enforced and the default reconnect delay +* is being used, change to a shorter reconnect delay for FC. +*/ +if (opts->max_reconnects !=-1 && + opts->reconnect_delay ==NVMF_DEF_RECONNECT_DELAY && + opts->reconnect_delay >NVME_FC_DEFAULT_RECONNECT_TMO ) { + ctrl_loss_tmo = opts->max_reconnects * opts->reconnect_delay; + opts->reconnect_delay =NVME_FC_DEFAULT_RECONNECT_TMO ; + opts->max_reconnects =DIV_ROUND_UP (ctrl_loss_tmo, + opts->reconnect_delay); + } + ctrl->ctrl.opts = opts; ctrl->ctrl.nr_reconnects =0 ;if (lport->dev)
Signature · 1 line
2.26.2
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 11 lines · James Smart
We've had several complaints about a 10s reconnect delay (the default) when there was an error while there is connectivity to a subsystem. The
max_reconnectsandreconnect_delayare set in common code prior to calling the transport to create the controller.This change checks if the default reconnect delay is being used, and if so, it adjusts it to a shorter period (2s) for the nvme-fc transport. It does so by calculating the controller loss tmo window, changing the value of the reconnect delay, and then recalculating the maximum number of reconnect attempts allowed.
Quoted 5 lines
Signed-off-by James Smart <[email protected]>--- drivers/nvme/host/fc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
Cheers,
Hannes
Signature · 9 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 71 lines · James Smart
We've had several complaints about a 10s reconnect delay (the default) when there was an error while there is connectivity to a subsystem. The
max_reconnectsandreconnect_delayare set in common code prior to calling the transport to create the controller.This change checks if the default reconnect delay is being used, and if so, it adjusts it to a shorter period (2s) for the nvme-fc transport. It does so by calculating the controller loss tmo window, changing the value of the reconnect delay, and then recalculating the maximum number of reconnect attempts allowed.
Signed-off-by James Smart <[email protected]>---
drivers/nvme/host/fc.c| 19 ++++++++++++++++++-1 file changed, 18 insertions(+), 1 deletion(-)drivers/nvme/host/fc.c +18
-1@@ -26,6 +26,10 @@ enum nvme_fc_queue_flags { };#define NVME_FC_DEFAULT_DEV_LOSS_TMO 60/* seconds */ +#define NVME_FC_DEFAULT_RECONNECT_TMO 2/* delay between reconnects +* when connected and a +* connection failure. +*/ struct nvme_fc_queue {struct nvme_fc_ctrl *ctrl;@@ -3387,7 +3391,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, {struct nvme_fc_ctrl *ctrl;unsigned long flags; -int ret, idx; +int ret, idx, ctrl_loss_tmo;if (!(rport->remoteport.port_role & (FC_PORT_ROLE_NVME_DISCOVERY |FC_PORT_ROLE_NVME_TARGET ))) {@@ -3413,6 +3417,19 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, goto out_free_ctrl; } +/* +* if ctrl_loss_tmo is being enforced and the default reconnect delay +* is being used, change to a shorter reconnect delay for FC. +*/ +if (opts->max_reconnects !=-1 && + opts->reconnect_delay ==NVMF_DEF_RECONNECT_DELAY && + opts->reconnect_delay >NVME_FC_DEFAULT_RECONNECT_TMO ) { + ctrl_loss_tmo = opts->max_reconnects * opts->reconnect_delay; + opts->reconnect_delay =NVME_FC_DEFAULT_RECONNECT_TMO ; + opts->max_reconnects =DIV_ROUND_UP (ctrl_loss_tmo, + opts->reconnect_delay); + } + ctrl->ctrl.opts = opts; ctrl->ctrl.nr_reconnects =0 ;if (lport->dev)Signature · 6 lines
2.26.2 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Looks good.
--
Himanshu Madhani Oracle Linux Engineering
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Christoph Hellwig
AppliedThanks,
applied.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme