Whamcloud - gitweb
LU-6496 ptlrpc: Fix wrong code indentation in plain_authorize
[fs/lustre-release.git] / lustre / ptlrpc / import.c
index 58ad83f..e96396a 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -40,6 +40,7 @@
 
 #define DEBUG_SUBSYSTEM S_RPC
 
+#include <linux/kthread.h>
 #include <obd_support.h>
 #include <lustre_ha.h>
 #include <lustre_net.h>
@@ -141,7 +142,6 @@ void deuuidify(char *uuid, const char *prefix, char **uuid_start, int *uuid_len)
                     UUID_STR, strlen(UUID_STR)))
                 *uuid_len -= strlen(UUID_STR);
 }
-EXPORT_SYMBOL(deuuidify);
 
 /**
  * Returns true if import was FULL, false if import was already not
@@ -439,7 +439,6 @@ void ptlrpc_fail_import(struct obd_import *imp, __u32 conn_cnt)
        }
        EXIT;
 }
-EXPORT_SYMBOL(ptlrpc_fail_import);
 
 int ptlrpc_reconnect_import(struct obd_import *imp)
 {
@@ -688,7 +687,7 @@ int ptlrpc_connect_import(struct obd_import *imp)
         if (rc)
                 GOTO(out, rc);
 
-        rc = sptlrpc_import_sec_adapt(imp, NULL, 0);
+       rc = sptlrpc_import_sec_adapt(imp, NULL, NULL);
         if (rc)
                 GOTO(out, rc);
 
@@ -729,8 +728,6 @@ int ptlrpc_connect_import(struct obd_import *imp)
         request->rq_timeout = INITIAL_CONNECT_TIMEOUT;
         lustre_msg_set_timeout(request->rq_reqmsg, request->rq_timeout);
 
-        lustre_msg_add_op_flags(request->rq_reqmsg, MSG_CONNECT_NEXT_VER);
-
         request->rq_no_resend = request->rq_no_delay = 1;
         request->rq_send_state = LUSTRE_IMP_CONNECTING;
         /* Allow a slightly larger reply for future growth compatibility */
@@ -914,8 +911,7 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp,
                        ocd->ocd_connect_flags;
        }
 
-       if ((ocd->ocd_connect_flags & OBD_CONNECT_AT) &&
-               (imp->imp_msg_magic == LUSTRE_MSG_MAGIC_V2))
+       if (ocd->ocd_connect_flags & OBD_CONNECT_AT)
                /* We need a per-message support flag, because
                 * a. we don't know if the incoming connect reply
                 *    supports AT or not (in reply_in_callback)
@@ -928,11 +924,7 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp,
        else
                imp->imp_msghdr_flags &= ~MSGHDR_AT_SUPPORT;
 
-       if ((ocd->ocd_connect_flags & OBD_CONNECT_FULL20) &&
-           (imp->imp_msg_magic == LUSTRE_MSG_MAGIC_V2))
-               imp->imp_msghdr_flags |= MSGHDR_CKSUM_INCOMPAT18;
-       else
-               imp->imp_msghdr_flags &= ~MSGHDR_CKSUM_INCOMPAT18;
+       imp->imp_msghdr_flags |= MSGHDR_CKSUM_INCOMPAT18;
 
        return 0;
 }
@@ -1016,6 +1008,32 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
                GOTO(out, rc = -EPROTO);
        }
 
+       if (!(imp->imp_connect_flags_orig & OBD_CONNECT_LIGHTWEIGHT) &&
+           (imp->imp_connect_flags_orig & OBD_CONNECT_MDS_MDS) &&
+           (imp->imp_connect_flags_orig & OBD_CONNECT_FID) &&
+           (ocd->ocd_connect_flags & OBD_CONNECT_VERSION)) {
+               __u32 major = OBD_OCD_VERSION_MAJOR(ocd->ocd_version);
+               __u32 minor = OBD_OCD_VERSION_MINOR(ocd->ocd_version);
+               __u32 patch = OBD_OCD_VERSION_PATCH(ocd->ocd_version);
+
+               /* We do not support the MDT-MDT interoperations with
+                * different version MDT because of protocol changes. */
+               if (unlikely(major != LUSTRE_MAJOR ||
+                            minor != LUSTRE_MINOR ||
+                            abs(patch - LUSTRE_PATCH) > 3)) {
+                       LCONSOLE_WARN("%s: import %p (%u.%u.%u.%u) tried the "
+                                     "connection to different version MDT "
+                                     "(%d.%d.%d.%d) %s\n",
+                                     imp->imp_obd->obd_name, imp, LUSTRE_MAJOR,
+                                     LUSTRE_MINOR, LUSTRE_PATCH, LUSTRE_FIX,
+                                     major, minor, patch,
+                                     OBD_OCD_VERSION_FIX(ocd->ocd_version),
+                                     imp->imp_connection->c_remote_uuid.uuid);
+
+                       GOTO(out, rc = -EPROTO);
+               }
+       }
+
        if (!exp) {
                /* This could happen if export is cleaned during the
                   connect attempt */
@@ -1400,7 +1418,7 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp)
                {
                struct task_struct *task;
                /* bug 17802:  XXX client_disconnect_export vs connect request
-                * race. if client will evicted at this time, we start
+                * race. if client is evicted at this time then we start
                 * invalidate thread without reference to import and import can
                 * be freed at same time. */
                class_import_get(imp);
@@ -1578,7 +1596,6 @@ void ptlrpc_cleanup_imp(struct obd_import *imp)
 
        EXIT;
 }
-EXPORT_SYMBOL(ptlrpc_cleanup_imp);
 
 /* Adaptive Timeout utils */
 extern unsigned int at_min, at_max, at_history;