From 2125cb840012ff75bfa2d8d3fbb3d652cf624e0c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 21 Dec 2011 09:32:18 +0000 Subject: [PATCH] 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 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4027 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/ft_sess.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fcst/ft_sess.c b/fcst/ft_sess.c index 4037f4ece..b18cb65fc 100644 --- a/fcst/ft_sess.c +++ b/fcst/ft_sess.c @@ -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;