nvmf: fix discovery log change notice execution

it shall be executed on ctrlr's thread not subsystem's

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I58c60525191085d3d6a583862ba5d71ea90940c7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11105
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jacek Kalwas 2022-01-14 13:01:12 -05:00 committed by Jim Harris
parent 8ddb1790c9
commit 93364164e5
4 changed files with 9 additions and 10 deletions

View File

@ -3522,28 +3522,29 @@ nvmf_ctrlr_async_event_reservation_notification(struct spdk_nvmf_ctrlr *ctrlr)
nvmf_ctrlr_async_event_notification(ctrlr, &event);
}
int
nvmf_ctrlr_async_event_discovery_log_change_notice(struct spdk_nvmf_ctrlr *ctrlr)
void
nvmf_ctrlr_async_event_discovery_log_change_notice(void *ctx)
{
union spdk_nvme_async_event_completion event = {0};
struct spdk_nvmf_ctrlr *ctrlr = ctx;
/* Users may disable the event notification manually or
* it may not be enabled due to keep alive timeout
* not being set in connect command to discovery controller.
*/
if (!ctrlr->feat.async_event_configuration.bits.discovery_log_change_notice) {
return 0;
return;
}
if (!nvmf_ctrlr_mask_aen(ctrlr, SPDK_NVME_ASYNC_EVENT_DISCOVERY_LOG_CHANGE_MASK_BIT)) {
return 0;
return;
}
event.bits.async_event_type = SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE;
event.bits.async_event_info = SPDK_NVME_ASYNC_EVENT_DISCOVERY_LOG_CHANGE;
event.bits.log_page_identifier = SPDK_NVME_LOG_DISCOVERY;
return nvmf_ctrlr_async_event_notification(ctrlr, &event);
nvmf_ctrlr_async_event_notification(ctrlr, &event);
}
int

View File

@ -61,7 +61,7 @@ nvmf_update_discovery_log(struct spdk_nvmf_tgt *tgt, const char *hostnqn)
/** There is a change in discovery log for hosts with given hostnqn */
TAILQ_FOREACH(ctrlr, &discovery_subsystem->ctrlrs, link) {
if (hostnqn == NULL || strcmp(hostnqn, ctrlr->hostnqn) == 0) {
nvmf_ctrlr_async_event_discovery_log_change_notice(ctrlr);
spdk_thread_send_msg(ctrlr->thread, nvmf_ctrlr_async_event_discovery_log_change_notice, ctrlr);
}
}
}

View File

@ -457,7 +457,7 @@ int nvmf_subsystem_set_cntlid_range(struct spdk_nvmf_subsystem *subsystem,
int nvmf_ctrlr_async_event_ns_notice(struct spdk_nvmf_ctrlr *ctrlr);
int nvmf_ctrlr_async_event_ana_change_notice(struct spdk_nvmf_ctrlr *ctrlr);
int nvmf_ctrlr_async_event_discovery_log_change_notice(struct spdk_nvmf_ctrlr *ctrlr);
void nvmf_ctrlr_async_event_discovery_log_change_notice(void *ctx);
void nvmf_ctrlr_async_event_reservation_notification(struct spdk_nvmf_ctrlr *ctrlr);
int nvmf_ctrlr_async_event_error_event(struct spdk_nvmf_ctrlr *ctrlr,
union spdk_nvme_async_event_completion event);

View File

@ -65,9 +65,7 @@ DEFINE_STUB(spdk_nvmf_transport_get_next,
DEFINE_STUB_V(spdk_bdev_close, (struct spdk_bdev_desc *desc));
DEFINE_STUB(nvmf_ctrlr_async_event_discovery_log_change_notice,
int,
(struct spdk_nvmf_ctrlr *ctrlr), 0);
DEFINE_STUB_V(nvmf_ctrlr_async_event_discovery_log_change_notice, (void *ctx));
DEFINE_STUB(spdk_nvmf_qpair_disconnect, int,
(struct spdk_nvmf_qpair *qpair,