[PATCH v5] nvme-fabrics: reject I/O to offline device

Sagi Grimberg sagi at grimberg.me
Tue Jun 30 20:18:15 EDT 2020


> @@ -612,6 +613,8 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
>   	{ NVMF_OPT_NR_WRITE_QUEUES,	"nr_write_queues=%d"	},
>   	{ NVMF_OPT_NR_POLL_QUEUES,	"nr_poll_queues=%d"	},
>   	{ NVMF_OPT_TOS,			"tos=%d"		},
> +	{ NVMF_OPT_FAIL_FAST_TMO,	"fast_io_fail_tmo=%d"	},
> +	{ NVMF_OPT_FAIL_FAST_TMO,	"fast_io_fail_tmo=%s"	},
>   	{ NVMF_OPT_ERR,			NULL			}
>   };
> 
> @@ -631,6 +634,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
>   	opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
>   	opts->kato = NVME_DEFAULT_KATO;
>   	opts->duplicate_connect = false;
> +	opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO;
>   	opts->hdr_digest = false;
>   	opts->data_digest = false;
>   	opts->tos = -1; /* < 0 == use transport default */
> @@ -751,6 +755,28 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
>   				pr_warn("ctrl_loss_tmo < 0 will reconnect forever\n");
>   			ctrl_loss_tmo = token;
>   			break;
> +		case NVMF_OPT_FAIL_FAST_TMO:
> +			if (match_int(args, &token)) {
> +				p = match_strdup(args);
> +				if (!p) {
> +					ret = -EINVAL;
> +					goto out;
> +				}
> +
> +				token = strcasecmp(p, "off") ? 0 : -1;
> +				kfree(p);
> +
> +				if (!token) {
> +					ret = -EINVAL;
> +					goto out;
> +				}

Rethinking about this when reading the code, let's drop the "off" string
option, nvme-cli is probably the better place for free text processing...

I think that overall this looks reasonable. But I'd like to hear others
on this. Keith, Christoph, Chaitanya, James, Hannes, please review
this approach.



More information about the Linux-nvme mailing list