From 26892d7b0214f2c3b31abd269a234f9bc50a515f Mon Sep 17 00:00:00 2001
From: rread <rread>
Date: Thu, 8 Jan 2004 20:21:38 +0000
Subject: [PATCH] b=2432

Merging fix from b_llp2. Set the rq_no_resend for cancel requests so
ldlm_cli_cancel() can reconstruct the cancel with the correct
cookie.
---
 lustre/ldlm/ldlm_request.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c
index e32a103288..7e79cd87d6 100644
--- a/lustre/ldlm/ldlm_request.c
+++ b/lustre/ldlm/ldlm_request.c
@@ -511,6 +511,7 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
                         goto local_cancel;
                 }
 
+        restart:
                 imp = class_exp2cliimp(lock->l_conn_export);
                 if (imp == NULL || imp->imp_invalid) {
                         CDEBUG(D_HA, "skipping cancel on invalid import %p\n",
@@ -521,6 +522,7 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
                 req = ptlrpc_prep_req(imp, LDLM_CANCEL, 1, &size, NULL);
                 if (!req)
                         GOTO(out, rc = -ENOMEM);
+                req->rq_no_resend = 1;
 
                 /* XXX FIXME bug 249 */
                 req->rq_request_portal = LDLM_CANCEL_REQUEST_PORTAL;
@@ -534,13 +536,17 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
 
                 rc = ptlrpc_queue_wait(req);
 
-                if (rc == ESTALE)
+                if (rc == ESTALE) {
                         CERROR("client/server (nid "LPU64") out of sync--not "
                                "fatal\n",
                                req->rq_import->imp_connection->c_peer.peer_nid);
-                else if (rc != ELDLM_OK)
+                } else if (rc == -ETIMEDOUT) {
+                        ptlrpc_req_finished(req);
+                        GOTO(restart, rc);
+                } else if (rc != ELDLM_OK) {
                         CERROR("Got rc %d from cancel RPC: canceling "
                                "anyway\n", rc);
+                }
 
                 ptlrpc_req_finished(req);
         local_cancel:
-- 
GitLab