Whamcloud - gitweb
branch: b_new_cmd
authorericm <ericm>
Fri, 8 Dec 2006 04:00:15 +0000 (04:00 +0000)
committerericm <ericm>
Fri, 8 Dec 2006 04:00:15 +0000 (04:00 +0000)
switch context immediately when we detect ctx losing on server side, to
avoid infinite loop of resending.

lustre/include/lustre_sec.h
lustre/ptlrpc/gss/sec_gss.c
lustre/ptlrpc/sec.c

index bf91616..bf1f571 100644 (file)
@@ -496,13 +496,14 @@ void sptlrpc_request_out_callback(struct ptlrpc_request *req);
 int sptlrpc_import_get_sec(struct obd_import *imp, struct ptlrpc_svc_ctx *svc_ctx,
                            __u32 flavor, unsigned long flags);
 void sptlrpc_import_put_sec(struct obd_import *imp);
-int sptlrpc_import_check_ctx(struct obd_import *imp);
+int  sptlrpc_import_check_ctx(struct obd_import *imp);
 void sptlrpc_import_flush_root_ctx(struct obd_import *imp);
 void sptlrpc_import_flush_my_ctx(struct obd_import *imp);
 void sptlrpc_import_flush_all_ctx(struct obd_import *imp);
 int  sptlrpc_req_get_ctx(struct ptlrpc_request *req);
 void sptlrpc_req_put_ctx(struct ptlrpc_request *req);
 int  sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout);
+int  sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req);
 void sptlrpc_req_set_flavor(struct ptlrpc_request *req, int opcode);
 
 int sptlrpc_parse_flavor(enum lustre_part from, enum lustre_part to,
index 1205896..51ab06d 100644 (file)
@@ -658,8 +658,15 @@ int gss_cli_ctx_handle_err_notify(struct ptlrpc_cli_ctx *ctx,
                       "NO_CONTEXT" : "BAD_SIG");
 
                 sptlrpc_ctx_expire(ctx);
-                req->rq_resend = 1;
-                rc = 0;
+                /*
+                 * we need replace the ctx right here, otherwise during
+                 * resent we'll hit the logic in sptlrpc_req_refresh_ctx()
+                 * which keep the ctx with RESEND flag, thus we'll never
+                 * get rid of this ctx.
+                 */
+                rc = sptlrpc_req_replace_dead_ctx(req);
+                if (rc == 0)
+                        req->rq_resend = 1;
         } else {
                 CERROR("req %p: server report gss error (%x/%x)\n",
                         req, errhdr->gh_major, errhdr->gh_minor);
index 15aa3fd..07f5b4a 100644 (file)
@@ -771,6 +771,7 @@ int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
         }
         RETURN(rc);
 }
+EXPORT_SYMBOL(sptlrpc_req_replace_dead_ctx);
 
 static
 int ctx_check_refresh(struct ptlrpc_cli_ctx *ctx)