Commit 8cf19454 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Changpeng Liu
Browse files

iscsi: Hot remove callback closes LUN directly without using event call



This patch is in the patch series to migrate iSCSI connection management
from core based to SPDK thread based.

The callback to hot removal of LUN, iscsi_conn_remove_lun, is called
on the same core when the corresponding LUN is opened. Additionally,
all operations in iscsi_conn_remove_lun are completed synchronously.

Hence inline _iscsi_conn_remove_lun into iscsi_conn_remove_lun.
Add assert to check the function is called on the specified core.

This change is helpful to achieve the goal of the patch series
because spdk_event can have two parameters but spdk_msg can have
only a single variable, and hence we cannot convert simply and have
to introduce a context allocated dynamically otherwise.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iaebf18265dfe839f7361b09539527a1806aed1c4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463551


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarBroadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
parent 39e850d1
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -603,14 +603,15 @@ iscsi_conn_close_luns(struct spdk_iscsi_conn *conn)
}

static void
_iscsi_conn_remove_lun(void *arg1, void *arg2)
iscsi_conn_remove_lun(struct spdk_scsi_lun *lun, void *remove_ctx)
{
	struct spdk_iscsi_conn *conn = arg1;
	struct spdk_scsi_lun *lun = arg2;
	struct spdk_iscsi_conn *conn = remove_ctx;
	int lun_id = spdk_scsi_lun_get_id(lun);
	struct spdk_iscsi_pdu *pdu, *tmp_pdu;
	struct spdk_iscsi_task *iscsi_task, *tmp_iscsi_task;

	assert(conn->lcore == spdk_env_get_current_core());

	/* If a connection is already in stating status, just return */
	if (conn->state >= ISCSI_CONN_STATE_EXITING) {
		return;
@@ -648,17 +649,6 @@ _iscsi_conn_remove_lun(void *arg1, void *arg2)
	iscsi_conn_close_lun(conn, lun_id);
}

static void
iscsi_conn_remove_lun(struct spdk_scsi_lun *lun, void *remove_ctx)
{
	struct spdk_iscsi_conn *conn = remove_ctx;
	struct spdk_event *event;

	event = spdk_event_allocate(conn->lcore, _iscsi_conn_remove_lun,
				    conn, lun);
	spdk_event_call(event);
}

static void
iscsi_conn_open_luns(struct spdk_iscsi_conn *conn)
{