From: Andreas Dilger Date: Mon, 24 Oct 2011 04:57:26 +0000 (-0600) Subject: LU-692 ptlrpc: don't LASSERT on larger ptlrpc_body X-Git-Tag: 1.8.7-wc1^0 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b41f49bc37ad4d6a86e877b41982269fde199340;p=fs%2Flustre-release.git LU-692 ptlrpc: don't LASSERT on larger ptlrpc_body Don't LASSERT() on a larger ptlrpc_body that might be sent from the server. The lustre_msg_size() function is called against a lustre_msg buffer sent from the server in case of an early reply, and it shouldn't LASSERT() on data received from the network. Reserve OBD_CONNECT_* flags and obd_connect_data fields from master. Signed-off-by: Andreas Dilger Change-Id: I1f68c20d1048c379ae33e328995673d3cfbe8145 Reviewed-on: http://review.whamcloud.com/1584 Tested-by: Hudson Reviewed-by: Niu Yawei Reviewed-by: Johann Lombardi --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 1bd2ca0..b26ad58 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -239,6 +239,7 @@ struct lustre_msg_v2 { /* without gss, ptlrpc_body is put at the first buffer. */ #define PTLRPC_NUM_VERSIONS 4 +#define JOBSTATS_JOBID_SIZE 32 /* 32 bytes string */ struct ptlrpc_body { struct lustre_handle pb_handle; __u32 pb_type; @@ -260,6 +261,7 @@ struct ptlrpc_body { __u64 pb_pre_versions[PTLRPC_NUM_VERSIONS]; /* padding for future needs */ __u64 pb_padding[4]; + /*char pb_jobid[JOBSTATS_JOBID_SIZE]; LU-694 */ }; extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb, int msgsize); @@ -362,6 +364,8 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb, int msgsize); #define OBD_CONNECT_64BITHASH 0x4000000000ULL /* client supports 64-bits * directory hash */ #define OBD_CONNECT_MAXBYTES 0x8000000000ULL /* max stripe size */ +#define OBD_CONNECT_IMP_RECOV 0x10000000000ULL /* imp recovery support */ +#define OBD_CONNECT_JOBSTATS 0x20000000000ULL /* jobid in ptlrpc_body */ /* also update obd_connect_names[] for lprocfs_rd_connect_flags() * and lustre/utils/wirecheck.c */ @@ -413,7 +417,7 @@ struct obd_connect_data { __u32 ocd_group; /* Used in lustre 1.8 */ __u32 ocd_cksum_types; /* supported checksum algorithms */ __u32 ocd_max_easize; /* How big LOV EA size can be on MDS */ - __u32 padding; /* also fix lustre_swab_connect */ + __u32 ocd_instance; /* IR instance # of this target */ __u64 ocd_maxbytes; /* Maximum object size in bytes */ }; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 0614292..603170f 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -175,10 +175,10 @@ int lustre_msg_size(__u32 magic, int count, __u32 *lens) LASSERT(count > 0); #ifdef PTLRPC_INTEROP_1_6 - LASSERT(lens[MSG_PTLRPC_BODY_OFF] == sizeof(struct ptlrpc_body) || + LASSERT(lens[MSG_PTLRPC_BODY_OFF] >= sizeof(struct ptlrpc_body) || lens[MSG_PTLRPC_BODY_OFF] == PTLRPC_BODY_MIN_SIZE); #else - LASSERT(lens[MSG_PTLRPC_BODY_OFF] == sizeof(struct ptlrpc_body)); + LASSERT(lens[MSG_PTLRPC_BODY_OFF] >= sizeof(struct ptlrpc_body)); #endif switch (magic) { case LUSTRE_MSG_MAGIC_V1: @@ -1980,8 +1980,8 @@ void lustre_swab_connect(struct obd_connect_data *ocd) __swab32s(&ocd->ocd_group); __swab32s(&ocd->ocd_cksum_types); __swab32s(&ocd->ocd_max_easize); + __swab32s(&ocd->ocd_instance); __swab64s(&ocd->ocd_maxbytes); - CLASSERT(offsetof(typeof(*ocd), padding) != 0); } void lustre_swab_obdo (struct obdo *o) diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 956ae1a..d01a0d6 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -520,10 +520,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obd_connect_data, ocd_max_easize)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_max_easize) == 4, " found %lld\n", (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_max_easize)); - LASSERTF((int)offsetof(struct obd_connect_data, padding) == 60, " found %lld\n", - (long long)(int)offsetof(struct obd_connect_data, padding)); - LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding) == 4, " found %lld\n", - (long long)(int)sizeof(((struct obd_connect_data *)0)->padding)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_instance) == 60, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_instance)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_instance) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_instance)); LASSERTF((int)offsetof(struct obd_connect_data, ocd_maxbytes) == 64, " found %lld\n", (long long)(int)offsetof(struct obd_connect_data, ocd_maxbytes)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_maxbytes) == 8, " found %lld\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index f67c26d..ddc4b59 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -214,8 +214,8 @@ static void check_obd_connect_data(void) CHECK_MEMBER(obd_connect_data, ocd_group); CHECK_MEMBER(obd_connect_data, ocd_cksum_types); CHECK_MEMBER(obd_connect_data, ocd_max_easize); - CHECK_MEMBER(obd_connect_data, padding1); - CHECK_MEMBER(obd_connect_data, padding2); + CHECK_MEMBER(obd_connect_data, ocd_instance); + CHECK_MEMBER(obd_connect_data, ocd_maxbytes); CHECK_CDEFINE(OBD_CONNECT_RDONLY); CHECK_CDEFINE(OBD_CONNECT_INDEX); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 1a6b25a..88f5390 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -518,10 +518,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obd_connect_data, ocd_max_easize)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_max_easize) == 4, " found %lld\n", (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_max_easize)); - LASSERTF((int)offsetof(struct obd_connect_data, padding) == 60, " found %lld\n", - (long long)(int)offsetof(struct obd_connect_data, padding)); - LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding) == 4, " found %lld\n", - (long long)(int)sizeof(((struct obd_connect_data *)0)->padding)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_instance) == 60, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_instance)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_instance) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_instance)); LASSERTF((int)offsetof(struct obd_connect_data, ocd_maxbytes) == 64, " found %lld\n", (long long)(int)offsetof(struct obd_connect_data, ocd_maxbytes)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_maxbytes) == 8, " found %lld\n",