[Stgt-devel] [PATCH 11/20] iser connection init

FUJITA Tomonori fujita.tomonori
Thu Nov 15 03:20:59 CET 2007


On Tue, 16 Oct 2007 11:21:20 -0400
Pete Wyckoff <pw at osc.edu> wrote:

> After successful negotiation, call into the transport to allocate resources
> or otherwise ready the switch to full feature mode.
> 
> Signed-off-by: Pete Wyckoff <pw at osc.edu>
> ---
>  usr/iscsi/iscsi_tcp.c |    6 ++++++
>  usr/iscsi/iscsid.c    |   19 ++++++++++++++++++-
>  usr/iscsi/transport.h |    1 +
>  3 files changed, 25 insertions(+), 1 deletions(-)
> 
> diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
> index 33cd6f8..566dd9e 100644
> --- a/usr/iscsi/iscsi_tcp.c
> +++ b/usr/iscsi/iscsi_tcp.c
> @@ -210,6 +210,11 @@ static int iscsi_tcp_init(void)
>  	return !nr_sock;
>  }
>  
> +static int iscsi_tcp_conn_init(struct iscsi_connection *conn)
> +{
> +	return 0;
> +}
> +
>  static size_t iscsi_tcp_read(struct iscsi_connection *conn, void *buf,
>  			     size_t nbytes)
>  {
> @@ -312,6 +317,7 @@ struct iscsi_transport iscsi_tcp = {
>  	.name			= "iscsi",
>  	.rdma			= 0,
>  	.ep_init		= iscsi_tcp_init,
> +	.ep_conn_init		= iscsi_tcp_conn_init,
>  	.ep_read		= iscsi_tcp_read,
>  	.ep_write_begin		= iscsi_tcp_write_begin,
>  	.ep_write_end		= iscsi_tcp_write_end,
> diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
> index 51d9bd9..27b17f4 100644
> --- a/usr/iscsi/iscsid.c
> +++ b/usr/iscsi/iscsid.c
> @@ -469,8 +469,22 @@ static void login_start(struct iscsi_connection *conn)
>  
>  static void login_finish(struct iscsi_connection *conn)
>  {
> +	struct iscsi_login_rsp *rsp = (struct iscsi_login_rsp *) &conn->rsp.bhs;
> +	int ret;
> +
>  	switch (conn->session_type) {
>  	case SESSION_NORMAL:
> +		/*
> +		 * Allocate transport resources for this connection.
> +		 */
> +		ret = conn->tp->ep_conn_init(conn);
> +		if (ret) {
> +			rsp->flags = 0;
> +			rsp->status_class = ISCSI_STATUS_CLS_TARGET_ERR;
> +			rsp->status_detail = ISCSI_LOGIN_STATUS_NO_RESOURCES;
> +			conn->state = STATE_EXIT;
> +			break;
> +		}
>  		if (!conn->session)
>  			session_create(conn);
>  		memcpy(conn->isid, conn->session->isid, sizeof(conn->isid));
> @@ -637,8 +651,11 @@ static void cmnd_exec_login(struct iscsi_connection *conn)
>  			default:
>  				goto init_err;
>  			}
> -			if (!stay && !nsg_disagree)
> +			if (!stay && !nsg_disagree) {
>  				login_finish(conn);
> +				if (rsp->status_class)
> +					return;
> +			}
>  			break;
>  		default:
>  			goto init_err;

I renamed ep_conn_init ep_login_complete and merged this though I like
to have error handling in cmnd_exec_login instead of login_finish but
cmnd_exec_login needs some cleanups before that.




More information about the stgt mailing list