iscsi: Restore the previous bug fix for LUN hot plug

One recent commit destroyed the critical bug fix for LUN hot plug.
Hence this patch restores the critical bug fix. Simple revert is
not possible because connections are assigned to poll groups
instead of cores now. But we can revert easily because earlier
version of the recent patch did that.

Fixes #925

The github issue was caused by commit 8cf1945432.
The bug fix restored by this patch is commit 1f6a78620d.
The reference we can follow to create this patch is earlier version
of commit fb641c4b54.

Reported-by: yidong0635 <dongx.yi@intel.com>

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ie1ba14a59ce48149a8474cbffc56aa08adc1fc4d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466108
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-08-23 15:26:29 +09:00 committed by Jim Harris
parent 6aff44ccbb
commit 703a5473f7

View File

@ -601,14 +601,23 @@ iscsi_conn_close_luns(struct spdk_iscsi_conn *conn)
}
}
struct _iscsi_conn_remove_ctx {
struct spdk_iscsi_conn *conn;
struct spdk_scsi_lun *lun;
};
static void
iscsi_conn_remove_lun(struct spdk_scsi_lun *lun, void *remove_ctx)
_iscsi_conn_remove_lun(void *_ctx)
{
struct spdk_iscsi_conn *conn = remove_ctx;
struct _iscsi_conn_remove_ctx *ctx = _ctx;
struct spdk_iscsi_conn *conn = ctx->conn;
struct spdk_scsi_lun *lun = ctx->lun;
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;
free(ctx);
assert(spdk_io_channel_get_thread(spdk_io_channel_from_ctx(conn->pg)) ==
spdk_get_thread());
@ -649,6 +658,25 @@ iscsi_conn_remove_lun(struct spdk_scsi_lun *lun, void *remove_ctx)
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 _iscsi_conn_remove_ctx *ctx;
ctx = calloc(1, sizeof(*ctx));
if (!ctx) {
SPDK_ERRLOG("Unable to remove lun from connection\n");
return;
}
ctx->conn = conn;
ctx->lun = lun;
spdk_thread_send_msg(spdk_io_channel_get_thread(spdk_io_channel_from_ctx(conn->pg)),
_iscsi_conn_remove_lun, ctx);
}
static void
iscsi_conn_open_luns(struct spdk_iscsi_conn *conn)
{