From 12c5a26609f12b36dda0bfb33e27cc03f805155d Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Wed, 6 Jun 2018 16:18:03 -0600 Subject: [PATCH] LU-10855 ptlrpc: assign specific values to MGS opcodes Assign specific values to all of the MGS opcodes in enum mgs_cmd so that these values do not change if a new items is added or one is removed in the future. These opcodes are part of the wire protocol and need to remain constant. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I8132ca01916cd657933d0c8864e4e78f8b3ebbe5 Reviewed-on: https://review.whamcloud.com/32653 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/include/uapi/linux/lustre/lustre_idl.h | 20 ++++++++++---------- lustre/ptlrpc/wiretest.c | 2 ++ lustre/utils/wirecheck.c | 1 + lustre/utils/wiretest.c | 2 ++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index a7ce930..84b913b 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -2455,16 +2455,16 @@ struct ldlm_reply { * Opcodes for mountconf (mgs and mgc) */ enum mgs_cmd { - MGS_CONNECT = 250, - MGS_DISCONNECT, - MGS_EXCEPTION, /* node died, etc. */ - MGS_TARGET_REG, /* whenever target starts up */ - MGS_TARGET_DEL, - MGS_SET_INFO, - MGS_CONFIG_READ, - MGS_LAST_OPC -}; -#define MGS_FIRST_OPC MGS_CONNECT + MGS_CONNECT = 250, + MGS_DISCONNECT = 251, + MGS_EXCEPTION = 252, /* node died, etc. */ + MGS_TARGET_REG = 253, /* whenever target starts up */ + MGS_TARGET_DEL = 254, + MGS_SET_INFO = 255, + MGS_CONFIG_READ = 256, + MGS_LAST_OPC, + MGS_FIRST_OPC = MGS_CONNECT +}; #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0) #define MGS_PARAM_MAXLEN 1024 diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 9aa4553..30ad1e4 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -360,6 +360,8 @@ void lustre_assert_wire_constants(void) (long long)MGS_TARGET_DEL); LASSERTF(MGS_SET_INFO == 255, "found %lld\n", (long long)MGS_SET_INFO); + LASSERTF(MGS_CONFIG_READ == 256, "found %lld\n", + (long long)MGS_CONFIG_READ); LASSERTF(MGS_LAST_OPC == 257, "found %lld\n", (long long)MGS_LAST_OPC); LASSERTF(SEC_CTX_INIT == 801, "found %lld\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 178fc8f..4211cef 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -2716,6 +2716,7 @@ main(int argc, char **argv) CHECK_VALUE(MGS_TARGET_REG); CHECK_VALUE(MGS_TARGET_DEL); CHECK_VALUE(MGS_SET_INFO); + CHECK_VALUE(MGS_CONFIG_READ); CHECK_VALUE(MGS_LAST_OPC); CHECK_VALUE(SEC_CTX_INIT); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index a83a3db..0ff5bbd 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -381,6 +381,8 @@ void lustre_assert_wire_constants(void) (long long)MGS_TARGET_DEL); LASSERTF(MGS_SET_INFO == 255, "found %lld\n", (long long)MGS_SET_INFO); + LASSERTF(MGS_CONFIG_READ == 256, "found %lld\n", + (long long)MGS_CONFIG_READ); LASSERTF(MGS_LAST_OPC == 257, "found %lld\n", (long long)MGS_LAST_OPC); LASSERTF(SEC_CTX_INIT == 801, "found %lld\n", -- 1.8.3.1