- Avoid that login triggers a crash.
- Add make release2debug / perf2debug / debug2release / debug2perf support.
- Complain when refusing login.
- RHEL 6 build fixes.
(Merged up to revision 4041 from trunk.)


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4043 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2011-12-29 14:46:41 +00:00
parent dca262062d
commit 9a67bab4a7
3 changed files with 45 additions and 19 deletions

View File

@@ -38,24 +38,26 @@ endif
export PWD := $(shell pwd)
export CONFIG_FCST := m
# Set variable $(2) to value $(3) in file $(1).
set_var = $(shell { if [ -e "$(1)" ]; then grep -v '^$(2)=' "$(1)"; fi; echo "$(2)=$(3)"; } >/tmp/$(1)-$$$$.tmp && mv /tmp/$(1)-$$$$.tmp $(1))
#SCST_INC_DIR := /usr/local/include/scst
#SCST_DIR := $(SCST_INC_DIR)
SCST_INC_DIR := $(SUBDIRS)/../scst/include
SCST_DIR := $(shell pwd)/../scst/src
EXTRA_CFLAGS += -I$(SCST_INC_DIR)
FCSTFLAGS = -DDEBUG_WORK_IN_THREAD -DCONFIG_SCST_TRACING -DCONFIG_SCST_DEBUG \
-DCONFIG_SCST_EXTRACHECKS -fno-inline -fno-inline-functions
FCSTFLAGSRELEASE = -DCONFIG_SCST_TRACING
FCSTFLAGSPERF =
EXTRA_CFLAGS += -I$(SCST_INC_DIR) $(FCSTFLAGS$(BUILDMODE))
EXTRA_CFLAGS += -DSUPPORT_TARGET
MODULE_NAME = fcst
EXTRA_CFLAGS += -DMV_DEBUG
INSTALL_DIR := /lib/modules/$(KVER)/extra
#EXTRA_CFLAGS += -DCONFIG_SCST_TRACING
#EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD
#EXTRA_CFLAGS += -DCONFIG_SCST_DEBUG
ifneq ($(KERNELRELEASE),)
include $(SUBDIRS)/Makefile_in-tree
else
@@ -73,7 +75,7 @@ install: all
ins:
./config
insmod fcst.ko
SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Modules.symvers 2>/dev/null)
ifneq ($(SCST_MOD_VERS),)
Modules.symvers: $(SCST_DIR)/Modules.symvers
@@ -104,4 +106,16 @@ clean:
extraclean: clean
rm -f *.orig *.rej
release2debug perf2debug:
-$(MAKE) clean
$(call set_var,build_mode,BUILDMODE,)
debug2release:
-$(MAKE) clean
$(call set_var,build_mode,BUILDMODE,RELEASE)
debug2perf:
-$(MAKE) clean
$(call set_var,build_mode,BUILDMODE,PERF)
.PHONY: all tgt install uninstall clean extraclean

View File

@@ -118,7 +118,8 @@ extern struct scst_tgt_template ft_scst_template;
int ft_prli(struct fc_rport_priv *, u32 spp_len,
const struct fc_els_spp *, struct fc_els_spp *);
void ft_prlo(struct fc_rport_priv *);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) \
&& (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5)
void ft_recv(struct fc_lport *, struct fc_seq *, struct fc_frame *);
#else
void ft_recv(struct fc_lport *, struct fc_frame *);

View File

@@ -344,6 +344,9 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
u32 fcp_parm;
int ret;
if (!rspp)
goto fill;
if (rspp->spp_flags & (FC_SPP_OPA_VAL | FC_SPP_RPA_VAL))
return FC_SPP_RESP_NO_PA;
@@ -364,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;
@@ -377,6 +387,7 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
* If the initiator indicates RETRY, we must support that, too.
* Don't force RETRY on the initiator, though.
*/
fill:
fcp_parm = ntohl(spp->spp_params); /* response parameters */
spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN);
return FC_SPP_RESP_ACK;
@@ -400,10 +411,8 @@ int ft_prli(struct fc_rport_priv *rdata, u32 spp_len,
mutex_lock(&ft_lport_lock);
ret = ft_prli_locked(rdata, spp_len, rspp, spp);
mutex_unlock(&ft_lport_lock);
FT_SESS_DBG("port_id %x flags %x parms %x ret %x\n",
rdata->ids.port_id,
rspp->spp_flags,
ntohl(spp->spp_params), ret);
FT_SESS_DBG("port_id %x flags %x parms %x ret %x\n", rdata->ids.port_id,
rspp ? rspp->spp_flags : 0, ntohl(spp->spp_params), ret);
return ret;
}
@@ -481,7 +490,8 @@ void ft_prlo(struct fc_rport_priv *rdata)
* Caller has verified that the frame is type FCP.
* Note that this may be called directly from the softirq context.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) \
&& (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5)
void ft_recv(struct fc_lport *lport, struct fc_seq *sp, struct fc_frame *fp)
#else
void ft_recv(struct fc_lport *lport, struct fc_frame *fp)
@@ -499,7 +509,8 @@ void ft_recv(struct fc_lport *lport, struct fc_frame *fp)
sess = ft_sess_get(lport, sid);
if (!sess) {
FT_SESS_DBG("sid %x sess lookup failed\n", sid);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) \
&& (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5)
lport->tt.exch_done(sp);
#endif
/* TBD XXX - if FCP_CMND, send LOGO */