diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2009-05-13 18:57:46 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-05-23 16:44:12 -0400 |
commit | 3bbaaad95fd38dedb7c66a601f14825b4e0c5a59 (patch) | |
tree | 1e149ff38906956227e41722947d48f289f2c488 /include/scsi | |
parent | 4c48a82935f833d94fcf44c2b0c5d2922acfc77a (diff) |
[SCSI] libiscsi: handle cleanup task races
bnx2i needs to send a hardware specific cleanup command if
a command has not completed normally (iscsi/scsi response from
target), and the session is still ok (this is the case when we
send a TMF to stop the command).
At this time it will need to drop the session lock. The problem
with the current code is that fail_all_commands assumes we
will hold the lock the entire time, so it uses list_for_each_entry_safe.
If while bnx2i drops the session lock multiple cmds complete then
list_for_each_entry_safe will not handle this correctly.
This patch removes the running lists and just has us loop over
the cmds array (in later patches we will then replace that
array with a block tag map at the session level). It also fixes
up the completion path so that if the TMF code and the normal recv
path were completing the same command then they both do not try
to do release the refcount taken when the task is queued.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/libiscsi.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 88d33a46efa5..facae71183a5 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -82,6 +82,7 @@ enum { | |||
82 | 82 | ||
83 | 83 | ||
84 | enum { | 84 | enum { |
85 | ISCSI_TASK_FREE, | ||
85 | ISCSI_TASK_COMPLETED, | 86 | ISCSI_TASK_COMPLETED, |
86 | ISCSI_TASK_PENDING, | 87 | ISCSI_TASK_PENDING, |
87 | ISCSI_TASK_RUNNING, | 88 | ISCSI_TASK_RUNNING, |
@@ -181,9 +182,7 @@ struct iscsi_conn { | |||
181 | 182 | ||
182 | /* xmit */ | 183 | /* xmit */ |
183 | struct list_head mgmtqueue; /* mgmt (control) xmit queue */ | 184 | struct list_head mgmtqueue; /* mgmt (control) xmit queue */ |
184 | struct list_head mgmt_run_list; /* list of control tasks */ | 185 | struct list_head cmdqueue; /* data-path cmd queue */ |
185 | struct list_head xmitqueue; /* data-path cmd queue */ | ||
186 | struct list_head run_list; /* list of cmds in progress */ | ||
187 | struct list_head requeue; /* tasks needing another run */ | 186 | struct list_head requeue; /* tasks needing another run */ |
188 | struct work_struct xmitwork; /* per-conn. xmit workqueue */ | 187 | struct work_struct xmitwork; /* per-conn. xmit workqueue */ |
189 | unsigned long suspend_tx; /* suspend Tx */ | 188 | unsigned long suspend_tx; /* suspend Tx */ |