From f4cb1c444dbc7ff963f6af29d445fdd4caf2dc82 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Wed, 11 Oct 2023 15:29:46 +0200 Subject: [PATCH] LU-17015 sec: fix PTLRPC_CTX_STATUS_MASK PTLRPC_CTX_STATUS_MASK should not include PTLRPC_CTX_NEW_BIT, which is a bit index and not a value. Also, according to code in sptlrpc_req_refresh_ctx(): if (unlikely(test_bit(PTLRPC_CTX_NEW_BIT, &ctx->cc_flags))) { if (ctx->cc_ops->refresh) ctx->cc_ops->refresh(ctx); } a context needs to be refreshed if it has the PTLRPC_CTX_NEW_BIT bit. So the function to check if context is refreshed, cli_ctx_is_refreshed should not return true if the PTLRPC_CTX_NEW_BIT bit is set. In the end, do not replace PTLRPC_CTX_NEW_BIT with anything else in PTLRPC_CTX_STATUS_MASK. Having PTLRPC_CTX_NEW_BIT was a no-op (bitwise OR with 0), but this was working as expected. Just cleanup the code to avoid headaches. Lustre-change: https://review.whamcloud.com/52629 Lustre-commit: c744221a1fd55df33ca2b0e3e1b1ffd7ef3a986d Test-Parameters: trivial Signed-off-by: Sebastien Buisson Change-Id: Ibc2ca9dfaa176b098080f7f2867338b62953b50e Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53441 Tested-by: jenkins Tested-by: Maloo --- lustre/include/lustre_sec.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index 82e0a3c..955e3b0 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -539,8 +539,7 @@ struct ptlrpc_ctx_ops { #define PTLRPC_CTX_CACHED BIT(PTLRPC_CTX_CACHED_BIT) #define PTLRPC_CTX_ETERNAL BIT(PTLRPC_CTX_ETERNAL_BIT) -#define PTLRPC_CTX_STATUS_MASK (PTLRPC_CTX_NEW_BIT | \ - PTLRPC_CTX_UPTODATE | \ +#define PTLRPC_CTX_STATUS_MASK (PTLRPC_CTX_UPTODATE | \ PTLRPC_CTX_DEAD | \ PTLRPC_CTX_ERROR) -- 1.8.3.1