[SCSI] add refcouting around ctask usage in main IO patch

It is possible that a ctask could be completing and getting
cleaned up at the same time, we are finishing up the last
data transfer. This could then result in the data transfer
code using stale or invalid values. This patch adds a refcount
to the ctask. When the count goes to zero then we know the
transmit thread and recv thread or softirq are not touching
it and we can safely release it.

The eh should not need to grab a reference because it only cleans
up a task if it has both the xmit mutex and recv lock (or recv
side suspended).

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
Mike Christie 2006-08-31 18:09:25 -04:00 committed by James Bottomley
parent ffd0436ed2
commit 60ecebf5a1
2 changed files with 51 additions and 9 deletions

View file

@ -112,6 +112,7 @@ struct iscsi_cmd_task {
/* state set/tested under session->lock */
int state;
atomic_t refcount;
struct list_head running; /* running cmd list */
void *dd_data; /* driver/transport data */
};