nvmf: don't start the association timer poller for vfio-user

When users remove kernel NVMe driver in the VM, after 120 seconds,
SPDK NVMf target will disconnect ADMIN queue pair due to association
timer timeout, and for vfio-user transport, the ADMIN queue pair
connection is associated with the socket connection, so when probing
the NVMe controller again, because there is no active ADMIN connection
for fabric register R/W commands, it will cause segment fault.

Here we set the association timeout value to 0 for vfio-user transport,
so that the ADMIN connection will not be disconnected when shutdown the
controller, the ADMIN queue pair will be disconnected when the socket
connection breaks.

Change-Id: I3613169229bae384405889653e50f581d30d7c07
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8557
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2021-06-29 23:29:13 +08:00 committed by Jim Harris
parent d5102d37b3
commit 4fa3d99131
2 changed files with 9 additions and 4 deletions

View File

@ -920,8 +920,10 @@ nvmf_ctrlr_cc_shn_done(struct spdk_io_channel_iter *i, int status)
SPDK_DEBUGLOG(nvmf, "Association timer already set\n");
nvmf_ctrlr_stop_association_timer(ctrlr);
}
ctrlr->association_timer = SPDK_POLLER_REGISTER(nvmf_ctrlr_association_remove, ctrlr,
ctrlr->association_timeout * 1000);
if (ctrlr->association_timeout) {
ctrlr->association_timer = SPDK_POLLER_REGISTER(nvmf_ctrlr_association_remove, ctrlr,
ctrlr->association_timeout * 1000);
}
ctrlr->disconnect_in_progress = false;
}
@ -945,8 +947,10 @@ nvmf_ctrlr_cc_reset_done(struct spdk_io_channel_iter *i, int status)
SPDK_DEBUGLOG(nvmf, "Association timer already set\n");
nvmf_ctrlr_stop_association_timer(ctrlr);
}
ctrlr->association_timer = SPDK_POLLER_REGISTER(nvmf_ctrlr_association_remove, ctrlr,
ctrlr->association_timeout * 1000);
if (ctrlr->association_timeout) {
ctrlr->association_timer = SPDK_POLLER_REGISTER(nvmf_ctrlr_association_remove, ctrlr,
ctrlr->association_timeout * 1000);
}
ctrlr->disconnect_in_progress = false;
}

View File

@ -2491,6 +2491,7 @@ nvmf_vfio_user_opts_init(struct spdk_nvmf_transport_opts *opts)
opts->max_aq_depth = NVMF_VFIO_USER_DEFAULT_AQ_DEPTH;
opts->num_shared_buffers = 0;
opts->buf_cache_size = 0;
opts->association_timeout = 0;
opts->transport_specific = NULL;
}