Commit ad2dc6c5 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

iscsi: Move connection to EXITING if opening LUNs failed



Opening LUNs is a fatal error. However, the error had been ignored.
Fix the bug in this patch. Change the return type of
iscsi_conn_open_luns() from void to int, and change
iscsi_conn_open_luns() to return 0 if success or -1 otherwise.

iscsi_conn_full_feature_migrate() sets the state of the connection to
EXITING if opening LUNs failed. Then, the first poll in the assigned
poll group destructs the connection.

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I8d64786287f5e1ad9120651439dd21282278cb2d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19382


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarVasuki Manikarnike <vasuki.manikarnike@hpe.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 6e17adcb
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -536,7 +536,7 @@ iscsi_conn_open_lun(struct spdk_iscsi_conn *conn, struct spdk_scsi_lun *lun)
	return 0;
}

static void
static int
iscsi_conn_open_luns(struct spdk_iscsi_conn *conn)
{
	int rc;
@@ -550,10 +550,11 @@ iscsi_conn_open_luns(struct spdk_iscsi_conn *conn)
		}
	}

	return;
	return 0;

error:
	iscsi_conn_close_luns(conn);
	return -1;
}

/**
@@ -1491,6 +1492,7 @@ static void
iscsi_conn_full_feature_migrate(void *arg)
{
	struct spdk_iscsi_conn *conn = arg;
	int rc;

	assert(conn->state != ISCSI_CONN_STATE_EXITED);

@@ -1501,7 +1503,13 @@ iscsi_conn_full_feature_migrate(void *arg)
	 */

	if (conn->sess->session_type == SESSION_TYPE_NORMAL) {
		iscsi_conn_open_luns(conn);
		rc = iscsi_conn_open_luns(conn);
		if (rc != 0) {
			/* If opening LUNs failed, it is a fatal error. At the first poll in the
			 * assigned poll group, this connection will be destructed.
			 */
			conn->state = ISCSI_CONN_STATE_EXITING;
		}
	}

	/* Add this connection to the assigned poll group. */