Whamcloud - gitweb
LU-14876 out: don't connect to busy MDS-MDS export
[fs/lustre-release.git] / lustre / ldlm / ldlm_lib.c
index 4d37048..4f29756 100644 (file)
@@ -1203,13 +1203,12 @@ int target_handle_connect(struct ptlrpc_request *req)
         * processing, so we needs to allow lw_client to be connected at
         * anytime, instead of only the initial connection
         */
-       lw_client = (data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0;
+       lw_client = OCD_HAS_FLAG(data, LIGHTWEIGHT);
 
        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;
+               mds_conn = OCD_HAS_FLAG(data, MDS);
+               mds_mds_conn = OCD_HAS_FLAG(data, MDS_MDS);
 
                /*
                 * OBD_CONNECT_MNE_SWAB is removed at 2.14
@@ -1267,26 +1266,27 @@ int target_handle_connect(struct ptlrpc_request *req)
                export = NULL;
                rc = -EALREADY;
        } else if ((mds_conn || (lw_client && initial_conn) ||
-                  data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
-                  export->exp_connection != NULL) {
+                  OCD_HAS_FLAG(data, MDS_MDS)) && export->exp_connection) {
                spin_unlock(&export->exp_lock);
                if (req->rq_peer.nid != export->exp_connection->c_peer.nid) {
                        /* MDS or LWP reconnected after failover. */
                        LCONSOLE_WARN("%s: Received %s connection from %s, removing former export from %s\n",
                                      target->obd_name,
-                                     mds_conn ? "MDS" : "LWP",
+                                     lw_client ? "LWP" : "MDS",
                                      libcfs_nid2str(req->rq_peer.nid),
                                      libcfs_nid2str(export->exp_connection->c_peer.nid));
                } else {
-                       /* New MDS connection from the same NID. */
-                       LCONSOLE_WARN("%s: Received new %s connection from %s, removing former export from same NID\n",
+                       /* New connection from the same NID. */
+                       LCONSOLE_WARN("%s: Received new %s connection from %s, %s former export from same NID\n",
                                      target->obd_name,
-                                     mds_conn ? "MDS" : "LWP",
-                                     libcfs_nid2str(req->rq_peer.nid));
+                                     lw_client ? "LWP" : "MDS",
+                                     libcfs_nid2str(req->rq_peer.nid),
+                                     OCD_HAS_FLAG(data, MDS_MDS) ?
+                                     "keep" : "remove");
                }
 
                if (req->rq_peer.nid == export->exp_connection->c_peer.nid &&
-                   data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) {
+                   OCD_HAS_FLAG(data, MDS_MDS)) {
                        /*
                         * Because exports between MDTs will always be
                         * kept, let's do not fail such export if they