nvmf: fix name comparisons for nvmf_tgt objs
The previous version of this function precluded one target name from being a leading substring of another. i.e. if "nvmf_tgt_1" was already used as a name "nvmf_tgt_11" could not be used subsequently. Just an odd quirk that shouldn't be the case. Change-Id: Iea59b6757512f01070e48074e35a11d942e399bb Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468522 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
parent
208e089a21
commit
3ed64fa9c2
@ -229,7 +229,7 @@ spdk_nvmf_tgt_create(struct spdk_nvmf_target_opts *opts)
|
||||
}
|
||||
|
||||
TAILQ_FOREACH(tmp_tgt, &g_nvmf_tgts, link) {
|
||||
if (!strncmp(opts->name, tmp_tgt->name, strlen(tmp_tgt->name))) {
|
||||
if (!strncmp(opts->name, tmp_tgt->name, NVMF_TGT_NAME_MAX_LENGTH)) {
|
||||
SPDK_ERRLOG("Provided target name must be unique.\n");
|
||||
return NULL;
|
||||
}
|
||||
@ -328,7 +328,7 @@ spdk_nvmf_get_tgt(const char *name)
|
||||
|
||||
TAILQ_FOREACH(tgt, &g_nvmf_tgts, link) {
|
||||
if (name) {
|
||||
if (!strncmp(tgt->name, name, strlen(tgt->name))) {
|
||||
if (!strncmp(tgt->name, name, NVMF_TGT_NAME_MAX_LENGTH)) {
|
||||
return tgt;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user