From c744221a1fd55df33ca2b0e3e1b1ffd7ef3a986d 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. Test-Parameters: trivial Signed-off-by: Sebastien Buisson Change-Id: Ibc2ca9dfaa176b098080f7f2867338b62953b50e Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52629 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Aurelien Degremont Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- 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 e51e631..44e6dd6 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -538,8 +538,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