Whamcloud - gitweb
b=3886
authorrread <rread>
Mon, 19 Jul 2004 22:49:58 +0000 (22:49 +0000)
committerrread <rread>
Mon, 19 Jul 2004 22:49:58 +0000 (22:49 +0000)
A small races exists between receiving a reply and timeout. This diff
prevents ptlrpc_expire_one_request from timing out a req that has
already received the reply.

lustre/ptlrpc/client.c

index 5a4f9ae..fe9f627 100644 (file)
@@ -811,14 +811,20 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req)
 {
         unsigned long      flags;
         struct obd_import *imp = req->rq_import;
+        int replied = 0;
         ENTRY;
 
-        DEBUG_REQ(D_ERROR, req, "timeout");
-
         spin_lock_irqsave (&req->rq_lock, flags);
-        req->rq_timedout = 1;
+        replied = req->rq_replied;
+        if (!replied)
+                req->rq_timedout = 1;
         spin_unlock_irqrestore (&req->rq_lock, flags);
 
+        if (replied)
+                RETURN(0);
+
+        DEBUG_REQ(D_ERROR, req, "timeout");
+
         ptlrpc_unregister_reply (req);
 
         if (req->rq_bulk != NULL)