diff --git a/AskingQuestions b/AskingQuestions index 2634b2aac..7bd58c1b2 100644 --- a/AskingQuestions +++ b/AskingQuestions @@ -28,8 +28,12 @@ If you experience kernel crash, hang, etc., you should follow REPORTING-BUGS file from your kernel source tree. For most questions it is very desirable if you attach to your message -full kernel log from target since it's booted. It will allow us to see -your target and SCST configurations. +full kernel log from the target since it's booted. Note, *SINCE IT +BOOTED*. Please don't try to be smart and filter out what's you +think isn't needed. What's usually removed could allow us to see the +target and SCST configurations. + +Don't forget to compress your log using "bzip2 -9". Example of a really bad question: diff --git a/iscsi-scst/AskingQuestions b/iscsi-scst/AskingQuestions index 2634b2aac..7bd58c1b2 100644 --- a/iscsi-scst/AskingQuestions +++ b/iscsi-scst/AskingQuestions @@ -28,8 +28,12 @@ If you experience kernel crash, hang, etc., you should follow REPORTING-BUGS file from your kernel source tree. For most questions it is very desirable if you attach to your message -full kernel log from target since it's booted. It will allow us to see -your target and SCST configurations. +full kernel log from the target since it's booted. Note, *SINCE IT +BOOTED*. Please don't try to be smart and filter out what's you +think isn't needed. What's usually removed could allow us to see the +target and SCST configurations. + +Don't forget to compress your log using "bzip2 -9". Example of a really bad question: diff --git a/iscsi-scst/README b/iscsi-scst/README index 8b241d350..f6fae45cc 100644 --- a/iscsi-scst/README +++ b/iscsi-scst/README @@ -4,22 +4,15 @@ iSCSI SCST target driver Version 1.0.2, XX XXXXX 2009 ---------------------------- -This driver is a forked with all respects version of iSCSI Enterprise -Target (IET) (http://iscsitarget.sourceforge.net/) with updates to work -over SCST as well as with many improvements and bugfixes (see ChangeLog -file). The reason of fork is that the necessary changes are intrusive -and with the current IET merge policy, where only simple bugfix-like -patches, which doesn't touch the core code, could be merged, it is very -unlikely that they will be merged in the main IET trunk. +ISCSI-SCST is a deeply reworked fork of iSCSI Enterprise Target (IET) +(http://iscsitarget.sourceforge.net). Reasons of the fork were: -To let it be installed and work at the same host together with IET -simultaneously all the driver's modules and files were renamed: + - To be able to use full power of SCST core. - * ietd.conf -> iscsi-scstd.conf - * ietadm -> iscsi-scst-adm - * ietd -> iscsi-scstd - * iscsi-target -> iscsi-scst - * iscsi-target.ko -> iscsi-scst.ko + - To fix all the problems, corner cases issues and iSCSI standard + violations which IET has. + +See more info at http://scst.sourceforge.net/target_iscsi.html. This version is compatible with SCST version 1.0.2 and higher. diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index d3aad9cd4..5b185c97c 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -1331,16 +1331,21 @@ static void iscsi_set_resid(struct iscsi_cmnd *rsp, bool bufflen_set) static int iscsi_preliminary_complete(struct iscsi_cmnd *req, struct iscsi_cmnd *orig_req, bool get_data) { - struct iscsi_hdr *req_hdr = &req->pdu.bhs; int res = 0; bool set_r2t_len; TRACE_ENTRY(); - TRACE_DBG_FLAG(iscsi_get_flow_ctrl_or_mgmt_dbg_log_flag(orig_req), - "Prelim completed req %p, orig_req %p (FINAL %x, " - "outstanding_r2t %d)", req, orig_req, - (req_hdr->flags & ISCSI_CMD_FINAL), orig_req->outstanding_r2t); +#ifdef CONFIG_SCST_DEBUG + { + struct iscsi_hdr *req_hdr = &req->pdu.bhs; + TRACE_DBG_FLAG(iscsi_get_flow_ctrl_or_mgmt_dbg_log_flag(orig_req), + "Prelim completed req %p, orig_req %p (FINAL %x, " + "outstanding_r2t %d)", req, orig_req, + (req_hdr->flags & ISCSI_CMD_FINAL), + orig_req->outstanding_r2t); + } +#endif iscsi_extracheck_is_rd_thread(req->conn); sBUG_ON(req->parent_req != NULL); @@ -1933,7 +1938,7 @@ static int data_out_start(struct iscsi_cmnd *cmnd) * we received all related PDUs from the initiator or timeout * them. Let's quietly drop such PDUs. */ - TRACE(TRACE_MGMT_MINOR, "Unable to find scsi task ITT %x", + TRACE_MGMT_DBG("Unable to find scsi task ITT %x", cmnd_itt(cmnd)); res = iscsi_preliminary_complete(cmnd, cmnd, true); goto out; @@ -2312,12 +2317,11 @@ static void execute_task_management(struct iscsi_cmnd *req) struct iscsi_session *sess = conn->session; struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs; - int rc, status, function = req_hdr->function & ISCSI_FUNCTION_MASK; + int rc, status = ISCSI_RESPONSE_FUNCTION_REJECTED; + int function = req_hdr->function & ISCSI_FUNCTION_MASK; struct scst_rx_mgmt_params params; - TRACE((function == ISCSI_FUNCTION_ABORT_TASK) ? - TRACE_MGMT_MINOR : TRACE_MGMT, - "TM fn %d", function); + TRACE(TRACE_MGMT, "TM fn %d", function); TRACE_MGMT_DBG("TM req %p, ITT %x, RTT %x, sn %u, con %p", req, cmnd_itt(req), req_hdr->rtt, req_hdr->cmd_sn, conn); @@ -2330,7 +2334,7 @@ static void execute_task_management(struct iscsi_cmnd *req) if (sess->tm_rsp != NULL) { struct iscsi_cmnd *tm_rsp = sess->tm_rsp; - TRACE(TRACE_MGMT_MINOR, "Dropping delayed TM rsp %p", tm_rsp); + TRACE_MGMT_DBG("Dropping delayed TM rsp %p", tm_rsp); sess->tm_rsp = NULL; sess->tm_active--; @@ -3105,8 +3109,9 @@ static int iscsi_xmit_response(struct scst_cmd *scst_cmd) req->sg_cnt); EXTRACHECKS_BUG_ON(req->hashed); - if (req->main_rsp != NULL) + if (req->main_rsp != NULL) { EXTRACHECKS_BUG_ON(cmnd_opcode(req->main_rsp) != ISCSI_OP_REJECT); + } if (unlikely((req->bufflen != 0) && !is_send_status)) { PRINT_CRIT_ERROR("%s", "Sending DATA without STATUS is " @@ -3199,7 +3204,7 @@ static void iscsi_check_send_delayed_tm_resp(struct iscsi_session *sess) if (iscsi_is_delay_tm_resp(tm_rsp)) goto out; - TRACE(TRACE_MGMT_MINOR, "Sending delayed rsp %p", tm_rsp); + TRACE_MGMT_DBG("Sending delayed rsp %p", tm_rsp); sess->tm_rsp = NULL; sess->tm_active--; @@ -3229,9 +3234,7 @@ static void iscsi_send_task_mgmt_resp(struct iscsi_cmnd *req, int status) TRACE_ENTRY(); TRACE_MGMT_DBG("TM req %p finished", req); - TRACE((req_hdr->function == ISCSI_FUNCTION_ABORT_TASK) ? - TRACE_MGMT_MINOR : TRACE_MGMT, - "TM fn %d finished, status %d", fn, status); + TRACE(TRACE_MGMT, "TM fn %d finished, status %d", fn, status); rsp = iscsi_alloc_rsp(req); rsp_hdr = (struct iscsi_task_rsp_hdr *)&rsp->pdu.bhs; @@ -3250,9 +3253,9 @@ static void iscsi_send_task_mgmt_resp(struct iscsi_cmnd *req, int status) spin_lock(&sess->sn_lock); if (iscsi_is_delay_tm_resp(rsp)) { - TRACE(TRACE_MGMT_MINOR, "Delaying TM fn %d response %p " - "(req %p), because not all affected commands received " - "(TM cmd sn %u, exp sn %u)", + TRACE_MGMT_DBG("Delaying TM fn %d response %p " + "(req %p), because not all affected commands " + "received (TM cmd sn %u, exp sn %u)", req_hdr->function & ISCSI_FUNCTION_MASK, rsp, req, req_hdr->cmd_sn, sess->exp_cmd_sn); sess->tm_rsp = rsp; @@ -3446,7 +3449,8 @@ static int iscsi_target_release(struct scst_tgt *scst_tgt) return 0; } -#ifndef CONFIG_SCST_PROC +#if !defined(CONFIG_SCST_PROC) && \ + (defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)) static struct scst_trace_log iscsi_local_trace_tbl[] = { { TRACE_D_WRITE, "d_write" }, { TRACE_CONN_OC, "conn" }, @@ -3476,7 +3480,8 @@ struct scst_tgt_template iscsi_template = { #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) .default_trace_flags = ISCSI_DEFAULT_LOG_FLAGS, .trace_flags = &trace_flag, -#ifndef CONFIG_SCST_PROC +#if !defined(CONFIG_SCST_PROC) && \ + (defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)) .trace_tbl = iscsi_local_trace_tbl, .trace_tbl_help = ISCSI_TRACE_TLB_HELP, #endif diff --git a/iscsi-scst/kernel/iscsi_dbg.h b/iscsi-scst/kernel/iscsi_dbg.h index ea5351f4f..c225f7e99 100644 --- a/iscsi-scst/kernel/iscsi_dbg.h +++ b/iscsi-scst/kernel/iscsi_dbg.h @@ -29,11 +29,11 @@ #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_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_DEBUG | \ TRACE_MINOR | TRACE_SPECIAL | TRACE_CONN_OC) #else #define ISCSI_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ - TRACE_MINOR | TRACE_SPECIAL) + TRACE_SPECIAL) #endif #ifdef CONFIG_SCST_DEBUG diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index d97c946fb..998ab0ca7 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -454,8 +454,7 @@ static void close_conn(struct iscsi_conn *conn) spin_lock(&session->sn_lock); if (session->tm_rsp && session->tm_rsp->conn == conn) { struct iscsi_cmnd *tm_rsp = session->tm_rsp; - TRACE(TRACE_MGMT_MINOR, "Dropping delayed TM rsp %p", - tm_rsp); + TRACE_MGMT_DBG("Dropping delayed TM rsp %p", tm_rsp); session->tm_rsp = NULL; session->tm_active--; WARN_ON(session->tm_active < 0); @@ -647,6 +646,7 @@ static struct iscsi_cmnd *iscsi_get_send_cmnd(struct iscsi_conn *conn) } if (unlikely(cmnd_opcode(cmnd) == ISCSI_OP_SCSI_TASK_MGT_RSP)) { +#ifdef CONFIG_SCST_DEBUG struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&cmnd->parent_req->pdu.bhs; struct iscsi_task_rsp_hdr *rsp_hdr = @@ -655,6 +655,7 @@ static struct iscsi_cmnd *iscsi_get_send_cmnd(struct iscsi_conn *conn) "fn %d, parent_req %p)", cmnd, rsp_hdr->response, req_hdr->function & ISCSI_FUNCTION_MASK, cmnd->parent_req); +#endif } return cmnd; diff --git a/mvsas_tgt/mv_tgt.c b/mvsas_tgt/mv_tgt.c index 3f724b8f4..f16d59a85 100644 --- a/mvsas_tgt/mv_tgt.c +++ b/mvsas_tgt/mv_tgt.c @@ -773,7 +773,7 @@ static int mvst_xmit_response(struct scst_cmd *scst_cmd) scst_sess_get_tgt_priv(scst_cmd_get_session(scst_cmd)); if (unlikely(scst_cmd_aborted(scst_cmd))) { - TRACE(TRACE_MGMT_MINOR, "mvst tgt: terminating exchange " + TRACE_MGMT_DBG("mvst tgt: terminating exchange " "for aborted scst_cmd=%p (tag=%lld)", scst_cmd, scst_cmd_get_tag(scst_cmd)); diff --git a/mvsas_tgt/mv_tgt.h b/mvsas_tgt/mv_tgt.h index ff4badd38..9b13ec44b 100644 --- a/mvsas_tgt/mv_tgt.h +++ b/mvsas_tgt/mv_tgt.h @@ -33,14 +33,12 @@ struct mvs_info; #ifdef MV_DEBUG #ifdef CONFIG_SCST_DEBUG #define MVST_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_PID | \ - TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_MINOR | \ - TRACE_MGMT_DEBUG | TRACE_MINOR | TRACE_SPECIAL | \ - TRACE_SCSI | TRACE_DEBUG) + TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_DEBUG | \ + TRACE_MINOR | TRACE_SPECIAL | TRACE_SCSI | TRACE_DEBUG) #else # ifdef CONFIG_SCST_TRACING #define MVST_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | \ - TRACE_MGMT | TRACE_MINOR | \ - TRACE_SPECIAL) + TRACE_MGMT | TRACE_SPECIAL) # endif #endif #else diff --git a/qla2x00t/qla2x00-target/AskingQuestions b/qla2x00t/qla2x00-target/AskingQuestions index 2634b2aac..7bd58c1b2 100644 --- a/qla2x00t/qla2x00-target/AskingQuestions +++ b/qla2x00t/qla2x00-target/AskingQuestions @@ -28,8 +28,12 @@ If you experience kernel crash, hang, etc., you should follow REPORTING-BUGS file from your kernel source tree. For most questions it is very desirable if you attach to your message -full kernel log from target since it's booted. It will allow us to see -your target and SCST configurations. +full kernel log from the target since it's booted. Note, *SINCE IT +BOOTED*. Please don't try to be smart and filter out what's you +think isn't needed. What's usually removed could allow us to see the +target and SCST configurations. + +Don't forget to compress your log using "bzip2 -9". Example of a really bad question: diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index f691f8f59..40afe5519 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -55,11 +55,11 @@ #ifdef CONFIG_SCST_DEBUG #define Q2T_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_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_DEBUG | \ + TRACE_MINOR | TRACE_SPECIAL) #else # ifdef CONFIG_SCST_TRACING -#define Q2T_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MINOR | \ +#define Q2T_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ TRACE_SPECIAL) # endif #endif @@ -1153,7 +1153,7 @@ static void q24_handle_abts(scsi_qla_host_t *ha, abts24_recv_entry_t *abts) goto out_err; } - TRACE(TRACE_MGMT_MINOR, "qla2x00tgt(%ld): task abort (s_id=%x:%x:%x, " + TRACE(TRACE_MGMT, "qla2x00tgt(%ld): task abort (s_id=%x:%x:%x, " "tag=%d, param=%x)", ha->instance, abts->fcp_hdr_le.s_id[0], abts->fcp_hdr_le.s_id[1], abts->fcp_hdr_le.s_id[2], tag, le32_to_cpu(abts->fcp_hdr_le.parameter)); @@ -1801,7 +1801,7 @@ static int q2t_pre_xmit_response(struct q2t_cmd *cmd, TRACE_ENTRY(); if (unlikely(cmd->aborted)) { - TRACE(TRACE_MGMT_MINOR, "qla2x00tgt(%ld): terminating exchange " + TRACE_MGMT_DBG("qla2x00tgt(%ld): terminating exchange " "for aborted cmd=%p (scst_cmd=%p, tag=%d)", ha->instance, cmd, scst_cmd, cmd->tag); @@ -2822,8 +2822,9 @@ static void q2t_do_ctio_completion(scsi_qla_host_t *ha, uint32_t handle, case CTIO_ABORTED: case CTIO_TIMEOUT: case CTIO_INVALID_RX_ID: - /* they are OK */ - TRACE(TRACE_MGMT_MINOR, "qla2x00tgt(%ld): CTIO with " + /* They are OK */ + TRACE(TRACE_MINOR_AND_MGMT_DBG, + "qla2x00tgt(%ld): CTIO with " "status %#x received, state %x, scst_cmd %p, " "op %x (LIP_RESET=e, ABORTED=2, TARGET_RESET=17, " "TIMEOUT=b, INVALID_RX_ID=8)", ha->instance, @@ -3892,8 +3893,7 @@ static void q2t_prepare_srr_imm(scsi_qla_host_t *ha, void *iocb) tgt->imm_srr_id++; - TRACE(TRACE_MGMT_MINOR, "qla2x00tgt(%ld): IMM NTFY SRR " - "received", ha->instance); + TRACE(TRACE_MGMT, "qla2x00tgt(%ld): SRR received", ha->instance); imm = kzalloc(sizeof(*imm), GFP_ATOMIC); if (imm != NULL) { @@ -4076,7 +4076,7 @@ static void q2t_handle_imm_notify(scsi_qla_host_t *ha, void *iocb) break; case IMM_NTFY_ABORT_TASK: - TRACE(TRACE_MGMT_MINOR, "Abort Task (S %08x I %#x -> L %#x)", + TRACE(TRACE_MGMT, "Abort Task (S %08x I %#x -> L %#x)", le16_to_cpu(iocb2x->seq_id), GET_TARGET_ID(ha, iocb2x), le16_to_cpu(iocb2x->lun)); if (q2t_abort_task(ha, iocb2x) == 0) diff --git a/scst/AskingQuestions b/scst/AskingQuestions index 2634b2aac..7bd58c1b2 100644 --- a/scst/AskingQuestions +++ b/scst/AskingQuestions @@ -28,8 +28,12 @@ If you experience kernel crash, hang, etc., you should follow REPORTING-BUGS file from your kernel source tree. For most questions it is very desirable if you attach to your message -full kernel log from target since it's booted. It will allow us to see -your target and SCST configurations. +full kernel log from the target since it's booted. Note, *SINCE IT +BOOTED*. Please don't try to be smart and filter out what's you +think isn't needed. What's usually removed could allow us to see the +target and SCST configurations. + +Don't forget to compress your log using "bzip2 -9". Example of a really bad question: diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 2bd63f82f..9cdcaacb7 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -94,14 +94,15 @@ #define TRACE_OUT_OF_MEM 0x00000100 #define TRACE_MINOR 0x00000200 /* less important events */ #define TRACE_MGMT 0x00000400 -#define TRACE_MGMT_MINOR 0x00000800 -#define TRACE_MGMT_DEBUG 0x00001000 -#define TRACE_SCSI 0x00002000 -#define TRACE_SPECIAL 0x00004000 /* filtering debug, etc */ -#define TRACE_FLOW_CONTROL 0x00008000 /* flow control in action */ +#define TRACE_MGMT_DEBUG 0x00000800 +#define TRACE_SCSI 0x00001000 +#define TRACE_SPECIAL 0x00002000 /* filtering debug, etc */ +#define TRACE_FLOW_CONTROL 0x00004000 /* flow control in action */ #define TRACE_ALL 0xffffffff /* Flags 0xXXXX0000 are local for users */ +#define TRACE_MINOR_AND_MGMT_DBG (TRACE_MINOR|TRACE_MGMT_DEBUG) + #ifndef KERN_CONT #define KERN_CONT "" #endif diff --git a/scst/src/dev_handlers/scst_dev_handler.h b/scst/src/dev_handlers/scst_dev_handler.h index 58fce8650..c147270aa 100644 --- a/scst/src/dev_handlers/scst_dev_handler.h +++ b/scst/src/dev_handlers/scst_dev_handler.h @@ -12,11 +12,11 @@ #ifdef CONFIG_SCST_DEBUG #define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_PID | \ - TRACE_LINE | TRACE_FUNCTION | TRACE_MGMT | TRACE_MGMT_MINOR | \ - TRACE_MINOR | TRACE_MGMT_DEBUG | TRACE_SPECIAL) + TRACE_LINE | TRACE_FUNCTION | TRACE_MGMT | TRACE_MINOR | \ + TRACE_MGMT_DEBUG | TRACE_SPECIAL) #else #define SCST_DEFAULT_DEV_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ - TRACE_MINOR | TRACE_SPECIAL) + TRACE_SPECIAL) #endif static unsigned long dh_trace_flag = SCST_DEFAULT_DEV_LOG_FLAGS; diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index a0e0cfd47..a2d775007 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -304,7 +304,7 @@ static inline int calc_num_pg(unsigned long buf, int len) static void __dev_user_not_reg(void) { - TRACE(TRACE_MGMT_MINOR, "%s", "Device not registered"); + TRACE_MGMT_DBG("%s", "Device not registered"); return; } diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 20251e59d..8c2dc71d5 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2181,7 +2181,7 @@ static void vdisk_exec_read_capacity16(struct scst_cmd *cmd) * But if you're using such buggy Windows and experience this problem, * change this '1' to '0'. */ -#if 1 +#if 0 /* there are too many such hosts */ if (length > READ_CAP16_LEN) length = READ_CAP16_LEN; #else diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 98b3e2005..07a6f2ee9 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2720,7 +2720,7 @@ int scst_prepare_request_sense(struct scst_cmd *orig_cmd) rs_cmd->expected_transfer_len = SCST_SENSE_BUFFERSIZE; rs_cmd->expected_values_set = 1; - TRACE(TRACE_MGMT_MINOR, "Adding REQUEST SENSE cmd %p to head of active " + TRACE_MGMT_DBG("Adding REQUEST SENSE cmd %p to head of active " "cmd list", rs_cmd); spin_lock_irq(&rs_cmd->cmd_lists->cmd_list_lock); list_add(&rs_cmd->cmd_list_entry, &rs_cmd->cmd_lists->active_cmd_list); @@ -2764,7 +2764,7 @@ static void scst_complete_request_sense(struct scst_cmd *req_cmd) if (len > 0) scst_put_buf(req_cmd, buf); - TRACE(TRACE_MGMT_MINOR, "Adding orig cmd %p to head of active " + TRACE_MGMT_DBG("Adding orig cmd %p to head of active " "cmd list", orig_cmd); spin_lock_irq(&orig_cmd->cmd_lists->cmd_list_lock); list_add(&orig_cmd->cmd_list_entry, &orig_cmd->cmd_lists->active_cmd_list); @@ -4593,8 +4593,8 @@ static void scst_check_internal_sense(struct scst_device *dev, int result, if (host_byte(result) == DID_RESET) { int sl; - TRACE(TRACE_MGMT_MINOR, "%s", "DID_RESET received, triggering " - "reset UA"); + TRACE(TRACE_MGMT, "DID_RESET received for device %s, " + "triggering reset UA", dev->virt_name); sl = scst_set_sense(sense, sense_len, dev->d_sense, SCST_LOAD_SENSE(scst_sense_reset_UA)); scst_dev_check_set_UA(dev, NULL, sense, sl); @@ -4778,7 +4778,7 @@ void scst_process_reset(struct scst_device *dev, if (dev->dev_reserved) { list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { - TRACE(TRACE_MGMT_MINOR, "Clearing RESERVE'ation for " + TRACE_MGMT_DBG("Clearing RESERVE'ation for " "tgt_dev LUN %lld", (long long unsigned int)tgt_dev->lun); clear_bit(SCST_TGT_DEV_RESERVED, @@ -4859,7 +4859,7 @@ int scst_set_pending_UA(struct scst_cmd *cmd) TRACE_ENTRY(); - TRACE(TRACE_MGMT_MINOR, "Setting pending UA cmd %p", cmd); + TRACE_MGMT_DBG("Setting pending UA cmd %p", cmd); spin_lock_bh(&cmd->tgt_dev->tgt_dev_lock); @@ -5082,7 +5082,7 @@ void __scst_dev_check_set_UA(struct scst_device *dev, { TRACE_ENTRY(); - TRACE(TRACE_MGMT_MINOR, "Processing UA dev %p", dev); + TRACE_MGMT_DBG("Processing UA dev %p", dev); /* Check for reset UA */ if (scst_analyze_sense(sense, sense_len, SCST_SENSE_ASC_VALID, diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 77c901544..c5e7ecece 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -59,10 +59,9 @@ extern unsigned long scst_trace_flag; #ifdef CONFIG_SCST_DEBUG -/* TRACE_MGMT_MINOR disabled to not confuse regular users */ #define SCST_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_PID | \ TRACE_LINE | TRACE_FUNCTION | TRACE_SPECIAL | TRACE_MGMT | \ - /*TRACE_MGMT_MINOR |*/ TRACE_MGMT_DEBUG | TRACE_RTRY) + TRACE_MGMT_DEBUG | TRACE_RTRY) #define TRACE_RETRY(args...) TRACE_DBG_FLAG(TRACE_RTRY, args) #define TRACE_SN(args...) TRACE_DBG_FLAG(TRACE_SCSI_SERIALIZING, args) @@ -74,7 +73,7 @@ extern unsigned long scst_trace_flag; #else /* CONFIG_SCST_DEBUG */ # ifdef CONFIG_SCST_TRACING -#define SCST_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_MGMT | \ +#define SCST_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ TRACE_SPECIAL) # else #define SCST_DEFAULT_LOG_FLAGS 0 diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index ab060d58e..ff1365b6e 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -108,7 +108,6 @@ static struct scst_trace_log scst_proc_trace_tbl[] = { { TRACE_SPECIAL, "special" }, { TRACE_SCSI, "scsi" }, { TRACE_MGMT, "mgmt" }, - { TRACE_MGMT_MINOR, "mgmt_minor" }, { TRACE_MGMT_DEBUG, "mgmt_dbg" }, { TRACE_FLOW_CONTROL, "flow_control" }, { 0, NULL } @@ -156,7 +155,7 @@ static char *scst_proc_help_string = " >/proc/scsi_tgt/[DEV_HANDLER_NAME/]trace_level\n" " where TOKEN is one of [debug, function, line, pid, entryexit,\n" " buff, mem, sg, out_of_mem, special, scsi,\n" -" mgmt, minor, mgmt_minor, mgmt_dbg]\n" +" mgmt, minor, mgmt_dbg]\n" " Additionally for /proc/scsi_tgt/trace_level there are these TOKENs\n" " [scsi_serializing, retry, recv_bot, send_bot, recv_top, send_top]\n" #endif diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index e88eb76a1..09933ddc0 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -79,7 +79,6 @@ static struct scst_trace_log scst_trace_tbl[] = { { TRACE_SPECIAL, "special" }, { TRACE_SCSI, "scsi" }, { TRACE_MGMT, "mgmt" }, - { TRACE_MGMT_MINOR, "mgmt_minor" }, { TRACE_MGMT_DEBUG, "mgmt_dbg" }, { TRACE_FLOW_CONTROL, "flow_control" }, { 0, NULL } @@ -2205,7 +2204,7 @@ static ssize_t scst_trace_level_show(const struct scst_trace_log *local_tbl, " buff, mem, sg, out_of_mem,\n" #endif " special, scsi, mgmt, minor,\n" - " mgmt_minor, mgmt_dbg, scsi_serializing,\n" + " mgmt_dbg, scsi_serializing,\n" " retry, recv_bot, send_bot, recv_top,\n" " send_top%s]", help != NULL ? help : ""); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 32ba1b934..578d26278 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -360,10 +360,11 @@ static int scst_pre_parse(struct scst_cmd *cmd) PRINT_BUFFER("Failed CDB", cmd->cdb, cmd->cdb_len); goto out_xmit; } - PRINT_ERROR("Unknown opcode 0x%02x for %s. " + TRACE(TRACE_MINOR, "Unknown opcode 0x%02x for %s. " "Should you update scst_scsi_op_table?", cmd->cdb[0], dev->handler->name); - PRINT_BUFFER("Failed CDB", cmd->cdb, cmd->cdb_len); + PRINT_BUFF_FLAG(TRACE_MINOR, "Failed CDB", cmd->cdb, + cmd->cdb_len); #ifdef CONFIG_SCST_USE_EXPECTED_VALUES if (scst_cmd_is_expected_set(cmd)) { TRACE(TRACE_SCSI, "Using initiator supplied values: " @@ -601,8 +602,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) !scst_is_allowed_to_mismatch_cmd(cmd)) { PRINT_ERROR("Expected data direction %d for " "opcode 0x%02x (handler %s, target %s) " - "doesn't match " - "decoded value %d", + "doesn't match decoded value %d", cmd->expected_data_direction, cmd->cdb[0], dev->handler->name, cmd->tgtt->name, cmd->data_direction); @@ -614,7 +614,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) } } if (unlikely(cmd->bufflen != cmd->expected_transfer_len)) { - TRACE(TRACE_MGMT_MINOR, "Warning: expected " + TRACE(TRACE_MINOR, "Warning: expected " "transfer length %d for opcode 0x%02x " "(handler %s, target %s) doesn't match " "decoded value %d. Faulty initiator " @@ -623,7 +623,7 @@ static int scst_parse_cmd(struct scst_cmd *cmd) cmd->expected_transfer_len, cmd->cdb[0], dev->handler->name, cmd->tgtt->name, cmd->bufflen); - PRINT_BUFF_FLAG(TRACE_MGMT_MINOR, "Suspicious CDB", + PRINT_BUFF_FLAG(TRACE_MINOR, "Suspicious CDB", cmd->cdb, cmd->cdb_len); } #endif @@ -2413,9 +2413,9 @@ static int scst_check_sense(struct scst_cmd *cmd) SCST_SENSE_ASC_VALID, 0, SCST_SENSE_ASC_UA_RESET, 0)) { if (cmd->double_ua_possible) { - TRACE(TRACE_MGMT_MINOR, "Double UA " + TRACE_MGMT_DBG("Double UA " "detected for device %p", dev); - TRACE(TRACE_MGMT_MINOR, "Retrying cmd" + TRACE_MGMT_DBG("Retrying cmd" " %p (tag %llu)", cmd, (long long unsigned)cmd->tag); @@ -2478,8 +2478,8 @@ static int scst_check_auto_sense(struct scst_cmd *cmd) if (unlikely(cmd->status == SAM_STAT_CHECK_CONDITION) && (!SCST_SENSE_VALID(cmd->sense) || SCST_NO_SENSE(cmd->sense))) { - TRACE(TRACE_SCSI|TRACE_MINOR, "CHECK_CONDITION, but no sense: " - "cmd->status=%x, cmd->msg_status=%x, " + TRACE(TRACE_SCSI|TRACE_MINOR_AND_MGMT_DBG, "CHECK_CONDITION, " + "but no sense: cmd->status=%x, cmd->msg_status=%x, " "cmd->host_status=%x, cmd->driver_status=%x (cmd %p)", cmd->status, cmd->msg_status, cmd->host_status, cmd->driver_status, cmd); @@ -2491,9 +2491,9 @@ static int scst_check_auto_sense(struct scst_cmd *cmd) (cmd->host_status == DID_ABORT)) { scst_set_busy(cmd); } else { - TRACE(TRACE_SCSI|TRACE_MINOR, "Host status %x " - "received, returning HARDWARE ERROR instead " - "(cmd %p)", cmd->host_status, cmd); + TRACE(TRACE_SCSI|TRACE_MINOR_AND_MGMT_DBG, "Host " + "status %x received, returning HARDWARE ERROR " + "instead (cmd %p)", cmd->host_status, cmd); scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); } @@ -4043,9 +4043,7 @@ void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd, TRACE_ENTRY(); - TRACE((mcmd && mcmd->fn == SCST_ABORT_TASK) - ? TRACE_MGMT_MINOR : TRACE_MGMT, - "Aborting cmd %p (tag %llu, op %x)", + TRACE(TRACE_MGMT, "Aborting cmd %p (tag %llu, op %x)", cmd, (long long unsigned int)cmd->tag, cmd->cdb[0]); /* To protect from concurrent aborts */ @@ -4336,6 +4334,7 @@ static int scst_clear_task_set(struct scst_mgmt_cmd *mcmd) TRACE(TRACE_MGMT, "Clearing task set (lun=%lld, mcmd=%p)", (long long unsigned int)mcmd->lun, mcmd); +#if 0 /* we are SAM-3 */ /* * When a logical unit is aborting one or more tasks from a SCSI * initiator port with the TASK ABORTED status it should complete all @@ -4346,6 +4345,7 @@ static int scst_clear_task_set(struct scst_mgmt_cmd *mcmd) spin_lock_bh(&dev->dev_lock); __scst_block_dev(dev); spin_unlock_bh(&dev->dev_lock); +#endif __scst_abort_task_set(mcmd, mcmd->mcmd_tgt_dev); @@ -4424,7 +4424,7 @@ static int scst_mgmt_cmd_init(struct scst_mgmt_cmd *mcmd) spin_lock_irq(&sess->sess_list_lock); cmd = __scst_find_cmd_by_tag(sess, mcmd->tag); if (cmd == NULL) { - TRACE(TRACE_MGMT_MINOR, "ABORT TASK failed: command " + TRACE_MGMT_DBG("ABORT TASK: command " "for tag %llu not found", (long long unsigned int)mcmd->tag); mcmd->status = SCST_MGMT_STATUS_TASK_NOT_EXIST; @@ -4698,10 +4698,10 @@ static int scst_abort_all_nexus_loss_sess(struct scst_mgmt_cmd *mcmd, TRACE_ENTRY(); if (nexus_loss) { - TRACE(TRACE_MGMT_MINOR, "Nexus loss for sess %p (mcmd %p)", + TRACE_MGMT_DBG("Nexus loss for sess %p (mcmd %p)", sess, mcmd); } else { - TRACE(TRACE_MGMT_MINOR, "Aborting all from sess %p (mcmd %p)", + TRACE_MGMT_DBG("Aborting all from sess %p (mcmd %p)", sess, mcmd); } @@ -4772,10 +4772,10 @@ static int scst_abort_all_nexus_loss_tgt(struct scst_mgmt_cmd *mcmd, TRACE_ENTRY(); if (nexus_loss) { - TRACE(TRACE_MGMT_MINOR, "I_T Nexus loss (tgt %p, mcmd %p)", + TRACE_MGMT_DBG("I_T Nexus loss (tgt %p, mcmd %p)", tgt, mcmd); } else { - TRACE(TRACE_MGMT_MINOR, "Aborting all from tgt %p (mcmd %p)", + TRACE_MGMT_DBG("Aborting all from tgt %p (mcmd %p)", tgt, mcmd); } @@ -4946,8 +4946,8 @@ static void scst_mgmt_cmd_send_done(struct scst_mgmt_cmd *mcmd) if (scst_is_strict_mgmt_fn(mcmd->fn) && (mcmd->completed_cmd_count > 0)) mcmd->status = SCST_MGMT_STATUS_TASK_NOT_EXIST; - TRACE(TRACE_MGMT_MINOR, "TM command fn %d finished, status %x", - mcmd->fn, mcmd->status); + TRACE(TRACE_MINOR_AND_MGMT_DBG, "TM command fn %d finished, " + "status %x", mcmd->fn, mcmd->status); if (!mcmd->affected_cmds_done_called) { /* It might happen in case of errors */ @@ -5262,8 +5262,7 @@ int scst_rx_mgmt_fn(struct scst_session *sess, mcmd->cmd_sn_set = params->cmd_sn_set; mcmd->cmd_sn = params->cmd_sn; - TRACE((params->fn == SCST_ABORT_TASK) ? TRACE_MGMT_MINOR : TRACE_MGMT, - "TM fn %d", params->fn); + TRACE(TRACE_MGMT, "TM fn %d", params->fn); TRACE_MGMT_DBG("sess=%p, tag_set %d, tag %lld, lun_set %d, " "lun=%lld, cmd_sn_set %d, cmd_sn %d, priv %p", sess, diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 1a8384727..7c9935a3d 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -57,12 +57,12 @@ #ifdef CONFIG_SCST_DEBUG #define SCST_LOCAL_DEFAULT_LOG_FLAGS (TRACE_FUNCTION | TRACE_PID | \ - TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_MINOR | \ - TRACE_MGMT_DEBUG | TRACE_MINOR | TRACE_SPECIAL) + TRACE_OUT_OF_MEM | TRACE_MGMT | TRACE_MGMT_DEBUG | \ + TRACE_MINOR | TRACE_SPECIAL) #else # ifdef CONFIG_SCST_TRACING #define SCST_LOCAL_DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ - TRACE_MINOR | TRACE_SPECIAL) + TRACE_SPECIAL) # endif #endif diff --git a/usr/fileio/common.c b/usr/fileio/common.c index 4597e26dd..07c1b90e5 100644 --- a/usr/fileio/common.c +++ b/usr/fileio/common.c @@ -645,9 +645,8 @@ static int do_tm(struct vdisk_cmd *vcmd) TRACE_ENTRY(); - TRACE((cmd->tm_cmd.fn == SCST_ABORT_TASK) ? TRACE_MGMT_MINOR : TRACE_MGMT, - "TM fn %d (sess_h %"PRIx64", cmd_h_to_abort %d)", cmd->tm_cmd.fn, - cmd->tm_cmd.sess_h, cmd->tm_cmd.cmd_h_to_abort); + TRACE(TRACE_MGMT, "TM fn %d (sess_h %"PRIx64", cmd_h_to_abort %d)", + cmd->tm_cmd.fn, cmd->tm_cmd.sess_h, cmd->tm_cmd.cmd_h_to_abort); memset(reply, 0, sizeof(*reply)); reply->cmd_h = cmd->cmd_h; diff --git a/usr/fileio/debug.h b/usr/fileio/debug.h index eb629ae18..605c22b63 100644 --- a/usr/fileio/debug.h +++ b/usr/fileio/debug.h @@ -48,12 +48,11 @@ extern pid_t gettid(void); #define TRACE_OUT_OF_MEM 0x00000100 #define TRACE_MINOR 0x00000200 /* less important events */ #define TRACE_MGMT 0x00000400 -#define TRACE_MGMT_MINOR 0x00000800 -#define TRACE_MGMT_DEBUG 0x00001000 -#define TRACE_SCSI 0x00002000 -#define TRACE_SPECIAL 0x00004000 /* filtering debug, etc */ -#define TRACE_TIME 0x00008000 -#define TRACE_ORDER 0x00010000 +#define TRACE_MGMT_DEBUG 0x00000800 +#define TRACE_SCSI 0x00001000 +#define TRACE_SPECIAL 0x00002000 /* filtering debug, etc */ +#define TRACE_TIME 0x00004000 +#define TRACE_ORDER 0x00008000 #define TRACE_ALL 0xffffffff #define PRINT(format, args...) fprintf(stdout, format "\n", ## args); diff --git a/usr/fileio/fileio.c b/usr/fileio/fileio.c index e5c10825f..75d0215d8 100644 --- a/usr/fileio/fileio.c +++ b/usr/fileio/fileio.c @@ -47,15 +47,15 @@ char *app_name; ~TRACE_SCSI & ~TRACE_SCSI_SERIALIZING & ~TRACE_DEBUG) */ #define DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_PID | \ - TRACE_FUNCTION | TRACE_SPECIAL | TRACE_MGMT | TRACE_MGMT_MINOR | \ - TRACE_MGMT_DEBUG | TRACE_TIME) + TRACE_FUNCTION | TRACE_SPECIAL | TRACE_MGMT | TRACE_MGMT_DEBUG | \ + TRACE_TIME) #define TRACE_SN(args...) TRACE(TRACE_SCSI_SERIALIZING, args) #else /* DEBUG */ # ifdef TRACING -#define DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MINOR | TRACE_MGMT | \ +#define DEFAULT_LOG_FLAGS (TRACE_OUT_OF_MEM | TRACE_MGMT | \ TRACE_TIME | TRACE_SPECIAL) # else #define DEFAULT_LOG_FLAGS 0