Apparently the SCST code with debugging and/or tracing enabled compiles fine as

an external module. When applying the SCST kernel patch to the mainstream 
kernel tree with debugging and/or tracing enabled however, the resulting code
triggers a compiler error. This is because the symbols DEBUG and TRACING
conflict with symbols with the same named defined in unrelated kernel headers.
The patch below resolves these conflicts by renaming the following preprocessor 
symbols:
- DEBUG into CONFIG_SCST_DEBUG.
- DEBUG_DIGEST_FAILURES into CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES.
- DEBUG_OOM into CONFIG_SCST_DEBUG_OOM.
- DEBUG_RETRY into CONFIG_SCST_DEBUG_RETRY.
- DEBUG_SN into CONFIG_SCST_DEBUG_SN.
- DEBUG_TM into CONFIG_SCST_DEBUG_TM.
- EXTRACHECKS into CONFIG_SCST_EXTRACHECKS.
- SCST_HIGHMEM into CONFIG_SCST_HIGHMEM.
- STRICT_SERIALIZING into CONFIG_SCST_STRICT_SERIALIZING.
- TM_DBG_GO_OFFLINE into CONFIG_SCST_TM_DBG_GO_OFFLINE. Mapped 0/1 values
  into macro undefined / macro defined.
- TRACING into CONFIG_SCST_TRACING.
- USE_EXPECTED_VALUES into CONFIG_SCST_USE_EXPECTED_VALUES.
- In qla_isp/linux/isp_scst.c, renamed DEBUG into DEBUG_ISP_SCST.
- In qla_isp/..., renamed SCSI_TARGET in SCST_SCSI_TARGET.
- In qla_isp/..., renamed SCSI_TARGET_DEV in SCST_SCSI_TARGET_DEV.
Additionally, all CONFIG_SCSI_TARGET* macro's are renamed into CONFIG_SCST* in
order to avoid confusion between the STGT CONFIG-symbols and the SCST CONFIG-
symbols.

The following additional options are now configurable through Kconfig:
- CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES
- CONFIG_SCST_STRICT_SERIALIZING
- CONFIG_SCST_STRICT_SECURITY
- CONFIG_SCST_ALLOW_PASSTHROUGH_IO_SUBMIT_IN_SIRQ
- CONFIG_SCST_ABORT_CONSIDER_FINISHED_TASKS_AS_NOT_EXISTING
- CONFIG_SCST_USE_EXPECTED_VALUES
- CONFIG_SCST_DEBUG_OOM
- CONFIG_SCST_DEBUG_RETRY
- CONFIG_SCST_DEBUG_SN
- CONFIG_SCST_DEBUG_TM
- CONFIG_SCST_TM_DBG_GO_OFFLINE

The patch below has been verified as follows:
- Verified that the following command does not print any new warning messages:
  make -s clean && make -C srpt -s clean && make -s scst iscsi-scst && make -C srpt -s
- Verified as follows that the internal SCST patches still apply cleanly:
  for p in *patch; do patch -p0 --dry-run -f -s <$p; done
