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,
"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);