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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iaebf18265dfe839f7361b09539527a1806aed1c4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463551
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Shuhei Matsumoto 2019-07-30 07:58:07 +09:00 committed by Changpeng Liu
parent 39e850d17b
commit 8cf1945432

View File

@ -603,14 +603,15 @@ iscsi_conn_close_luns(struct spdk_iscsi_conn *conn)
} }
static void 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_iscsi_conn *conn = remove_ctx;
struct spdk_scsi_lun *lun = arg2;
int lun_id = spdk_scsi_lun_get_id(lun); int lun_id = spdk_scsi_lun_get_id(lun);
struct spdk_iscsi_pdu *pdu, *tmp_pdu; struct spdk_iscsi_pdu *pdu, *tmp_pdu;
struct spdk_iscsi_task *iscsi_task, *tmp_iscsi_task; 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 a connection is already in stating status, just return */
if (conn->state >= ISCSI_CONN_STATE_EXITING) { if (conn->state >= ISCSI_CONN_STATE_EXITING) {
return; return;
@ -648,17 +649,6 @@ _iscsi_conn_remove_lun(void *arg1, void *arg2)
iscsi_conn_close_lun(conn, lun_id); 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 static void
iscsi_conn_open_luns(struct spdk_iscsi_conn *conn) iscsi_conn_open_luns(struct spdk_iscsi_conn *conn)
{ {