[openib-general] [PATCH 03/12] SRP: Changing ibsrpdm

Ishai Rabinovitz ishai at mellanox.co.il
Mon May 1 04:27:10 PDT 2006


It is nicer to perform the init_work just before the call to schedule_work.

Signed-off-by: Ishai Rabinovitz <ishai at mellanox.co.il>
Index: last_stable/drivers/infiniband/ulp/srp/ib_srp.c
===================================================================
--- last_stable.orig/drivers/infiniband/ulp/srp/ib_srp.c	2006-04-17 10:57:59.000000000 +0300
+++ last_stable/drivers/infiniband/ulp/srp/ib_srp.c	2006-04-18 02:26:29.000000000 +0300
@@ -828,8 +829,10 @@ static void srp_completion(struct ib_cq 
 			       wc.wr_id & SRP_OP_RECV ? "receive" : "send",
 			       wc.status);
 			spin_lock_irqsave(target->scsi_host->host_lock, flags);
-			if (target->state == SRP_TARGET_LIVE)
+			if (target->state == SRP_TARGET_LIVE) {
+				INIT_WORK(&target->work, srp_reconnect_work, target);
 				schedule_work(&target->work);
+			}
 			spin_unlock_irqrestore(target->scsi_host->host_lock, flags);
 			break;
 		}
@@ -1601,8 +1684,6 @@ static ssize_t srp_create_target(struct 
 	target->scsi_host  = target_host;
 	target->srp_host   = host;
 
-	INIT_WORK(&target->work, srp_reconnect_work, target);
-
 	for (i = 0; i < SRP_SQ_SIZE - 1; ++i)
 		target->req_ring[i].next = i + 1;
 	target->req_ring[SRP_SQ_SIZE - 1].next = -1;
-- 
Ishai Rabinovitz



More information about the general mailing list