aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/iser
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-05-21 16:54:18 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-12 09:22:22 -0400
commit913e5bf435617aa529919a4f7567f849f9f35f9f (patch)
treedb7357d78d7d6f20358d61bf88a8137ad044a5a5 /drivers/infiniband/ulp/iser
parent3cf7b233ffc45d4fc381221f74d24f10e692c4ea (diff)
[SCSI] libiscsi, iser, tcp: remove recv_lock
The recv lock was defined so the iscsi layer could block the recv path from processing IO during recovery. It turns out iser just set a lock to that pointer which was pointless. We now disconnect the transport connection before doing recovery so we do not need the recv lock. For iscsi_tcp we still stop the recv path incase older tools are being used. This patch also has iscsi_itt_to_ctask user grab the session lock and has the caller access the task with the lock or get a ref to it in case the target is broken and sends a tmf success response then sends data or a response for the command that was supposed to be affected bty the tmf. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/infiniband/ulp/iser')
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c20
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h2
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c6
3 files changed, 16 insertions, 12 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 08edbaf89223..c02eabd383a1 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -281,9 +281,6 @@ iscsi_iser_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx)
281 conn->max_recv_dlength = 128; 281 conn->max_recv_dlength = 128;
282 282
283 iser_conn = conn->dd_data; 283 iser_conn = conn->dd_data;
284 /* currently this is the only field which need to be initiated */
285 rwlock_init(&iser_conn->lock);
286
287 conn->dd_data = iser_conn; 284 conn->dd_data = iser_conn;
288 iser_conn->iscsi_conn = conn; 285 iser_conn->iscsi_conn = conn;
289 286
@@ -342,9 +339,6 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,
342 ib_conn->iser_conn = iser_conn; 339 ib_conn->iser_conn = iser_conn;
343 iser_conn->ib_conn = ib_conn; 340 iser_conn->ib_conn = ib_conn;
344 iser_conn_get(ib_conn); 341 iser_conn_get(ib_conn);
345
346 conn->recv_lock = &iser_conn->lock;
347
348 return 0; 342 return 0;
349} 343}
350 344
@@ -355,12 +349,18 @@ iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
355 struct iscsi_iser_conn *iser_conn = conn->dd_data; 349 struct iscsi_iser_conn *iser_conn = conn->dd_data;
356 struct iser_conn *ib_conn = iser_conn->ib_conn; 350 struct iser_conn *ib_conn = iser_conn->ib_conn;
357 351
358 iscsi_conn_stop(cls_conn, flag);
359 /* 352 /*
360 * There is no unbind event so the stop callback 353 * Userspace may have goofed up and not bound the connection or
361 * must release the ref from the bind. 354 * might have only partially setup the connection.
362 */ 355 */
363 iser_conn_put(ib_conn); 356 if (ib_conn) {
357 iscsi_conn_stop(cls_conn, flag);
358 /*
359 * There is no unbind event so the stop callback
360 * must release the ref from the bind.
361 */
362 iser_conn_put(ib_conn);
363 }
364 iser_conn->ib_conn = NULL; 364 iser_conn->ib_conn = NULL;
365} 365}
366 366
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index cdf48763b082..a547edeea969 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -263,8 +263,6 @@ struct iser_conn {
263struct iscsi_iser_conn { 263struct iscsi_iser_conn {
264 struct iscsi_conn *iscsi_conn;/* ptr to iscsi conn */ 264 struct iscsi_conn *iscsi_conn;/* ptr to iscsi conn */
265 struct iser_conn *ib_conn; /* iSER IB conn */ 265 struct iser_conn *ib_conn; /* iSER IB conn */
266
267 rwlock_t lock;
268}; 266};
269 267
270struct iscsi_iser_task { 268struct iscsi_iser_task {
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 35af60a23c61..c36083922134 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -558,7 +558,12 @@ void iser_rcv_completion(struct iser_desc *rx_desc,
558 opcode = hdr->opcode & ISCSI_OPCODE_MASK; 558 opcode = hdr->opcode & ISCSI_OPCODE_MASK;
559 559
560 if (opcode == ISCSI_OP_SCSI_CMD_RSP) { 560 if (opcode == ISCSI_OP_SCSI_CMD_RSP) {
561 spin_lock(&conn->iscsi_conn->session->lock);
561 task = iscsi_itt_to_ctask(conn->iscsi_conn, hdr->itt); 562 task = iscsi_itt_to_ctask(conn->iscsi_conn, hdr->itt);
563 if (task)
564 __iscsi_get_task(task);
565 spin_unlock(&conn->iscsi_conn->session->lock);
566
562 if (!task) 567 if (!task)
563 iser_err("itt can't be matched to task!!! " 568 iser_err("itt can't be matched to task!!! "
564 "conn %p opcode %d itt %d\n", 569 "conn %p opcode %d itt %d\n",
@@ -568,6 +573,7 @@ void iser_rcv_completion(struct iser_desc *rx_desc,
568 iser_dbg("itt %d task %p\n",hdr->itt, task); 573 iser_dbg("itt %d task %p\n",hdr->itt, task);
569 iser_task->status = ISER_TASK_STATUS_COMPLETED; 574 iser_task->status = ISER_TASK_STATUS_COMPLETED;
570 iser_task_rdma_finalize(iser_task); 575 iser_task_rdma_finalize(iser_task);
576 iscsi_put_task(task);
571 } 577 }
572 } 578 }
573 iser_dto_buffs_release(dto); 579 iser_dto_buffs_release(dto);