Whamcloud - gitweb
- Fix the mdc_replay_open fixup so that it updates the handle in the Lustre
[fs/lustre-release.git] / lustre / ptlrpc / rpc.c
index ceefc33..25d6449 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/obd_class.h>
 #include <linux/lustre_lib.h>
 #include <linux/lustre_ha.h>
+#include <linux/lustre_net.h>
 #include <linux/init.h>
 
 extern int ptlrpc_init_portals(void);
@@ -120,11 +121,21 @@ int connmgr_iocontrol(long cmd, struct lustre_handle *hdl, int len, void *karg,
                 goto out;
         }
 
+
         /* else (NEWCONN) */
-        if (conn->c_recovd_data.rd_phase != RD_PREPARING)
+        spin_lock(&conn->c_lock);
+
+        /* whatever happens, reset the INVALID flag */
+        conn->c_flags &= ~CONN_INVALID;
+
+        /* XXX is this a good check?  should we allow readdressing of
+         * XXX conns that aren't in recovery?
+         */
+        if (conn->c_recovd_data.rd_phase != RD_PREPARING) {
+                spin_unlock(&conn->c_lock);
                 GOTO(out, rc = -EALREADY);
+        }
 
-        spin_lock(&conn->c_lock);
         if (data->ioc_inllen2) {
                 CERROR("conn %p UUID change %s -> %s\n",
                        conn, conn->c_remote_uuid, data->ioc_inlbuf2);
@@ -143,13 +154,19 @@ int connmgr_iocontrol(long cmd, struct lustre_handle *hdl, int len, void *karg,
         RETURN(rc);
 }
 
+static int connmgr_connect(struct lustre_handle *conn, struct obd_device *src,
+                           obd_uuid_t cluuid, struct recovd_obd *recovd,
+                           ptlrpc_recovery_cb_t recover)
+{
+        return class_connect(conn, src, cluuid);
+}
 
 /* use obd ops to offer management infrastructure */
 static struct obd_ops recovd_obd_ops = {
         o_setup:       connmgr_setup,
         o_cleanup:     connmgr_cleanup,
         o_iocontrol:   connmgr_iocontrol,
-        o_connect:     class_connect,
+        o_connect:     connmgr_connect,
         o_disconnect:  class_disconnect
 };
 
@@ -227,8 +244,9 @@ EXPORT_SYMBOL(lustre_msg_size);
 EXPORT_SYMBOL(lustre_unpack_msg);
 EXPORT_SYMBOL(lustre_msg_buf);
 
-EXPORT_SYMBOL(ll_recover);
-
+/* recover.c */
+EXPORT_SYMBOL(ptlrpc_run_recovery_upcall);
+EXPORT_SYMBOL(ptlrpc_reconnect_and_replay);
 
 MODULE_AUTHOR("Cluster File Systems, Inc <info@clusterfs.com>");
 MODULE_DESCRIPTION("Lustre Request Processor v1.0");