Skip to content

Commit ac1584a

Browse files
dwsuseigaw
authored andcommitted
fabrics: Filter discovery ctrls out during application context check
We also need to filter out the well known discovery controllers when using the execution context filtering. Obviously, we can't use the subsystem name, thus match on the host and target address instead. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 1c573cd commit ac1584a

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

src/nvme/fabrics.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,15 +860,33 @@ int nvmf_add_ctrl(nvme_host_t h, nvme_ctrl_t c,
860860
}
861861

862862
root_app = nvme_root_get_application(h->r);
863-
app = nvme_subsystem_get_application(s);
864863
if (root_app) {
864+
app = nvme_subsystem_get_application(s);
865+
if (!app && nvme_ctrl_is_discovery_ctrl(c)) {
866+
nvme_subsystem_t s;
867+
nvme_ctrl_t fc;
868+
869+
nvme_for_each_subsystem(h, s) {
870+
fc = __nvme_lookup_ctrl(s, nvme_ctrl_get_transport(c),
871+
nvme_ctrl_get_traddr(c),
872+
nvme_ctrl_get_host_traddr(c),
873+
nvme_ctrl_get_host_iface(c),
874+
nvme_ctrl_get_trsvcid(c),
875+
NULL);
876+
877+
if (fc) {
878+
app = nvme_subsystem_get_application(s);
879+
break;
880+
}
881+
}
882+
}
865883
/*
866884
* configuration is managed by an application,
867885
* refuse to act on subsystems which either have
868886
* no application set or which habe a different
869887
* application string.
870888
*/
871-
if (!app || strcmp(app, root_app)) {
889+
if (app && strcmp(app, root_app)) {
872890
nvme_msg(h->r, LOG_INFO, "skip %s, not managed by %s\n",
873891
nvme_subsystem_get_nqn(s), root_app);
874892
errno = ENVME_CONNECT_IGNORED;

0 commit comments

Comments
 (0)