On 03/01/2013 06:06 PM, Lee Duncan wrote:
> When login fails we should be returning an error code
> so that userland is aware that something is amiss.
> 
> Signed-off-by: Hannes Reinecke <[email protected]>
> Signed-off-by: Lee Duncan <[email protected]>
> ---
>  include/iscsi_if.h |    1 +
>  usr/session_mgmt.c |    4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/iscsi_if.h b/include/iscsi_if.h
> index dad9fd8..fe91c6f 100644
> --- a/include/iscsi_if.h
> +++ b/include/iscsi_if.h
> @@ -409,6 +409,7 @@ enum iscsi_err {
>       ISCSI_ERR_XMIT_FAILED           = ISCSI_ERR_BASE + 19,
>       ISCSI_ERR_TCP_CONN_CLOSE        = ISCSI_ERR_BASE + 20,
>       ISCSI_ERR_SCSI_EH_SESSION_RST   = ISCSI_ERR_BASE + 21,
> +     ISCSI_ERR_LOGIN_FAILED          = ISCSI_ERR_BASE + 22,
>  };

Those errors are for the iscsi user/kernel interface.

The errors you want for userspace are in include/iscsi_err.h.

>  
>  /*
> diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c
> index ec1f43a..deee5af 100644
> --- a/usr/session_mgmt.c
> +++ b/usr/session_mgmt.c
> @@ -178,12 +178,12 @@ int iscsi_login_portal(void *data, struct list_head 
> *list, struct node_rec *rec)
>               goto done;
>       }
>       if (session_count >= rec->session.nr_sessions) {
> -             log_debug(1, "%s: %d session%s requested, but %d "
> +             log_warning("%s: %d session%s requested, but %d "
>                         "already present.",
>                         rec->iface.name, rec->session.nr_sessions,
>                         rec->session.nr_sessions == 1 ? "" : "s",
>                         session_count);
> -             rc = 0;
> +             rc = ISCSI_ERR_LOGIN_FAILED;
>               goto done;
>       }
>

For this, what about returning ISCSI_ERR_SESS_EXISTS?

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to