Patch from Gal Rosen <galr@storwize.com>:
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 28 Jul 2009 09:29:12 +0000 (09:29 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 28 Jul 2009 09:29:12 +0000 (09:29 +0000)
I suggest the attached patch for the issue of disabling target mode
while I/O.

Fix BUG in qla target. Set ha->tgt to NULL in wrong place (when
disabling target mode). This cause to unfinished commands, and the echo
command to disabling the target mode to stuck. scst_tgt_cmd_done never
called because the ha->tgt was set to NULL before it should be. ha->tgt
already set to NULL in q2t_target_release after all task managements
finished and all commands were cleaned, so the fix just remove the set
from q2t_host_action.

git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@984 d57e44dd-8a1f-0410-8b47-8ef2f437770f

qla2x00t/qla2x00-target/qla2x00t.c

index 1e87f2b..87ecb8d 100644 (file)
@@ -2195,7 +2195,6 @@ static void q2t_host_action(scsi_qla_host_t *ha,
                }
 
                tgt = ha->tgt;
-               ha->tgt = NULL; /* ensure no one gets in behind us */
                spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
                mutex_unlock(&qla_mgmt_mutex);
@@ -2205,7 +2204,8 @@ static void q2t_host_action(scsi_qla_host_t *ha,
                scst_unregister(tgt->scst_tgt);
                /*
                 * Free of tgt happens via callback q2t_target_release
-                * called from scst_unregister, so we shouldn't touch it again
+                * called from scst_unregister, so it might be dead here!
+                * Let's clear it just in case.
                 */
                tgt = NULL;
                break;