- Checked that the patch generated by generate-kernel-patch still applies
  cleanly to the 2.6.25.7 kernel, and that the patched kernel tree still
  compiles, installs and boots fine, that the iscsi-scst, ib_srpt,
  scst_disk and scst_vdisk modules still load, and that iSCSI communication
  still works fine. All SCST kernel configuration options that could be
  enabled have been enabled during this test.

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@453 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2008-07-10 10:49:06 +00:00
parent 103d3412f0
commit cc28ddcdf2
49 changed files with 546 additions and 430 deletions
+19 -2
View File
@@ -1,5 +1,22 @@
config SCST_ISCSI
tristate "SCST iSCSI Support"
depends on SCSI
---help---
iSCSI target support. The iSCSI protocol has been defined in RFC 3720.
help
iSCSI target support. The iSCSI protocol has been defined in
RFC 3720.
config SCST_ISCSI_DEBUG_DIGEST_FAILURES
bool "Simulate iSCSI digest failures"
depends on SCST_ISCSI
help
Simulates iSCSI digest failures in random places. Even when iSCSI
traffic is sent over a TCP connection, the 16-bit TCP checksum is too
weak for the requirements of a storage protocol. Furthermore, there
are also instances where the TCP checksum does not protect iSCSI
data, as when data is corrupted while being transferred on a PCI bus
or while in memory. The iSCSI protocol therefore defines a 32-bit CRC
digest on iSCSI packets in order to detect data corruption on an
end-to-end basis. CRCs can be used on iSCSI PDU headers and/or data.
Enabling this option allows to test digest failure recovery in the
iSCSI initiator that is talking to SCST. If unsure, disable this
option.
+4 -4
View File
@@ -23,11 +23,11 @@
EXTRA_CFLAGS += -I$(src)/../include -I$(SCST_INC_DIR)
# -Wextra -Wno-unused-parameter
EXTRA_CFLAGS += -DEXTRACHECKS
#EXTRA_CFLAGS += -DTRACING
EXTRA_CFLAGS += -DDEBUG -g
EXTRA_CFLAGS += -DCONFIG_SCST_EXTRACHECKS
#EXTRA_CFLAGS += -DCONFIG_SCST_TRACING
EXTRA_CFLAGS += -DCONFIG_SCST_DEBUG -g
#EXTRA_CFLAGS += -DDEBUG_DIGEST_FAILURES
#EXTRA_CFLAGS += -DCONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES
obj-m += iscsi-scst.o
iscsi-scst-objs := iscsi.o nthread.o config.o digest.o \
+11 -11
View File
@@ -19,7 +19,7 @@
#define ISCSI_PROC_VERSION_NAME "version"
#if defined(DEBUG) || defined(TRACING)
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
#define ISCSI_PROC_LOG_ENTRY_NAME "trace_level"
@@ -71,19 +71,19 @@ static int iscsi_version_info_show(struct seq_file *seq, void *v)
seq_printf(seq, "%s\n", ISCSI_VERSION_STRING);
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
seq_printf(seq, "EXTRACHECKS\n");
#endif
#ifdef TRACING
#ifdef CONFIG_SCST_TRACING
seq_printf(seq, "TRACING\n");
#endif
#ifdef DEBUG
#ifdef CONFIG_SCST_DEBUG
seq_printf(seq, "DEBUG\n");
#endif
#ifdef DEBUG_DIGEST_FAILURES
#ifdef CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES
seq_printf(seq, "DEBUG_DIGEST_FAILURES\n");
#endif
@@ -96,7 +96,7 @@ static struct scst_proc_data iscsi_version_proc_data = {
.show = iscsi_version_info_show,
};
#if defined(DEBUG) || defined(TRACING)
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
static struct scst_proc_data iscsi_log_proc_data = {
SCST_DEF_RW_SEQ_OP(iscsi_proc_log_entry_write)
.show = iscsi_log_info_show,
@@ -122,7 +122,7 @@ static __init int iscsi_proc_log_entry_build(struct scst_tgt_template *templ)
goto out;
}
#if defined(DEBUG) || defined(TRACING)
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
/* create the proc file entry for the device */
iscsi_log_proc_data.data = (void *)templ->name;
p = scst_create_proc_entry(root, ISCSI_PROC_LOG_ENTRY_NAME,
@@ -141,7 +141,7 @@ out:
TRACE_EXIT_RES(res);
return res;
#if defined(DEBUG) || defined(TRACING)
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
out_remove_ver:
remove_proc_entry(ISCSI_PROC_VERSION_NAME, root);
goto out;
@@ -156,7 +156,7 @@ static void iscsi_proc_log_entry_clean(struct scst_tgt_template *templ)
root = scst_proc_get_tgt_root(templ);
if (root) {
#if defined(DEBUG) || defined(TRACING)
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
remove_proc_entry(ISCSI_PROC_LOG_ENTRY_NAME, root);
#endif
remove_proc_entry(ISCSI_PROC_VERSION_NAME, root);
@@ -540,7 +540,7 @@ struct file_operations ctr_fops = {
.release = release,
};
#ifdef DEBUG
#ifdef CONFIG_SCST_DEBUG
void iscsi_dump_iov(struct msghdr *msg)
{
if (trace_flag & TRACE_D_IOV) {
@@ -604,4 +604,4 @@ void iscsi_dump_pdu(struct iscsi_pdu *pdu)
printk("Data: (%d)\n", pdu->datasize);
}
}
#endif /* DEBUG */
#endif /* CONFIG_SCST_DEBUG */
+2 -2
View File
@@ -447,7 +447,7 @@ int conn_del(struct iscsi_session *session, struct conn_info *info)
return 0;
}
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
void iscsi_extracheck_is_rd_thread(struct iscsi_conn *conn)
{
@@ -477,4 +477,4 @@ void iscsi_extracheck_is_wr_thread(struct iscsi_conn *conn)
}
}
#endif /* EXTRACHECKS */
#endif /* CONFIG_SCST_EXTRACHECKS */
+1 -1
View File
@@ -61,7 +61,7 @@ static u32 evaluate_crc32_from_sg(struct scatterlist *sg, int total,
{
u32 crc = ~0;
#ifdef DEBUG_DIGEST_FAILURES
#ifdef CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES
if (((scst_random() % 100000) == 752)) {
PRINT_INFO("%s", "Simulating digest failure");
return 0;
+9 -9
View File
@@ -36,7 +36,7 @@ static int ctr_major;
static char ctr_name[] = "iscsi-scst-ctl";
static int iscsi_template_registered;
#if defined(DEBUG) || defined(TRACING)
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
unsigned long iscsi_trace_flag = ISCSI_DEFAULT_LOG_FLAGS;
#endif
@@ -276,7 +276,7 @@ void cmnd_done(struct iscsi_cmnd *cmnd)
if (cmnd->own_sg) {
TRACE_DBG("%s", "own_sg");
scst_free(cmnd->sg, cmnd->sg_cnt);
#ifdef DEBUG
#ifdef CONFIG_SCST_DEBUG
cmnd->own_sg = 0;
cmnd->sg = NULL;
cmnd->sg_cnt = -1;
@@ -289,7 +289,7 @@ void cmnd_done(struct iscsi_cmnd *cmnd)
"new value %d)", cmnd, sess,
atomic_read(&sess->active_cmds)-1);
atomic_dec(&sess->active_cmds);
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
if (unlikely(atomic_read(&sess->active_cmds) < 0)) {
PRINT_CRIT_ERROR("active_cmds < 0 (%d)!!",
atomic_read(&sess->active_cmds));
@@ -392,7 +392,7 @@ void req_cmnd_release(struct iscsi_cmnd *req)
TRACE_DBG("%p", req);
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
sBUG_ON(req->release_called);
req->release_called = 1;
#endif
@@ -420,7 +420,7 @@ void req_cmnd_release(struct iscsi_cmnd *req)
atomic_read(&sess->active_cmds)-1);
atomic_dec(&sess->active_cmds);
req->dec_active_cmnds = 0;
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
if (unlikely(atomic_read(&sess->active_cmds) < 0)) {
PRINT_CRIT_ERROR("active_cmds < 0 (%d)!!",
atomic_read(&sess->active_cmds));
@@ -443,7 +443,7 @@ void rsp_cmnd_release(struct iscsi_cmnd *cmnd)
{
TRACE_DBG("%p", cmnd);
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
sBUG_ON(cmnd->release_called);
cmnd->release_called = 1;
#endif
@@ -2507,7 +2507,7 @@ static void iscsi_try_local_processing(struct iscsi_conn *conn,
list_del(&conn->wr_list_entry);
/* go through */
case ISCSI_CONN_WR_STATE_IDLE:
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
conn->wr_task = current;
#endif
conn->wr_state = ISCSI_CONN_WR_STATE_PROCESSING;
@@ -2529,7 +2529,7 @@ static void iscsi_try_local_processing(struct iscsi_conn *conn,
}
spin_lock_bh(&iscsi_wr_lock);
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
conn->wr_task = NULL;
#endif
if ((rc <= 0) || test_write_ready(conn)) {
@@ -2661,7 +2661,7 @@ static int iscsi_xmit_response(struct scst_cmd *scst_cmd)
}
iscsi_cmnd_init_write(rsp, ISCSI_INIT_WRITE_REMOVE_HASH);
}
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
else
sBUG();
#endif
+6 -6
View File
@@ -160,7 +160,7 @@ struct iscsi_conn {
struct list_head wr_list_entry;
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
struct task_struct *wr_task;
#endif
@@ -195,7 +195,7 @@ struct iscsi_conn {
struct list_head rd_list_entry;
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
struct task_struct *rd_task;
#endif
@@ -258,7 +258,7 @@ struct iscsi_cmnd {
unsigned int ddigest_checked:1;
unsigned int rejected:1;
unsigned int reject_reason:2;
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
unsigned int on_rx_digest_list:1;
unsigned int release_called:1;
#endif
@@ -498,7 +498,7 @@ static inline void cmd_add_on_rx_ddigest_list(struct iscsi_cmnd *req,
"of req %p", cmnd, req);
list_add_tail(&cmnd->rx_ddigest_cmd_list_entry,
&req->rx_ddigest_cmd_list);
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
cmnd->on_rx_digest_list = 1;
#endif
}
@@ -507,7 +507,7 @@ static inline void cmd_del_from_rx_ddigest_list(struct iscsi_cmnd *cmnd)
{
TRACE_DBG("Deleting RX digest cmd %p from digest list", cmnd);
list_del(&cmnd->rx_ddigest_cmd_list_entry);
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
cmnd->on_rx_digest_list = 0;
#endif
}
@@ -548,7 +548,7 @@ static inline void conn_put(struct iscsi_conn *conn)
atomic_dec(&conn->conn_ref_cnt);
}
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
extern void iscsi_extracheck_is_rd_thread(struct iscsi_conn *conn);
extern void iscsi_extracheck_is_wr_thread(struct iscsi_conn *conn);
#else
+5 -5
View File
@@ -32,7 +32,7 @@
#define TRACE_ALL_NO_DATA (TRACE_ALL & ~TRACE_D_IOV & ~TRACE_D_DUMP_PDU & ~TRACE_D_DATA)
#ifdef DEBUG
#ifdef CONFIG_SCST_DEBUG
#define ISCSI_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_LINE | TRACE_PID | \
TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_MINOR | TRACE_MGMT_DEBUG | \
TRACE_MINOR | TRACE_SPECIAL | TRACE_CONN_OC)
@@ -41,7 +41,7 @@
TRACE_MINOR | TRACE_SPECIAL)
#endif
#ifdef DEBUG
#ifdef CONFIG_SCST_DEBUG
struct msghdr;
struct iscsi_pdu;
extern void iscsi_dump_iov(struct msghdr *msg);
@@ -51,12 +51,12 @@ extern void iscsi_dump_pdu(struct iscsi_pdu *pdu);
#define iscsi_dump_pdu(x) do {} while (0)
#endif
#if defined(DEBUG) || defined(TRACING)
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
extern unsigned long iscsi_trace_flag;
#define trace_flag iscsi_trace_flag
#endif
#ifdef DEBUG
#ifdef CONFIG_SCST_DEBUG
#define TRACE_CONN_CLOSE(args...) TRACE(TRACE_CONN_OC, args)
#define TRACE_CONN_CLOSE_DBG(args...) TRACE(TRACE_CONN_OC_DBG, args)
@@ -64,7 +64,7 @@ extern unsigned long iscsi_trace_flag;
#define TRACE_WRITE(args...) TRACE(TRACE_D_WRITE, args)
#define TRACE_READ(args...) TRACE(TRACE_D_READ, args)
#else /* DEBUG */
#else /* CONFIG_SCST_DEBUG */
#define TRACE_CONN_CLOSE(format, args...) {}
#define TRACE_CONN_CLOSE_DBG(format, args...) {}
#define TRACE_NET_PAGE(format, args...) {}
+8 -8
View File
@@ -365,7 +365,7 @@ static void close_conn(struct iscsi_conn *conn)
TRACE_CONN_CLOSE_DBG("conn %p, conn_ref_cnt %d left, wr_state %d, "
"exp_cmd_sn %u", conn, atomic_read(&conn->conn_ref_cnt),
conn->wr_state, session->exp_cmd_sn);
#ifdef DEBUG
#ifdef CONFIG_SCST_DEBUG
{
#ifdef NET_PAGE_CALLBACKS_DEFINED
struct iscsi_cmnd *rsp;
@@ -467,7 +467,7 @@ static int close_conn_thr(void *arg)
TRACE_ENTRY();
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
conn->rd_task = current;
#endif
close_conn(conn);
@@ -782,7 +782,7 @@ static void scst_do_job_rd(void)
sBUG_ON(conn->rd_state == ISCSI_CONN_RD_STATE_PROCESSING);
conn->rd_data_ready = 0;
conn->rd_state = ISCSI_CONN_RD_STATE_PROCESSING;
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
conn->rd_task = current;
#endif
spin_unlock_bh(&iscsi_rd_lock);
@@ -794,7 +794,7 @@ static void scst_do_job_rd(void)
if (closed)
continue;
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
conn->rd_task = NULL;
#endif
if ((rc == 0) || conn->rd_data_ready) {
@@ -1165,7 +1165,7 @@ out_res:
/* else go through */
out_err:
#ifndef DEBUG
#ifndef CONFIG_SCST_DEBUG
if (!conn->closing)
#endif
{
@@ -1189,7 +1189,7 @@ static int exit_tx(struct iscsi_conn *conn, int res)
res = 0;
break;
default:
#ifndef DEBUG
#ifndef CONFIG_SCST_DEBUG
if (!conn->closing)
#endif
{
@@ -1379,7 +1379,7 @@ static void scst_do_job_wr(void)
conn->wr_state = ISCSI_CONN_WR_STATE_PROCESSING;
conn->wr_space_ready = 0;
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
conn->wr_task = current;
#endif
spin_unlock_bh(&iscsi_wr_lock);
@@ -1389,7 +1389,7 @@ static void scst_do_job_wr(void)
rc = process_write_queue(conn);
spin_lock_bh(&iscsi_wr_lock);
#ifdef EXTRACHECKS
#ifdef CONFIG_SCST_EXTRACHECKS
conn->wr_task = NULL;
#endif
if ((rc == -EAGAIN) && !conn->wr_space_ready) {