From 4c6290087b3bf0838a00de8f8b1cfde86efbc409 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Fri, 22 Sep 2023 11:20:22 +0200 Subject: [PATCH] LU-12896 gss: key can be unlinked when timeout expires The key associated with a GSS context could appear to be already unlinked when the upcall timeout expires. In this case, do not assert but report this case with a warning message. Signed-off-by: Sebastien Buisson Change-Id: I714af3a1ce54648c4ba29ef13015f9291de52765 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52473 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Aurelien Degremont Reviewed-by: Oleg Drokin --- lustre/ptlrpc/gss/gss_keyring.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c index a1c67d49..5dfb73f 100644 --- a/lustre/ptlrpc/gss/gss_keyring.c +++ b/lustre/ptlrpc/gss/gss_keyring.c @@ -113,14 +113,21 @@ static void ctx_upcall_timeout_kr(cfs_timer_cb_arg_t data) struct gss_cli_ctx_keyring *gctx_kr = cfs_from_timer(gctx_kr, data, gck_timer); struct ptlrpc_cli_ctx *ctx = &(gctx_kr->gck_base.gc_base); + struct obd_import *imp = ctx->cc_sec->ps_import; struct key *key = gctx_kr->gck_key; - CWARN("ctx %p, key %p\n", ctx, key); - - LASSERT(key); + if (key) + CDEBUG(D_SEC, + "%s: GSS context (%p) negotiation timeout, revoking key (%p)\n", + imp->imp_obd->obd_name, ctx, key); + else + CDEBUG(D_SEC, + "%s: GSS context (%p) negotiation timeout, ignoring already unlinked key\n", + imp->imp_obd->obd_name, ctx); - cli_ctx_expire(ctx); - key_revoke_locked(key); + cli_ctx_expire(ctx); + if (key) + key_revoke_locked(key); } static void ctx_start_timer_kr(struct ptlrpc_cli_ctx *ctx, time64_t timeout) -- 1.8.3.1