Whamcloud - gitweb
LU-1644 recovery: to not check client version for mne swap
authorJinshan Xiong <jay@whamcloud.com>
Fri, 7 Sep 2012 00:28:00 +0000 (17:28 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 12 Sep 2012 16:05:40 +0000 (12:05 -0400)
data->ocd_version in obd_connect_data can be overwritten by server
so that it'll be wrong if client is reconnected after server recovery.
Wrong clienv version caused wrong exp_need_mne_swab was set and then
has interop issue between 2.2 clients and 2.3 server.

In this patch, the following fixes are made:
1. do not check the client version on the MGS;
2. reset client version on each import connect;
3. client side fix will be removed after lustre 3.2

Signed-off-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Change-Id: Ia2899d1b8385fd4799ca6fe260fc4c84444247cb
Reviewed-on: http://review.whamcloud.com/3897
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Tested-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_lib.c
lustre/mgc/mgc_request.c
lustre/mgs/mgs_nids.c
lustre/obdclass/obd_mount.c
lustre/ptlrpc/import.c

index 06473f8..c49e887 100644 (file)
@@ -748,7 +748,6 @@ int target_handle_connect(struct ptlrpc_request *req)
         struct obd_connect_data *data, *tmpdata;
         int size, tmpsize;
         lnet_nid_t *client_nid = NULL;
         struct obd_connect_data *data, *tmpdata;
         int size, tmpsize;
         lnet_nid_t *client_nid = NULL;
-       bool mne_swab_client_ver;
        ENTRY;
 
         OBD_RACE(OBD_FAIL_TGT_CONN_RACE);
        ENTRY;
 
         OBD_RACE(OBD_FAIL_TGT_CONN_RACE);
@@ -840,15 +839,6 @@ int target_handle_connect(struct ptlrpc_request *req)
         if (rc)
                 GOTO(out, rc);
 
         if (rc)
                 GOTO(out, rc);
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 6, 50, 0)
-       /* Check if the client might be missing the LU-1252 fix to swab
-        * the IR mne_length entries. Do this as early as possible in case
-        * the version code is modified. See LU-1644 for details. */
-       mne_swab_client_ver = OBD_OCD_VERSION_MAJOR(data->ocd_version) == 2 &&
-                             OBD_OCD_VERSION_MINOR(data->ocd_version) == 2 &&
-                             OBD_OCD_VERSION_PATCH(data->ocd_version) < 55;
-#endif
-
         if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_LIBCLIENT) {
                 if (!data) {
                         DEBUG_REQ(D_WARNING, req, "Refusing old (unversioned) "
         if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_LIBCLIENT) {
                 if (!data) {
                         DEBUG_REQ(D_WARNING, req, "Refusing old (unversioned) "
@@ -1051,9 +1041,8 @@ dont_check_exports:
         * OBD_CONNECT_MNE_SWAB flag around forever, just so long as we need
         * interop with unpatched 2.2 clients.  For newer clients, servers
         * will never do MNE swabbing, let the client handle that.  LU-1644 */
         * OBD_CONNECT_MNE_SWAB flag around forever, just so long as we need
         * interop with unpatched 2.2 clients.  For newer clients, servers
         * will never do MNE swabbing, let the client handle that.  LU-1644 */
-       export->exp_need_mne_swab =
-               !(data->ocd_connect_flags & OBD_CONNECT_MNE_SWAB) &&
-               mne_swab_client_ver && !ptlrpc_req_need_swab(req);
+       export->exp_need_mne_swab = !ptlrpc_req_need_swab(req) &&
+                       !(data->ocd_connect_flags & OBD_CONNECT_MNE_SWAB);
 #else
 #warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and exp_need_mne_swab"
 #endif
 #else
 #warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and exp_need_mne_swab"
 #endif
index 94fe3bd..e4bc00a 100644 (file)
@@ -1514,13 +1514,13 @@ again:
         }
 
        mne_swab = !!ptlrpc_rep_need_swab(req);
         }
 
        mne_swab = !!ptlrpc_rep_need_swab(req);
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 6, 50, 0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0)
        /* This import flag means the server did an extra swab of IR MNE
         * records (fixed in LU-1252), reverse it here if needed. LU-1644 */
        if (unlikely(req->rq_import->imp_need_mne_swab))
                mne_swab = !mne_swab;
 #else
        /* This import flag means the server did an extra swab of IR MNE
         * records (fixed in LU-1252), reverse it here if needed. LU-1644 */
        if (unlikely(req->rq_import->imp_need_mne_swab))
                mne_swab = !mne_swab;
 #else
-#warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and exp_need_mne_swab"
+#warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and imp_need_mne_swab"
 #endif
 
         for (i = 0; i < nrpages && ealen > 0; i++) {
 #endif
 
         for (i = 0; i < nrpages && ealen > 0; i++) {
index 0c9c13d..0f0c83a 100644 (file)
@@ -146,7 +146,6 @@ static int mgs_nidtbl_read(struct obd_export *exp, struct mgs_nidtbl *tbl,
 
                         /* check if we need to consume remaining bytes. */
                         if (last_in_unit != NULL && bytes_in_unit) {
 
                         /* check if we need to consume remaining bytes. */
                         if (last_in_unit != NULL && bytes_in_unit) {
-#
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 6, 50, 0)
                                /* May need to swab back to update the length.*/
                                if (exp->exp_need_mne_swab)
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 6, 50, 0)
                                /* May need to swab back to update the length.*/
                                if (exp->exp_need_mne_swab)
index 33ef09d..b2ec636 100644 (file)
@@ -691,8 +691,14 @@ static int lustre_start_mgc(struct super_block *sb)
 
        /* We connect to the MGS at setup, and don't disconnect until cleanup */
        data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_AT |
 
        /* We connect to the MGS at setup, and don't disconnect until cleanup */
        data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_AT |
-                                 OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV |
-                                 OBD_CONNECT_MNE_SWAB;
+                                 OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV;
+
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0)
+       data->ocd_connect_flags |= OBD_CONNECT_MNE_SWAB;
+#else
+#warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and imp_need_mne_swab"
+#endif
+
         if (lmd_is_client(lsi->lsi_lmd) &&
             lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)
                 data->ocd_connect_flags &= ~OBD_CONNECT_IMP_RECOV;
         if (lmd_is_client(lsi->lsi_lmd) &&
             lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)
                 data->ocd_connect_flags &= ~OBD_CONNECT_IMP_RECOV;
index 43dda40..b7e7c84 100644 (file)
@@ -647,6 +647,8 @@ int ptlrpc_connect_import(struct obd_import *imp)
         /* Reset connect flags to the originally requested flags, in case
          * the server is updated on-the-fly we will get the new features. */
         imp->imp_connect_data.ocd_connect_flags = imp->imp_connect_flags_orig;
         /* Reset connect flags to the originally requested flags, in case
          * the server is updated on-the-fly we will get the new features. */
         imp->imp_connect_data.ocd_connect_flags = imp->imp_connect_flags_orig;
+       /* Reset ocd_version each time so the server knows the exact versions */
+       imp->imp_connect_data.ocd_version = LUSTRE_VERSION_CODE;
         imp->imp_msghdr_flags &= ~MSGHDR_AT_SUPPORT;
         imp->imp_msghdr_flags &= ~MSGHDR_CKSUM_INCOMPAT18;
 
         imp->imp_msghdr_flags &= ~MSGHDR_AT_SUPPORT;
         imp->imp_msghdr_flags &= ~MSGHDR_CKSUM_INCOMPAT18;
 
@@ -1038,7 +1040,7 @@ finish:
                                       newer : older, LUSTRE_VERSION_STRING);
                 }
 
                                       newer : older, LUSTRE_VERSION_STRING);
                 }
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 6, 50, 0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0)
                /* Check if server has LU-1252 fix applied to not always swab
                 * the IR MNE entries. Do this only once per connection.  This
                 * fixup is version-limited, because we don't want to carry the
                /* Check if server has LU-1252 fix applied to not always swab
                 * the IR MNE entries. Do this only once per connection.  This
                 * fixup is version-limited, because we don't want to carry the
@@ -1056,7 +1058,7 @@ finish:
                else /* clear if server was upgraded since last connect */
                        imp->imp_need_mne_swab = 0;
 #else
                else /* clear if server was upgraded since last connect */
                        imp->imp_need_mne_swab = 0;
 #else
-#warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and exp_need_mne_swab"
+#warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and imp_need_mne_swab"
 #endif
 
                if (ocd->ocd_connect_flags & OBD_CONNECT_CKSUM) {
 #endif
 
                if (ocd->ocd_connect_flags & OBD_CONNECT_CKSUM) {