Whamcloud - gitweb
LU-8654 obd: access ocd_connect_flags2 only when present
[fs/lustre-release.git] / lustre / ofd / ofd_obd.c
index 307f678..d5c1af0 100644 (file)
@@ -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. */