[PATCH libnvme v2 2/2] fabrics: Do not pass disable_sqflow if not supported

Daniel Wagner posted 2 patches 2 years, 1 month ago
[PATCH libnvme v2 2/2] fabrics: Do not pass disable_sqflow if not supported
Posted by Daniel Wagner 2 years, 1 month ago
From: Sagi Grimberg <sagi@grimberg.me>

Only retry a connect attempt with disable_sqflow if the kernel
actually supports this option.

Reported-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/nvme/fabrics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c
index 9725eeb3cda8..f0e85d3b766d 100644
--- a/src/nvme/fabrics.c
+++ b/src/nvme/fabrics.c
@@ -1043,7 +1043,8 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
 	if (!ret)
 		return c;
 
-	if (errno == EINVAL && c->cfg.disable_sqflow) {
+	if (errno == EINVAL && c->cfg.disable_sqflow &&
+	    nvmf_check_option(h->r, disable_sqflow)) {
 		errno = 0;
 		/* disable_sqflow is unrecognized option on older kernels */
 		nvme_msg(h->r, LOG_INFO, "failed to connect controller, "
-- 
2.41.0
Re: [PATCH libnvme v2 2/2] fabrics: Do not pass disable_sqflow if not supported
Posted by Sagi Grimberg 2 years, 1 month ago
> Only retry a connect attempt with disable_sqflow if the kernel
> actually supports this option.
> 
> Reported-by: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>   src/nvme/fabrics.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c
> index 9725eeb3cda8..f0e85d3b766d 100644
> --- a/src/nvme/fabrics.c
> +++ b/src/nvme/fabrics.c
> @@ -1043,7 +1043,8 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
>   	if (!ret)
>   		return c;
>   
> -	if (errno == EINVAL && c->cfg.disable_sqflow) {
> +	if (errno == EINVAL && c->cfg.disable_sqflow &&
> +	    nvmf_check_option(h->r, disable_sqflow)) {
>   		errno = 0;
>   		/* disable_sqflow is unrecognized option on older kernels */
>   		nvme_msg(h->r, LOG_INFO, "failed to connect controller, "

I think you want to check this before the initial call
and avoid the retry altogether.
--
-       if (e->treq & NVMF_TREQ_DISABLE_SQFLOW)
+       if (e->treq & NVMF_TREQ_DISABLE_SQFLOW &&
+           nvmf_check_option(h->r, disable_sqflow))
                 c->cfg.disable_sqflow = true;
+       else
+               c->cfg.disable_sqflow = false;

         if (e->trtype == NVMF_TRTYPE_TCP &&
             (e->treq & NVMF_TREQ_REQUIRED ||
--
Re: [PATCH libnvme v2 2/2] fabrics: Do not pass disable_sqflow if not supported
Posted by Daniel Wagner 2 years, 1 month ago
On Tue, Aug 08, 2023 at 11:47:14AM +0300, Sagi Grimberg wrote:
> I think you want to check this before the initial call
> and avoid the retry altogether.
> --
> -       if (e->treq & NVMF_TREQ_DISABLE_SQFLOW)
> +       if (e->treq & NVMF_TREQ_DISABLE_SQFLOW &&
> +           nvmf_check_option(h->r, disable_sqflow))
>                 c->cfg.disable_sqflow = true;
> +       else
> +               c->cfg.disable_sqflow = false;
> 
>         if (e->trtype == NVMF_TRTYPE_TCP &&
>             (e->treq & NVMF_TREQ_REQUIRED ||

Yep, makes sense.