[openib-general] [PATCH] Fix some cancellation problems in process_req().

Krishna Kumar krkumar2 at in.ibm.com
Mon Oct 16 21:39:18 PDT 2006


Fixes following problems in process_req() relating to
cancellation :

- Function is wrongly doing another addr_remote() when
  cancelled, which is not required.
- Make failure reporting immediate by using time_after_eq().
- On cancellation, -ETIMEDOUT was returned to the callback
  routine instead of the more appropriate -ECANCELLED (users
  getting notified may want to print/return this status, eg
  ucma_event_handler).

Signed-off-by: Krishna Kumar <krkumar2 at in.ibm.com>
--------
diff -ruNp org/drivers/infiniband/core/addr.c new/drivers/infiniband/core/addr.c
--- org/drivers/infiniband/core/addr.c	2006-10-10 15:37:20.000000000 +0530
+++ new/drivers/infiniband/core/addr.c	2006-10-11 10:26:50.000000000 +0530
@@ -204,17 +204,16 @@ static void process_req(void *data)
 
 	mutex_lock(&lock);
 	list_for_each_entry_safe(req, temp_req, &req_list, list) {
-		if (req->status) {
+		if (req->status && req->status != -ECANCELED) {
 			src_in = (struct sockaddr_in *) &req->src_addr;
 			dst_in = (struct sockaddr_in *) &req->dst_addr;
 			req->status = addr_resolve_remote(src_in, dst_in,
 							  req->addr);
+			if (req->status && time_after_eq(jiffies, req->timeout))
+				req->status = -ETIMEDOUT;
+			else if (req->status == -ENODATA)
+				continue;
 		}
-		if (req->status && time_after(jiffies, req->timeout))
-			req->status = -ETIMEDOUT;
-		else if (req->status == -ENODATA)
-			continue;
-
 		list_del(&req->list);
 		list_add_tail(&req->list, &done_list);
 	}




More information about the general mailing list