From: John L. Hammond Date: Fri, 30 Sep 2016 13:57:07 +0000 (-0500) Subject: LU-8654 obd: access ocd_connect_flags2 only when present X-Git-Tag: 2.8.60~77 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c7ede9238c24b8187ee38c80d5b680c8a5a8e703 LU-8654 obd: access ocd_connect_flags2 only when present Before 2.7.50 clients will send a struct obd_connect_data_v1 rather than a full struct obd_connect_data. So check for OBD_CONNECT_FLAGS2 before accessing the ocd_connect_flags2 member of struct obd_connect_data. Signed-off-by: John L. Hammond Change-Id: Ic1c2b54be9b3cbaec9af894f204663c74fa41213 Reviewed-on: http://review.whamcloud.com/22837 Tested-by: Jenkins Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 9fd6efc..25a42a7 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5074,6 +5074,10 @@ static int mdt_obd_set_info_async(const struct lu_env *env, * connect flags from the obd_connect_data::ocd_connect_flags field of the * reply. \see mdt_connect(). * + * Before 2.7.50 clients will send a struct obd_connect_data_v1 rather than a + * full struct obd_connect_data. So care must be taken when accessing fields + * that are not present in struct obd_connect_data_v1. See LU-16. + * * \param exp the obd_export associated with this client/target pair * \param mdt the target device for the connection * \param data stores data for this connect request @@ -5089,7 +5093,10 @@ static int mdt_connect_internal(struct obd_export *exp, LASSERT(data != NULL); data->ocd_connect_flags &= MDT_CONNECT_SUPPORTED; - data->ocd_connect_flags2 &= MDT_CONNECT_SUPPORTED2; + + if (data->ocd_connect_flags & OBD_CONNECT_FLAGS2) + data->ocd_connect_flags2 &= MDT_CONNECT_SUPPORTED2; + data->ocd_ibits_known &= MDS_INODELOCK_FULL; if (!(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) && diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 1eacc1f2..785e094 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -1502,7 +1502,10 @@ static int mgs_obd_connect(const struct lu_env *env, struct obd_export **exp, if (data != NULL) { data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED; - data->ocd_connect_flags2 &= MGS_CONNECT_SUPPORTED2; + + if (data->ocd_connect_flags & OBD_CONNECT_FLAGS2) + data->ocd_connect_flags2 &= MGS_CONNECT_SUPPORTED2; + data->ocd_version = LUSTRE_VERSION_CODE; lexp->exp_connect_data = *data; } @@ -1531,7 +1534,10 @@ static int mgs_obd_reconnect(const struct lu_env *env, struct obd_export *exp, if (data != NULL) { data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED; - data->ocd_connect_flags2 &= MGS_CONNECT_SUPPORTED2; + + if (data->ocd_connect_flags & OBD_CONNECT_FLAGS2) + data->ocd_connect_flags2 &= MGS_CONNECT_SUPPORTED2; + data->ocd_version = LUSTRE_VERSION_CODE; exp->exp_connect_data = *data; } diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 9a2a097..75b76ca 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -72,7 +72,10 @@ static int echo_connect(const struct lu_env *env, int rc; data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED; - data->ocd_connect_flags2 &= ECHO_CONNECT_SUPPORTED2; + + if (data->ocd_connect_flags & OBD_CONNECT_FLAGS2) + data->ocd_connect_flags2 &= ECHO_CONNECT_SUPPORTED2; + rc = class_connect(&conn, obd, cluuid); if (rc) { CERROR("can't connect %d\n", rc); diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index 307f678..d5c1af0 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -122,6 +122,10 @@ out: * connect flags from the obd_connect_data::ocd_connect_flags field of the * reply. \see tgt_connect(). * + * Before 2.7.50 clients will send a struct obd_connect_data_v1 rather than a + * full struct obd_connect_data. So care must be taken when accessing fields + * that are not present in struct obd_connect_data_v1. See LU-16. + * * \param[in] env execution environment * \param[in] exp the obd_export associated with this * client/target pair @@ -164,7 +168,10 @@ static int ofd_parse_connect_data(const struct lu_env *env, fed->fed_group = data->ocd_group; data->ocd_connect_flags &= OST_CONNECT_SUPPORTED; - data->ocd_connect_flags2 &= OST_CONNECT_SUPPORTED2; + + if (data->ocd_connect_flags & OBD_CONNECT_FLAGS2) + data->ocd_connect_flags2 &= OST_CONNECT_SUPPORTED2; + data->ocd_version = LUSTRE_VERSION_CODE; /* Kindly make sure the SKIP_ORPHAN flag is from MDS. */