From e1e5dc74c81e369c7601c5dffbcf11b9c5484557 Mon Sep 17 00:00:00 2001 From: ericm Date: Fri, 8 Dec 2006 04:00:15 +0000 Subject: [PATCH] branch: b_new_cmd switch context immediately when we detect ctx losing on server side, to avoid infinite loop of resending. --- lustre/include/lustre_sec.h | 3 ++- lustre/ptlrpc/gss/sec_gss.c | 11 +++++++++-- lustre/ptlrpc/sec.c | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index bf91616..bf1f571 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -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, diff --git a/lustre/ptlrpc/gss/sec_gss.c b/lustre/ptlrpc/gss/sec_gss.c index 1205896..51ab06d 100644 --- a/lustre/ptlrpc/gss/sec_gss.c +++ b/lustre/ptlrpc/gss/sec_gss.c @@ -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); diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index 15aa3fd..07f5b4a 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -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) -- 1.8.3.1