From: <vl...@us...> - 2008-04-10 11:57:31
|
Revision: 333 http://scst.svn.sourceforge.net/scst/?rev=333&view=rev Author: vlnb Date: 2008-04-10 03:57:30 -0700 (Thu, 10 Apr 2008) Log Message: ----------- Critical fix: - Fixes hang on HEAD OF QUEUE commands under high load Modified Paths: -------------- trunk/scst/include/scsi_tgt.h trunk/scst/src/scst_lib.c trunk/scst/src/scst_targ.c Modified: trunk/scst/include/scsi_tgt.h =================================================================== --- trunk/scst/include/scsi_tgt.h 2008-04-08 09:11:10 UTC (rev 332) +++ trunk/scst/include/scsi_tgt.h 2008-04-10 10:57:30 UTC (rev 333) @@ -1082,9 +1082,12 @@ */ unsigned int preprocessing_only:1; - /* Set if scst_cmd_set_sn() was called */ + /* Set if cmd's SN was set */ unsigned int sn_set:1; + /* Set if hq_cmd_count was incremented */ + unsigned int hq_cmd_inced:1; + /* * Set if scst_cmd_init_stage1_done() called and the target wants * that the SN for the cmd won't be assigned until scst_restart_cmd() Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-04-08 09:11:10 UTC (rev 332) +++ trunk/scst/src/scst_lib.c 2008-04-10 10:57:30 UTC (rev 333) @@ -3045,6 +3045,9 @@ TRACE_ENTRY(); + if (!cmd->hq_cmd_inced) + goto out; + spin_lock_irq(&tgt_dev->sn_lock); tgt_dev->hq_cmd_count--; spin_unlock_irq(&tgt_dev->sn_lock); @@ -3059,6 +3062,7 @@ if (tgt_dev->hq_cmd_count == 0) scst_make_deferred_commands_active(tgt_dev, cmd); +out: TRACE_EXIT(); return; } Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-04-08 09:11:10 UTC (rev 332) +++ trunk/scst/src/scst_targ.c 2008-04-10 10:57:30 UTC (rev 333) @@ -2725,11 +2725,15 @@ struct scst_tgt_dev *tgt_dev = cmd->tgt_dev; unsigned long flags; + TRACE_ENTRY(); + if (scst_is_implicit_hq(cmd)) { TRACE(TRACE_SCSI|TRACE_SCSI_SERIALIZING, "Implicit HQ cmd %p", cmd); cmd->queue_type = SCST_CMD_QUEUE_HEAD_OF_QUEUE; } + EXTRACHECKS_BUG_ON(cmd->sn_set || cmd->hq_cmd_inced); + /* Optimized for lockless fast path */ scst_check_debug_sn(cmd); @@ -2817,6 +2821,7 @@ spin_lock_irqsave(&tgt_dev->sn_lock, flags); tgt_dev->hq_cmd_count++; spin_unlock_irqrestore(&tgt_dev->sn_lock, flags); + cmd->hq_cmd_inced = 1; goto out; default: @@ -2833,6 +2838,7 @@ cmd->sn_set = 1; out: + TRACE_EXIT(); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |