fcst: Complain when refusing login

Log an error message when refusing login because a target port has not yet been enabled
such that fcst users have a way to find out what happened.

Also, make sure that ft_prli() returns a value in the range of the enumeration type
fc_els_spp_resp. Note: since the return value of ft_prli() is only compared against
FC_SPP_RESP_ACK in the current libfc implementation, this change doesn't affect the
behavior of fcst.

BSD-signed-off-by: Bart Van Assche <bvanassche@acm.org>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4027 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2011-12-21 09:32:18 +00:00
parent 356f2339a7
commit 2125cb8400

View File

@@ -367,9 +367,16 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
if (!(fcp_parm & FCP_SPPF_INIT_FCN))
return FC_SPP_RESP_CONF;
tport = rcu_dereference(rdata->local_port->prov[FC_TYPE_FCP]);
if (!tport || !tport->enabled)
return 0; /* not a target for this local port */
if (!tport) {
/* not a target for this local port */
return FC_SPP_RESP_CONF;
}
if (!tport->enabled) {
pr_err("Refused login from %#x because target port %s"
" not yet enabled", rdata->ids.port_id,
tport->tgt->tgt_name);
return FC_SPP_RESP_CONF;
}
ret = ft_sess_create(tport, rdata, fcp_parm);
if (ret)
return ret;