nvmf: fix double free of session structure when exit the NVMf process
Change-Id: Iea34ca82898e58633c6f7edd2ab8ff04f5484220 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
49e0054f18
commit
3c96acb4f4
@ -111,13 +111,14 @@ static void
|
|||||||
spdk_nvmf_conn_do_work(void *arg)
|
spdk_nvmf_conn_do_work(void *arg)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_conn *conn = arg;
|
struct spdk_nvmf_conn *conn = arg;
|
||||||
|
struct nvmf_session *session = conn->sess;
|
||||||
|
|
||||||
/* process pending NVMe device completions */
|
/* process pending NVMe device completions */
|
||||||
if (conn->sess) {
|
if (session) {
|
||||||
if (conn->type == CONN_TYPE_AQ) {
|
if (conn->type == CONN_TYPE_AQ) {
|
||||||
nvmf_check_admin_completions(conn->sess);
|
nvmf_check_admin_completions(session);
|
||||||
} else {
|
} else {
|
||||||
nvmf_check_io_completions(conn->sess);
|
nvmf_check_io_completions(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +131,9 @@ spdk_nvmf_conn_do_work(void *arg)
|
|||||||
if (conn->state == CONN_STATE_EXITING ||
|
if (conn->state == CONN_STATE_EXITING ||
|
||||||
conn->state == CONN_STATE_FABRIC_DISCONNECT) {
|
conn->state == CONN_STATE_FABRIC_DISCONNECT) {
|
||||||
spdk_nvmf_conn_destruct(conn);
|
spdk_nvmf_conn_destruct(conn);
|
||||||
|
if (session && (session->num_connections == 0)) {
|
||||||
|
spdk_nvmf_session_destruct(session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,10 +294,6 @@ nvmf_disconnect(struct nvmf_session *session,
|
|||||||
{
|
{
|
||||||
session->num_connections--;
|
session->num_connections--;
|
||||||
TAILQ_REMOVE(&session->connections, conn, link);
|
TAILQ_REMOVE(&session->connections, conn, link);
|
||||||
|
|
||||||
if (session->num_connections == 0 || conn->type == CONN_TYPE_AQ) {
|
|
||||||
spdk_nvmf_session_destruct(session);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t
|
static uint64_t
|
||||||
|
Loading…
Reference in New Issue
Block a user