From: <vl...@us...> - 2008-09-30 18:15:24
|
Revision: 506 http://scst.svn.sourceforge.net/scst/?rev=506&view=rev Author: vlnb Date: 2008-09-30 18:15:06 +0000 (Tue, 30 Sep 2008) Log Message: ----------- VERIFY commands that comes with BYTCHK unset (i.e. no data to write) shouldn't fail Signed-off-by: Gal Rosen <ga...@st...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-09-30 17:29:31 UTC (rev 505) +++ trunk/scst/src/scst_targ.c 2008-09-30 18:15:06 UTC (rev 506) @@ -528,7 +528,11 @@ if (((cmd->expected_data_direction != SCST_DATA_NONE) || (cmd->bufflen != 0)) && /* Crazy VMware people sometimes do TUR with READ direction */ - !(cmd->cdb[0] == TEST_UNIT_READY)) { + (!(cmd->cdb[0] == TEST_UNIT_READY) && + /* VERIFY commands with BYTCHK unset shouldn't fail here */ + !(((cmd->cdb[0] == VERIFY) || (cmd->cdb[0] == VERIFY_6) || + (cmd->cdb[0] == VERIFY_12) || (cmd->cdb[0] == VERIFY_16)) && + ((cmd->cdb[1] & BYTCHK) == 0)))) { PRINT_ERROR("Expected data direction %d for opcode " "0x%02x (handler %s, target %s) doesn't match " "decoded value %d", cmd->expected_data_direction, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2008-10-23 12:58:47
|
Revision: 533 http://scst.svn.sourceforge.net/scst/?rev=533&view=rev Author: vlnb Date: 2008-10-23 12:03:22 +0000 (Thu, 23 Oct 2008) Log Message: ----------- Replace SCSI_TRY_RESET_BUS by SCSI_TRY_RESET_TARGET, which is more appropriate for TARGET RESET TM Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-10-22 21:45:16 UTC (rev 532) +++ trunk/scst/src/scst_targ.c 2008-10-23 12:03:22 UTC (rev 533) @@ -4215,9 +4215,13 @@ list_for_each_entry(dev, &host_devs, tm_dev_list_entry) { /* dev->scsi_dev must be non-NULL here */ TRACE(TRACE_MGMT, "Resetting host %d bus ", - dev->scsi_dev->host->host_no); + dev->scsi_dev->host->host_no); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + rc = scsi_reset_provider(dev->scsi_dev, SCSI_TRY_RESET_TARGET); +#else rc = scsi_reset_provider(dev->scsi_dev, SCSI_TRY_RESET_BUS); - TRACE(TRACE_MGMT, "Result of host %d bus reset: %s", +#endif + TRACE(TRACE_MGMT, "Result of host %d target reset: %s", dev->scsi_dev->host->host_no, (rc == SUCCESS) ? "SUCCESS" : "FAILED"); #if 0 /* scsi_reset_provider() returns very weird status, so let's always succeed */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2009-08-04 17:17:22
|
Revision: 1010 http://scst.svn.sourceforge.net/scst/?rev=1010&view=rev Author: vlnb Date: 2009-08-04 17:17:16 +0000 (Tue, 04 Aug 2009) Log Message: ----------- A minor SAM violation fixed. Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2009-08-04 16:59:09 UTC (rev 1009) +++ trunk/scst/src/scst_targ.c 2009-08-04 17:17:16 UTC (rev 1010) @@ -4358,6 +4358,17 @@ TRACE(TRACE_MGMT, "Clearing task set (lun=%lld, mcmd=%p)", (long long unsigned int)mcmd->lun, mcmd); + /* + * When a logical unit is aborting one or more tasks from a SCSI + * initiator port with the TASK ABORTED status it should complete all + * of those tasks before entering additional tasks from that SCSI + * initiator port into the task set - SAM2 + */ + mcmd->needs_unblocking = 1; + spin_lock_bh(&dev->dev_lock); + __scst_block_dev(dev); + spin_unlock_bh(&dev->dev_lock); + __scst_abort_task_set(mcmd, mcmd->mcmd_tgt_dev); mutex_lock(&scst_mutex); @@ -4975,6 +4986,7 @@ if (mcmd->needs_unblocking) { switch (mcmd->fn) { case SCST_LUN_RESET: + case SCST_CLEAR_TASK_SET: scst_unblock_dev(mcmd->mcmd_tgt_dev->dev); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2009-09-03 12:09:46
|
Revision: 1071 http://scst.svn.sourceforge.net/scst/?rev=1071&view=rev Author: vlnb Date: 2009-09-03 12:09:33 +0000 (Thu, 03 Sep 2009) Log Message: ----------- The patch below fixes the spelling of a few function names. This patch has been tested by running the following command and verifying its output: scripts/run-regression-tests 2.6.30.4 Signed-off-by: Bart Van Assche <bar...@gm...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2009-09-03 11:53:48 UTC (rev 1070) +++ trunk/scst/src/scst_targ.c 2009-09-03 12:09:33 UTC (rev 1071) @@ -38,7 +38,7 @@ static void scst_finish_cmd_mgmt(struct scst_cmd *cmd); static struct scst_cmd *__scst_find_cmd_by_tag(struct scst_session *sess, uint64_t tag); -static void scst_proccess_redirect_cmd(struct scst_cmd *cmd, +static void scst_process_redirect_cmd(struct scst_cmd *cmd, enum scst_exec_context context, int check_retries); static inline void scst_schedule_tasklet(struct scst_cmd *cmd) @@ -883,7 +883,7 @@ break; } - scst_proccess_redirect_cmd(cmd, pref_context, 1); + scst_process_redirect_cmd(cmd, pref_context, 1); TRACE_EXIT(); return; @@ -998,7 +998,7 @@ } /* No locks, but might be in IRQ */ -static void scst_proccess_redirect_cmd(struct scst_cmd *cmd, +static void scst_process_redirect_cmd(struct scst_cmd *cmd, enum scst_exec_context context, int check_retries) { struct scst_tgt *tgt = cmd->tgt; @@ -1132,7 +1132,7 @@ break; } - scst_proccess_redirect_cmd(cmd, pref_context, 1); + scst_process_redirect_cmd(cmd, pref_context, 1); TRACE_EXIT(); return; @@ -1293,7 +1293,7 @@ cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; - scst_proccess_redirect_cmd(cmd, + scst_process_redirect_cmd(cmd, scst_optimize_post_exec_context(cmd, scst_estimate_context()), 0); @@ -1316,7 +1316,7 @@ cmd->state = SCST_CMD_STATE_PRE_DEV_DONE; - scst_proccess_redirect_cmd(cmd, + scst_process_redirect_cmd(cmd, scst_optimize_post_exec_context(cmd, scst_estimate_context()), 0); out: @@ -1375,7 +1375,7 @@ } #endif pref_context = scst_optimize_post_exec_context(cmd, pref_context); - scst_proccess_redirect_cmd(cmd, pref_context, 0); + scst_process_redirect_cmd(cmd, pref_context, 0); TRACE_EXIT(); return; @@ -3091,7 +3091,7 @@ cmd->cmd_hw_pending = 0; cmd->state = SCST_CMD_STATE_FINISHED; - scst_proccess_redirect_cmd(cmd, pref_context, 1); + scst_process_redirect_cmd(cmd, pref_context, 1); TRACE_EXIT(); return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2009-09-15 17:57:29
|
Revision: 1095 http://scst.svn.sourceforge.net/scst/?rev=1095&view=rev Author: vlnb Date: 2009-09-15 17:57:16 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Microcleanup to log TM functions always in decimal. Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2009-09-14 18:08:18 UTC (rev 1094) +++ trunk/scst/src/scst_targ.c 2009-09-15 17:57:16 UTC (rev 1095) @@ -5281,7 +5281,7 @@ mcmd->cmd_sn = params->cmd_sn; TRACE((params->fn == SCST_ABORT_TASK) ? TRACE_MGMT_MINOR : TRACE_MGMT, - "TM fn %x", params->fn); + "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, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2009-09-18 10:30:23
|
Revision: 1112 http://scst.svn.sourceforge.net/scst/?rev=1112&view=rev Author: vlnb Date: 2009-09-18 10:30:15 +0000 (Fri, 18 Sep 2009) Log Message: ----------- Microcosmetics Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2009-09-18 10:25:33 UTC (rev 1111) +++ trunk/scst/src/scst_targ.c 2009-09-18 10:30:15 UTC (rev 1112) @@ -5163,7 +5163,7 @@ mcmd = scst_alloc_mgmt_cmd(atomic ? GFP_ATOMIC : GFP_KERNEL); if (mcmd == NULL) { - PRINT_CRIT_ERROR("Lost TM fn %x, initiator %s", fn, + PRINT_CRIT_ERROR("Lost TM fn %d, initiator %s", fn, sess->initiator_name); goto out; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2009-12-16 19:24:52
|
Revision: 1400 http://scst.svn.sourceforge.net/scst/?rev=1400&view=rev Author: vlnb Date: 2009-12-16 19:24:42 +0000 (Wed, 16 Dec 2009) Log Message: ----------- Fix incorrect initialization of scst_mgmt_cmd_stub structure Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2009-12-16 19:21:41 UTC (rev 1399) +++ trunk/scst/src/scst_targ.c 2009-12-16 19:24:42 UTC (rev 1400) @@ -4091,7 +4091,7 @@ "stub failed (mcmd %p, cmd %p)", mcmd, cmd); goto unlock; } - memset(mstb, 0, sizeof(mstb)); + memset(mstb, 0, sizeof(*mstb)); mstb->mcmd = mcmd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2010-10-02 09:47:46
|
Revision: 2330 http://scst.svn.sourceforge.net/scst/?rev=2330&view=rev Author: bvassche Date: 2010-10-02 09:47:40 +0000 (Sat, 02 Oct 2010) Log Message: ----------- Fixed a spelling error. Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2010-10-02 07:28:10 UTC (rev 2329) +++ trunk/scst/src/scst_targ.c 2010-10-02 09:47:40 UTC (rev 2330) @@ -3581,7 +3581,7 @@ * Notifies SCST that the driver sent the response and the command * can be freed now. Don't forget to set the delivery status, if it * isn't success, using scst_set_delivery_status() before calling - * this function. The third argument sets preferred command execition + * this function. The third argument sets preferred command execution * context (see SCST_CONTEXT_* constants for details) */ void scst_tgt_cmd_done(struct scst_cmd *cmd, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2010-11-26 20:53:39
|
Revision: 2843 http://scst.svn.sourceforge.net/scst/?rev=2843&view=rev Author: vlnb Date: 2010-11-26 20:53:33 +0000 (Fri, 26 Nov 2010) Log Message: ----------- Minor improvement Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2010-11-26 15:58:54 UTC (rev 2842) +++ trunk/scst/src/scst_targ.c 2010-11-26 20:53:33 UTC (rev 2843) @@ -2510,14 +2510,13 @@ #endif if (unlikely(rc != 0)) { PRINT_ERROR("scst pass-through exec failed: %x", rc); - if ((int)rc == -EINVAL) - PRINT_ERROR("Do you have too low max_sectors on your " - "backend hardware? For success bufflen " - "must be <= max_sectors (bufflen %db, " - "max_sectors %d sectors, CDB %x). See README " - "for more details.", cmd->bufflen, + if (((int)rc == -EINVAL) && + (cmd->bufflen > queue_max_hw_sectors(scsi_dev->request_queue))) + PRINT_ERROR("Too low max_hw_sectors %d sectors on %s " + "to serve command %x with bufflen %db." + "See README for more details.", queue_max_hw_sectors(scsi_dev->request_queue), - cmd->cdb[0]); + dev->virt_name, cmd->cdb[0], cmd->bufflen); goto out_error; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2010-12-20 18:28:03
|
Revision: 3151 http://scst.svn.sourceforge.net/scst/?rev=3151&view=rev Author: vlnb Date: 2010-12-20 18:27:57 +0000 (Mon, 20 Dec 2010) Log Message: ----------- Cleanup: eliminate a superfluous cast and unnest an if-statement Signed-off-by: Bart Van Assche <bva...@ac...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2010-12-20 18:25:07 UTC (rev 3150) +++ trunk/scst/src/scst_targ.c 2010-12-20 18:27:57 UTC (rev 3151) @@ -4149,7 +4149,7 @@ int scst_cmd_thread(void *arg) { - struct scst_cmd_threads *p_cmd_threads = (struct scst_cmd_threads *)arg; + struct scst_cmd_threads *p_cmd_threads = arg; static DEFINE_MUTEX(io_context_mutex); TRACE_ENTRY(); @@ -4230,10 +4230,9 @@ EXTRACHECKS_BUG_ON((p_cmd_threads->nr_threads == 1) && !list_empty(&p_cmd_threads->active_cmd_list)); - if (p_cmd_threads != &scst_main_cmd_threads) { - if (p_cmd_threads->nr_threads == 1) - p_cmd_threads->io_context = NULL; - } + if ((p_cmd_threads != &scst_main_cmd_threads) && + (p_cmd_threads->nr_threads == 1)) + p_cmd_threads->io_context = NULL; PRINT_INFO("Processing thread %s (PID %d) finished", current->comm, current->pid); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2011-01-13 12:49:39
|
Revision: 3213 http://scst.svn.sourceforge.net/scst/?rev=3213&view=rev Author: vlnb Date: 2011-01-13 12:49:33 +0000 (Thu, 13 Jan 2011) Log Message: ----------- Now scst_pre_parse() called in __scst_init_cmd(), so there's no point to call scst_get_cdb_info() once again Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2011-01-13 12:47:36 UTC (rev 3212) +++ trunk/scst/src/scst_targ.c 2011-01-13 12:49:33 UTC (rev 3213) @@ -179,7 +179,6 @@ EXTRACHECKS_BUG_ON(*context == SCST_CONTEXT_SAME); #ifdef CONFIG_SCST_TEST_IO_IN_SIRQ - scst_get_cdb_info(cmd); if (cmd->op_flags & SCST_TEST_IO_IN_SIRQ_ALLOWED) goto out; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2011-01-18 14:06:02
|
Revision: 3228 http://scst.svn.sourceforge.net/scst/?rev=3228&view=rev Author: vlnb Date: 2011-01-18 14:05:56 +0000 (Tue, 18 Jan 2011) Log Message: ----------- Call of scst_nexus_loss() here is wrong and not needed, because it will be called later in scst_mgmt_affected_cmds_done() Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2011-01-17 12:44:34 UTC (rev 3227) +++ trunk/scst/src/scst_targ.c 2011-01-18 14:05:56 UTC (rev 3228) @@ -5390,9 +5390,6 @@ __scst_abort_task_set(mcmd, tgt_dev); - if (nexus_loss) - scst_nexus_loss(tgt_dev, true); - if (mcmd->sess == tgt_dev->sess) { rc = scst_call_dev_task_mgmt_fn( mcmd, tgt_dev, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2011-03-09 20:21:27
|
Revision: 3272 http://scst.svn.sourceforge.net/scst/?rev=3272&view=rev Author: vlnb Date: 2011-03-09 20:21:18 +0000 (Wed, 09 Mar 2011) Log Message: ----------- Put comments on the places where they supposed to be. Noticed by Alexey Obitotskiy <ale...@op...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2011-03-09 20:17:06 UTC (rev 3271) +++ trunk/scst/src/scst_targ.c 2011-03-09 20:21:18 UTC (rev 3272) @@ -2025,20 +2025,7 @@ goto out; } -/** - * scst_check_local_events() - check if there are any local SCSI events - * - * Description: - * Checks if the command can be executed or there are local events, - * like reservations, pending UAs, etc. Returns < 0 if command must be - * aborted, > 0 if there is an event and command should be immediately - * completed, or 0 otherwise. - * - * !! Dev handlers implementing exec() callback must call this function there - * !! just before the actual command's execution! - * - * On call no locks, no IRQ or IRQ-disabled context allowed. - */ +/* No locks, no IRQ or IRQ-disabled context allowed */ static int scst_persistent_reserve_in_local(struct scst_cmd *cmd) { int rc; @@ -2305,7 +2292,20 @@ return res; } -/* No locks, no IRQ or IRQ-disabled context allowed */ +/** + * scst_check_local_events() - check if there are any local SCSI events + * + * Description: + * Checks if the command can be executed or there are local events, + * like reservations, pending UAs, etc. Returns < 0 if command must be + * aborted, > 0 if there is an event and command should be immediately + * completed, or 0 otherwise. + * + * !! Dev handlers implementing exec() callback must call this function there + * !! just before the actual command's execution! + * + * On call no locks, no IRQ or IRQ-disabled context allowed. + */ int scst_check_local_events(struct scst_cmd *cmd) { int res, rc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2011-07-07 19:58:16
|
Revision: 3663 http://scst.svn.sourceforge.net/scst/?rev=3663&view=rev Author: vlnb Date: 2011-07-07 19:58:11 +0000 (Thu, 07 Jul 2011) Log Message: ----------- Let's print initiator and target names for not found LUNs to simplify diagnostics Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2011-07-07 19:56:26 UTC (rev 3662) +++ trunk/scst/src/scst_targ.c 2011-07-07 19:58:11 UTC (rev 3663) @@ -3850,8 +3850,9 @@ if (res != 0) { TRACE(TRACE_MINOR, "tgt_dev for LUN %lld not found, command to " - "unexisting LU?", - (long long unsigned int)cmd->lun); + "unexisting LU (initiator %s, target %s)?", + (long long unsigned int)cmd->lun, + cmd->sess->initiator_name, cmd->tgt->tgt_name); scst_put(cmd->cpu_cmd_counter); } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2012-03-27 01:49:16
|
Revision: 4173 http://scst.svn.sourceforge.net/scst/?rev=4173&view=rev Author: vlnb Date: 2012-03-27 01:49:10 +0000 (Tue, 27 Mar 2012) Log Message: ----------- scst: Introduce scst_find_free_slot() This patch fixes some occurrences of the following 3.3 checkpatch warning: WARNING: Too many leading tabs - consider code refactoring Signed-off-by: Bart Van Assche <bva...@ac...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2012-03-27 01:46:51 UTC (rev 4172) +++ trunk/scst/src/scst_targ.c 2012-03-27 01:49:10 UTC (rev 4173) @@ -3575,6 +3575,30 @@ goto out; } +static void scst_find_free_slot(struct scst_order_data *order_data) +{ + int i = 0; + + /* + * Commands can finish in any order, so we don't know which slot is + * empty. + */ + while (1) { + order_data->cur_sn_slot++; + if (order_data->cur_sn_slot == + order_data->sn_slots + ARRAY_SIZE(order_data->sn_slots)) + order_data->cur_sn_slot = order_data->sn_slots; + + if (atomic_read(order_data->cur_sn_slot) == 0) + break; + + i++; + sBUG_ON(i == ARRAY_SIZE(order_data->sn_slots)); + } + TRACE_SN("New cur SN slot %zd", + order_data->cur_sn_slot - order_data->sn_slots); +} + /** * scst_tgt_cmd_done() - the command's processing done * @cmd: SCST command @@ -3736,27 +3760,8 @@ spin_lock_irqsave(&order_data->sn_lock, flags); if (order_data->num_free_sn_slots >= 0) { order_data->num_free_sn_slots--; - if (order_data->num_free_sn_slots >= 0) { - int i = 0; - /* Commands can finish in any order, so - * we don't know which slot is empty. - */ - while (1) { - order_data->cur_sn_slot++; - if (order_data->cur_sn_slot == - order_data->sn_slots + ARRAY_SIZE(order_data->sn_slots)) - order_data->cur_sn_slot = order_data->sn_slots; - - if (atomic_read(order_data->cur_sn_slot) == 0) - break; - - i++; - sBUG_ON(i == ARRAY_SIZE(order_data->sn_slots)); - } - TRACE_SN("New cur SN slot %zd", - order_data->cur_sn_slot - - order_data->sn_slots); - } + if (order_data->num_free_sn_slots >= 0) + scst_find_free_slot(order_data); } spin_unlock_irqrestore(&order_data->sn_lock, flags); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2012-04-26 18:41:21
|
Revision: 4238 http://scst.svn.sourceforge.net/scst/?rev=4238&view=rev Author: vlnb Date: 2012-04-26 18:41:14 +0000 (Thu, 26 Apr 2012) Log Message: ----------- Fix incorrect state check in the debug trap reported by Bart Van Assche <bva...@ac...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2012-04-26 12:50:50 UTC (rev 4237) +++ trunk/scst/src/scst_targ.c 2012-04-26 18:41:14 UTC (rev 4238) @@ -882,16 +882,18 @@ #ifdef CONFIG_SCST_EXTRACHECKS /* * At this point either data_len must be initialized, or cmd - * completed (with an error). + * completed (with an error) and correct state set. */ if (unlikely((cmd->data_len == SCST_DEF_DATA_LEN)) && - (!cmd->completed || ((cmd->state <= SCST_CMD_STATE_REAL_EXEC) && - (cmd->state != SCST_CMD_STATE_PREPROCESSING_DONE)))) { + (!cmd->completed || + (((cmd->state <= SCST_CMD_STATE_PRE_XMIT_RESP) || + (cmd->state >= SCST_CMD_STATE_LAST_ACTIVE)) && + (cmd->state != SCST_CMD_STATE_PREPROCESSING_DONE)))) { PRINT_CRIT_ERROR("Not initialized data_len for going to " - "execute command (cmd %p, data_len %d, completed %d, " - "state %d)", cmd, cmd->data_len, cmd->completed, - cmd->state); - WARN_ON(1); + "execute command or bad state (cmd %p, data_len %d, " + "completed %d, state %d)", cmd, cmd->data_len, + cmd->completed, cmd->state); + sBUG(); goto out_hw_error; } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2012-04-26 19:44:31
|
Revision: 4239 http://scst.svn.sourceforge.net/scst/?rev=4239&view=rev Author: vlnb Date: 2012-04-26 19:44:25 +0000 (Thu, 26 Apr 2012) Log Message: ----------- Complete the previous fix Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2012-04-26 18:41:14 UTC (rev 4238) +++ trunk/scst/src/scst_targ.c 2012-04-26 19:44:25 UTC (rev 4239) @@ -886,7 +886,7 @@ */ if (unlikely((cmd->data_len == SCST_DEF_DATA_LEN)) && (!cmd->completed || - (((cmd->state <= SCST_CMD_STATE_PRE_XMIT_RESP) || + (((cmd->state < SCST_CMD_STATE_PRE_XMIT_RESP) || (cmd->state >= SCST_CMD_STATE_LAST_ACTIVE)) && (cmd->state != SCST_CMD_STATE_PREPROCESSING_DONE)))) { PRINT_CRIT_ERROR("Not initialized data_len for going to " @@ -894,7 +894,6 @@ "completed %d, state %d)", cmd, cmd->data_len, cmd->completed, cmd->state); sBUG(); - goto out_hw_error; } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2012-04-30 19:41:26
|
Revision: 4254 http://scst.svn.sourceforge.net/scst/?rev=4254&view=rev Author: vlnb Date: 2012-04-30 19:41:18 +0000 (Mon, 30 Apr 2012) Log Message: ----------- scst: Move ioctx manipulation code Move the code for obtaining and releasing an I/O context out of scst_process_active_cmd() in order to improve source code readability. Signed-off-by: Bart Van Assche <bva...@ac...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2012-04-30 19:32:30 UTC (rev 4253) +++ trunk/scst/src/scst_targ.c 2012-04-30 19:41:18 UTC (rev 4254) @@ -4099,6 +4099,79 @@ } /** + * scst_ioctx_get() - Associate an I/O context with a thread. + * + * Associate an I/O context with a thread in such a way that all threads in an + * SCST thread pool share the same I/O context. This greatly improves thread + * pool I/O performance with at least the CFQ scheduler. + * + * Note: A more elegant approach would be to allocate the I/O context in + * scst_init_threads() instead of this function. That approach is only possible + * though after exporting alloc_io_context(). A previous discussion of this + * topic can be found here: http://lkml.org/lkml/2008/12/11/282. + */ +static void scst_ioctx_get(struct scst_cmd_threads *p_cmd_threads) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) + mutex_lock(&p_cmd_threads->io_context_mutex); + + WARN_ON(current->io_context); + + if (p_cmd_threads != &scst_main_cmd_threads) { + /* + * For linked IO contexts io_context might be not NULL while + * io_context 0. + */ + if (p_cmd_threads->io_context == NULL) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) + p_cmd_threads->io_context = get_task_io_context(current, + GFP_KERNEL, NUMA_NO_NODE); +#else + p_cmd_threads->io_context = get_io_context(GFP_KERNEL, -1); +#endif + TRACE_MGMT_DBG("Alloced new IO context %p " + "(p_cmd_threads %p)", p_cmd_threads->io_context, + p_cmd_threads); + /* + * Put the extra reference created by get_io_context() + * because we don't need it. + */ + put_io_context(p_cmd_threads->io_context); + } else { + current->io_context = + ioc_task_link(p_cmd_threads->io_context); + TRACE_MGMT_DBG("Linked IO context %p " + "(p_cmd_threads %p)", p_cmd_threads->io_context, + p_cmd_threads); + } + p_cmd_threads->io_context_refcnt++; + } + + mutex_unlock(&p_cmd_threads->io_context_mutex); +#endif + + smp_wmb(); + p_cmd_threads->io_context_ready = true; + return; +} + +/** + * scst_ioctx_put() - Free I/O context allocated by scst_ioctx_get(). + */ +static void scst_ioctx_put(struct scst_cmd_threads *p_cmd_threads) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) + if (p_cmd_threads != &scst_main_cmd_threads) { + mutex_lock(&p_cmd_threads->io_context_mutex); + if (--p_cmd_threads->io_context_refcnt == 0) + p_cmd_threads->io_context = NULL; + mutex_unlock(&p_cmd_threads->io_context_mutex); + } +#endif + return; +} + +/** * scst_process_active_cmd() - process active command * * Description: @@ -4320,47 +4393,8 @@ #endif current->flags |= PF_NOFREEZE; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) - mutex_lock(&p_cmd_threads->io_context_mutex); + scst_ioctx_get(p_cmd_threads); - WARN_ON(current->io_context); - - if (p_cmd_threads != &scst_main_cmd_threads) { - /* - * For linked IO contexts io_context might be not NULL while - * io_context 0. - */ - if (p_cmd_threads->io_context == NULL) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) - p_cmd_threads->io_context = get_task_io_context(current, - GFP_KERNEL, NUMA_NO_NODE); -#else - p_cmd_threads->io_context = get_io_context(GFP_KERNEL, -1); -#endif - TRACE_MGMT_DBG("Alloced new IO context %p " - "(p_cmd_threads %p)", - p_cmd_threads->io_context, - p_cmd_threads); - /* - * Put the extra reference created by get_io_context() - * because we don't need it. - */ - put_io_context(p_cmd_threads->io_context); - } else { - current->io_context = ioc_task_link(p_cmd_threads->io_context); - TRACE_MGMT_DBG("Linked IO context %p " - "(p_cmd_threads %p)", p_cmd_threads->io_context, - p_cmd_threads); - } - p_cmd_threads->io_context_refcnt++; - } - - mutex_unlock(&p_cmd_threads->io_context_mutex); -#endif - - smp_wmb(); - p_cmd_threads->io_context_ready = true; - spin_lock_irq(&p_cmd_threads->cmd_list_lock); while (!kthread_should_stop()) { wait_event_locked(p_cmd_threads->cmd_list_waitQ, @@ -4378,14 +4412,7 @@ } spin_unlock_irq(&p_cmd_threads->cmd_list_lock); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) - if (p_cmd_threads != &scst_main_cmd_threads) { - mutex_lock(&p_cmd_threads->io_context_mutex); - if (--p_cmd_threads->io_context_refcnt == 0) - p_cmd_threads->io_context = NULL; - mutex_unlock(&p_cmd_threads->io_context_mutex); - } -#endif + scst_ioctx_put(p_cmd_threads); PRINT_INFO("Processing thread %s (PID %d) finished", current->comm, current->pid); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2012-05-01 06:39:44
|
Revision: 4257 http://scst.svn.sourceforge.net/scst/?rev=4257&view=rev Author: bvassche Date: 2012-05-01 06:39:37 +0000 (Tue, 01 May 2012) Log Message: ----------- scst: Fix a checkpatch complaint about whitespace "ERROR: code indent should use tabs where possible" Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2012-04-30 20:50:08 UTC (rev 4256) +++ trunk/scst/src/scst_targ.c 2012-05-01 06:39:37 UTC (rev 4257) @@ -889,8 +889,8 @@ (cmd->data_len == SCST_DEF_LBA_DATA_LEN)) && (!cmd->completed || (((cmd->state < SCST_CMD_STATE_PRE_XMIT_RESP) || - (cmd->state >= SCST_CMD_STATE_LAST_ACTIVE)) && - (cmd->state != SCST_CMD_STATE_PREPROCESSING_DONE))))) { + (cmd->state >= SCST_CMD_STATE_LAST_ACTIVE)) && + (cmd->state != SCST_CMD_STATE_PREPROCESSING_DONE))))) { PRINT_CRIT_ERROR("Not initialized data_len for going to " "execute command or bad state (cmd %p, data_len %d, " "completed %d, state %d)", cmd, cmd->data_len, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2012-05-31 02:35:29
|
Revision: 4329 http://scst.svn.sourceforge.net/scst/?rev=4329&view=rev Author: vlnb Date: 2012-05-31 02:35:22 +0000 (Thu, 31 May 2012) Log Message: ----------- Correct NACA not supported sense to be as requested by SAM Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2012-05-30 14:37:51 UTC (rev 4328) +++ trunk/scst/src/scst_targ.c 2012-05-31 02:35:22 UTC (rev 4329) @@ -686,7 +686,7 @@ PRINT_ERROR("NACA bit in control byte CDB is not supported " "(opcode 0x%02x)", cmd->cdb[0]); scst_set_cmd_error(cmd, - SCST_LOAD_SENSE(scst_sense_invalid_field_in_cdb)); + SCST_LOAD_SENSE(scst_sense_invalid_message)); goto out_done; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2012-08-27 21:10:15
|
Revision: 4482 http://scst.svn.sourceforge.net/scst/?rev=4482&view=rev Author: vlnb Date: 2012-08-27 21:10:09 +0000 (Mon, 27 Aug 2012) Log Message: ----------- scst: Add a comment in scst_global_mgmt_thread() Signed-off-by: Bart Van Assche <bva...@ac...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2012-08-27 20:42:58 UTC (rev 4481) +++ trunk/scst/src/scst_targ.c 2012-08-27 21:10:09 UTC (rev 4482) @@ -6821,9 +6821,14 @@ list_del(&sess->sess_init_list_entry); spin_unlock_irq(&scst_mgmt_lock); - if (sess->init_phase == SCST_SESS_IPH_INITING) + if (sess->init_phase == SCST_SESS_IPH_INITING) { + /* + * Note: it's not necessary to free the session + * here if initialization fails. See also the + * comment block above scst_register_session(). + */ scst_init_session(sess); - else { + } else { PRINT_CRIT_ERROR("session %p is in " "scst_sess_init_list, but in unknown " "init phase %x", sess, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2012-08-27 21:58:55
|
Revision: 4488 http://scst.svn.sourceforge.net/scst/?rev=4488&view=rev Author: vlnb Date: 2012-08-27 21:58:49 +0000 (Mon, 27 Aug 2012) Log Message: ----------- scst: Avoid that smatch complains about dead code Reported by Bart Van Assche <bva...@ac...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2012-08-27 21:51:10 UTC (rev 4487) +++ trunk/scst/src/scst_targ.c 2012-08-27 21:58:49 UTC (rev 4488) @@ -4780,12 +4780,13 @@ switch (mgmt_fn) { #ifdef CONFIG_SCST_ABORT_CONSIDER_FINISHED_TASKS_AS_NOT_EXISTING case SCST_ABORT_TASK: + return 1; #endif #if 0 case SCST_ABORT_TASK_SET: case SCST_CLEAR_TASK_SET: + return 1; #endif - return 1; default: return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2013-01-05 02:54:15
|
Revision: 4682 http://scst.svn.sourceforge.net/scst/?rev=4682&view=rev Author: vlnb Date: 2013-01-05 02:54:08 +0000 (Sat, 05 Jan 2013) Log Message: ----------- Avoid that scst_abort_cmd() triggers a false positive in Coverity Signed-off-by: Bart Van Assche <bva...@ac...> Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2013-01-04 09:43:52 UTC (rev 4681) +++ trunk/scst/src/scst_targ.c 2013-01-05 02:54:08 UTC (rev 4682) @@ -4799,6 +4799,13 @@ TRACE_ENTRY(); + /* + * Help Coverity recognize that mcmd != NULL if + * call_dev_task_mgmt_fn_received == true. + */ + if (call_dev_task_mgmt_fn_received) + EXTRACHECKS_BUG_ON(!mcmd); + TRACE(TRACE_SCSI|TRACE_MGMT_DEBUG, "Aborting cmd %p (tag %llu, op %x)", cmd, (long long unsigned int)cmd->tag, cmd->cdb[0]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2013-07-27 01:12:24
|
Revision: 4923 http://sourceforge.net/p/scst/svn/4923 Author: vlnb Date: 2013-07-27 01:12:22 +0000 (Sat, 27 Jul 2013) Log Message: ----------- Cleanup: cdb_len was just checked a couple of lines above Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2013-07-27 01:11:10 UTC (rev 4922) +++ trunk/scst/src/scst_targ.c 2013-07-27 01:12:22 UTC (rev 4923) @@ -714,8 +714,6 @@ goto out_done; } - EXTRACHECKS_BUG_ON(cmd->cdb_len == 0); - if (unlikely((cmd->op_flags & SCST_UNKNOWN_LENGTH) != 0)) { if (scst_cmd_is_expected_set(cmd)) { /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vl...@us...> - 2014-02-08 01:52:06
|
Revision: 5275 http://sourceforge.net/p/scst/svn/5275 Author: vlnb Date: 2014-02-08 01:52:03 +0000 (Sat, 08 Feb 2014) Log Message: ----------- Fix spurious BUG when parse_type != SCST_USER_PARSE_STANDARD Changeset 4224 introduced EXTRACHECKS for valid lba/data_len and state at the end of the parsing phase of command processing. However, the checks do not account for deferral of parsing to userland, as occurs when SCST_USER_PARSE_CALL or SCST_USER_PARSE_EXCEPTION are specified. In such cases the checks report errors on commands that userland has not yet had an opportunity to parse. NOTE: this includes a refactoring of the EXTRACHECKS to improve clarity. The rework is not exactly equivalent to the original code, but does conform to the comments describing the original code. Specifically, the original code would not trap an illegal command state unless there was also an illegal lba or data_len. Signed-off-by: Steven J. Magnani <st...@di...> with some improvements Modified Paths: -------------- trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2014-02-08 01:04:27 UTC (rev 5274) +++ trunk/scst/src/scst_targ.c 2014-02-08 01:52:03 UTC (rev 5275) @@ -941,23 +941,34 @@ out: #ifdef CONFIG_SCST_EXTRACHECKS - /* - * At this point either both lba and data_len must be initialized to - * at least 0 for not data transfer commands, or cmd must be - * completed (with an error) and have correct state set. - */ - if (unlikely((((cmd->lba == SCST_DEF_LBA_DATA_LEN) && - !(cmd->op_flags & SCST_LBA_NOT_VALID)) || - (cmd->data_len == SCST_DEF_LBA_DATA_LEN)) && - (!cmd->completed || - (((cmd->state < SCST_CMD_STATE_PRE_XMIT_RESP) || - (cmd->state >= SCST_CMD_STATE_LAST_ACTIVE)) && - (cmd->state != SCST_CMD_STATE_PREPROCESSING_DONE))))) { - PRINT_CRIT_ERROR("Not initialized data_len for going to " - "execute command or bad state (cmd %p, data_len %lld, " - "completed %d, state %d)", cmd, - (long long)cmd->data_len, cmd->completed, cmd->state); - sBUG(); + if (unlikely(cmd->completed)) { + /* Command completed with error */ + bool valid_state = (cmd->state == SCST_CMD_STATE_PREPROCESSING_DONE) || + ((cmd->state >= SCST_CMD_STATE_PRE_XMIT_RESP) && + (cmd->state < SCST_CMD_STATE_LAST_ACTIVE)); + + if (!valid_state) { + PRINT_CRIT_ERROR("Bad state for completed cmd " + "(cmd %p, state %d)", cmd, cmd->state); + sBUG(); + } + } else if (cmd->state != SCST_CMD_STATE_PARSE) { + /* + * Ready to execute. At this point both lba and data_len must + * be initialized or marked non-applicable. + */ + bool bad_lba = (cmd->lba == SCST_DEF_LBA_DATA_LEN) && + !(cmd->op_flags & SCST_LBA_NOT_VALID); + bool bad_data_len = (cmd->data_len == SCST_DEF_LBA_DATA_LEN); + + if (unlikely(bad_lba || bad_data_len)) { + PRINT_CRIT_ERROR("Uninitialized lba or data_len for " + "ready-to-execute command (cmd %p, lba %lld, " + "data_len %lld, state %d)", cmd, + (long long)cmd->lba, (long long)cmd->data_len, + cmd->state); + sBUG(); + } } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |