Whamcloud - gitweb
LU-4214 target: LWP failover should create new export 65/8465/5
authorMikhail Pershin <mike.pershin@intel.com>
Tue, 3 Dec 2013 13:30:15 +0000 (17:30 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 11 Jun 2014 02:44:04 +0000 (02:44 +0000)
Upon reconnection from new NID LWP client need to create new
export and destroy old one like that is done for MDS connection

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: Id21a742a978f629e2324bc568a1a50c2922fe3cc
Reviewed-on: http://review.whamcloud.com/8465
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
lustre/ldlm/ldlm_lib.c

index a3769d5..c5067ad 100644 (file)
@@ -908,12 +908,11 @@ int target_handle_connect(struct ptlrpc_request *req)
                }
        }
 
-        if ((lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_INITIAL) &&
-            (data->ocd_connect_flags & OBD_CONNECT_MDS))
-               mds_conn = true;
-
-       if ((data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0)
-               lw_client = true;
+       if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_INITIAL) {
+               mds_conn = (data->ocd_connect_flags & OBD_CONNECT_MDS) != 0;
+               lw_client = (data->ocd_connect_flags &
+                            OBD_CONNECT_LIGHTWEIGHT) != 0;
+       }
 
         /* lctl gets a backstage, all-access pass. */
         if (obd_uuid_equals(&cluuid, &target->obd_uuid))
@@ -935,19 +934,21 @@ int target_handle_connect(struct ptlrpc_request *req)
                class_export_put(export);
                export = NULL;
                rc = -EALREADY;
-       } else if (mds_conn && export->exp_connection) {
+       } else if ((mds_conn || lw_client) && export->exp_connection != NULL) {
                spin_unlock(&export->exp_lock);
-                if (req->rq_peer.nid != export->exp_connection->c_peer.nid)
-                       /* MDS reconnected after failover. */
-                       LCONSOLE_WARN("%s: Received MDS connection from "
+               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, libcfs_nid2str(req->rq_peer.nid),
+                           target->obd_name, mds_conn ? "MDS" : "LWP",
+                           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 MDS connection from "
-                            "%s, removing former export from same NID\n",
-                            target->obd_name, libcfs_nid2str(req->rq_peer.nid));
+                       LCONSOLE_WARN("%s: Received new %s connection from "
+                               "%s, removing former export from same NID\n",
+                               target->obd_name, mds_conn ? "MDS" : "LWP",
+                               libcfs_nid2str(req->rq_peer.nid));
                 class_fail_export(export);
                 class_export_put(export);
                 export = NULL;