Whamcloud - gitweb
LU-17015 sec: fix PTLRPC_CTX_STATUS_MASK
authorSebastien Buisson <sbuisson@ddn.com>
Wed, 11 Oct 2023 13:29:46 +0000 (15:29 +0200)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 14 Dec 2023 13:56:29 +0000 (13:56 +0000)
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 <sbuisson@ddn.com>
Change-Id: Ibc2ca9dfaa176b098080f7f2867338b62953b50e
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53441
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/include/lustre_sec.h

index 82e0a3c..955e3b0 100644 (file)
@@ -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)