nvmf: Move the check of NVMe remove from session layer to subsystem layer.
Change-Id: Icf2f7122c9af0cd6420384c93813d2e79ed9c69e Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
parent
95487138e3
commit
bee8c04a4b
@ -638,13 +638,6 @@ spdk_nvmf_session_poll(struct spdk_nvmf_session *session)
|
||||
SPDK_ERRLOG("Transport poll failed for conn %p; closing connection\n", conn);
|
||||
spdk_nvmf_session_disconnect(conn);
|
||||
}
|
||||
if (subsys->subtype == SPDK_NVMF_SUBTYPE_NVME) {
|
||||
if (subsys->is_removed && conn->transport->conn_is_idle(conn)) {
|
||||
if (subsys->ops->detach) {
|
||||
subsys->ops->detach(subsys);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -128,6 +128,25 @@ spdk_nvmf_subsystem_start(struct spdk_nvmf_subsystem *subsystem)
|
||||
return subsystem->ops->attach(subsystem);
|
||||
}
|
||||
|
||||
static bool
|
||||
nvmf_subsystem_removable(struct spdk_nvmf_subsystem *subsystem)
|
||||
{
|
||||
struct spdk_nvmf_session *session;
|
||||
struct spdk_nvmf_conn *conn;
|
||||
|
||||
if (subsystem->is_removed) {
|
||||
TAILQ_FOREACH(session, &subsystem->sessions, link) {
|
||||
TAILQ_FOREACH(conn, &session->connections, link) {
|
||||
if (!conn->transport->conn_is_idle(conn)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
spdk_nvmf_subsystem_poll(struct spdk_nvmf_subsystem *subsystem)
|
||||
{
|
||||
@ -142,6 +161,12 @@ spdk_nvmf_subsystem_poll(struct spdk_nvmf_subsystem *subsystem)
|
||||
/* For each connection in the session, check for completions */
|
||||
spdk_nvmf_session_poll(session);
|
||||
}
|
||||
|
||||
if (nvmf_subsystem_removable(subsystem)) {
|
||||
if (subsystem->ops->detach) {
|
||||
subsystem->ops->detach(subsystem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
|
Loading…
Reference in New Issue
Block a user