From aac4e05c2320c183ca482941d65984176bcf3a0b Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 28 Jul 2009 09:29:12 +0000 Subject: [PATCH] Patch from Gal Rosen : 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: http://svn.code.sf.net/p/scst/svn/trunk@984 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla2x00-target/qla2x00t.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 1e87f2bb0..87ecb8d9f 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -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;