Commit 703a5473 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

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 8cf19454.
The bug fix restored by this patch is commit 1f6a7862.
The reference we can follow to create this patch is earlier version
of commit fb641c4b.

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

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Change-Id: Ie1ba14a59ce48149a8474cbffc56aa08adc1fc4d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466108


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 6aff44cc
Loading
Loading
Loading
Loading
+30 −2
Original line number Diff line number Diff line
@@ -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)
{