Whamcloud - gitweb
LU-8089 lwp: change lwp export only at first connect 26/13726/9
authorMikhail Pershin <mike.pershin@intel.com>
Thu, 20 Aug 2015 18:59:02 +0000 (21:59 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 25 Oct 2016 02:23:03 +0000 (02:23 +0000)
Fix lwp connection logic, change export only at first
connection.

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: I5b528c2f6d142b8cfdd8d84f3f540289e45d557f
Reviewed-on: http://review.whamcloud.com/13726
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ldlm/ldlm_lib.c

index 680a03f..65b177b 100644 (file)
@@ -952,7 +952,7 @@ int target_handle_connect(struct ptlrpc_request *req)
         int rc = 0;
         char *target_start;
         int target_len;
-       bool     mds_conn = false, lw_client = false;
+       bool     mds_conn = false, lw_client = false, initial_conn = false;
        bool     mds_mds_conn = false;
        bool     new_mds_mds_conn = false;
        bool     target_referenced = false;
@@ -1084,6 +1084,7 @@ int target_handle_connect(struct ptlrpc_request *req)
        lw_client = (data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0;
 
        if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_INITIAL) {
+               initial_conn = true;
                mds_conn = (data->ocd_connect_flags & OBD_CONNECT_MDS) != 0;
                mds_mds_conn = (data->ocd_connect_flags &
                                OBD_CONNECT_MDS_MDS) != 0;
@@ -1141,8 +1142,8 @@ int target_handle_connect(struct ptlrpc_request *req)
                class_export_put(export);
                export = NULL;
                rc = -EALREADY;
-       } else if ((mds_conn || lw_client ||
-                   data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
+       } else if ((mds_conn || (lw_client && initial_conn) ||
+                  data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
                   export->exp_connection != NULL) {
                spin_unlock(&export->exp_lock);
                if (req->rq_peer.nid != export->exp_connection->c_peer.nid) {
@@ -1178,10 +1179,8 @@ int target_handle_connect(struct ptlrpc_request *req)
                        export = NULL;
                        rc = 0;
                }
-        } else if (export->exp_connection != NULL &&
-                   req->rq_peer.nid != export->exp_connection->c_peer.nid &&
-                   (lustre_msg_get_op_flags(req->rq_reqmsg) &
-                    MSG_CONNECT_INITIAL)) {
+       } else if (export->exp_connection != NULL && initial_conn &&
+                  req->rq_peer.nid != export->exp_connection->c_peer.nid) {
                spin_unlock(&export->exp_lock);
                /* In MDS failover we have static UUID but NID can change. */
                 LCONSOLE_WARN("%s: Client %s seen on new nid %s when "