nvme-fabrics: Allow 0 as KATO value
Currently, driver code allows user to set 0 as KATO (Keep Alive TimeOut), but this is not being respected. This patch enforces the expected behavior. Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
0951338d96
commit
8edd11c9ad
|
@ -565,6 +565,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
|
||||||
opts->queue_size = NVMF_DEF_QUEUE_SIZE;
|
opts->queue_size = NVMF_DEF_QUEUE_SIZE;
|
||||||
opts->nr_io_queues = num_online_cpus();
|
opts->nr_io_queues = num_online_cpus();
|
||||||
opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
|
opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
|
||||||
|
opts->kato = NVME_DEFAULT_KATO;
|
||||||
|
|
||||||
options = o = kstrdup(buf, GFP_KERNEL);
|
options = o = kstrdup(buf, GFP_KERNEL);
|
||||||
if (!options)
|
if (!options)
|
||||||
|
@ -655,21 +656,22 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts->discovery_nqn) {
|
|
||||||
pr_err("Discovery controllers cannot accept keep_alive_tmo != 0\n");
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token < 0) {
|
if (token < 0) {
|
||||||
pr_err("Invalid keep_alive_tmo %d\n", token);
|
pr_err("Invalid keep_alive_tmo %d\n", token);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
} else if (token == 0) {
|
} else if (token == 0 && !opts->discovery_nqn) {
|
||||||
/* Allowed for debug */
|
/* Allowed for debug */
|
||||||
pr_warn("keep_alive_tmo 0 won't execute keep alives!!!\n");
|
pr_warn("keep_alive_tmo 0 won't execute keep alives!!!\n");
|
||||||
}
|
}
|
||||||
opts->kato = token;
|
opts->kato = token;
|
||||||
|
|
||||||
|
if (opts->discovery_nqn && opts->kato) {
|
||||||
|
pr_err("Discovery controllers cannot accept KATO != 0\n");
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case NVMF_OPT_CTRL_LOSS_TMO:
|
case NVMF_OPT_CTRL_LOSS_TMO:
|
||||||
if (match_int(args, &token)) {
|
if (match_int(args, &token)) {
|
||||||
|
@ -762,8 +764,6 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
|
||||||
uuid_copy(&opts->host->id, &hostid);
|
uuid_copy(&opts->host->id, &hostid);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (!opts->discovery_nqn && !opts->kato)
|
|
||||||
opts->kato = NVME_DEFAULT_KATO;
|
|
||||||
kfree(options);
|
kfree(options);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue