Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Tue, 22 Nov 2005 22:48:14 +0000 (22:48 +0000)
committernathan <nathan>
Tue, 22 Nov 2005 22:48:14 +0000 (22:48 +0000)
b=8007
too quick with the blocking connect commit; should have updated from b1_4 first

lustre/include/linux/lustre_idl.h
lustre/include/linux/lustre_net.h
lustre/ldlm/ldlm_lib.c
lustre/obdclass/obd_mount.c
lustre/ptlrpc/import.c

index cb442d5..4b0783f 100644 (file)
@@ -212,8 +212,7 @@ static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags)
 
 /* Connect flags */
 
-#define OBD_CONNECT_RDONLY      0x01ULL
-#define OBD_CONNECT_BLOCK       0x02ULL /* block until connect completes */
+#define OBD_CONNECT_RDONLY       0x1ULL
 #define OBD_CONNECT_SRVLOCK     0x10ULL /* server takes locks for client */
 
 #define MDS_CONNECT_SUPPORTED  (OBD_CONNECT_RDONLY)
index a0b31c4..420d6ed 100644 (file)
@@ -722,7 +722,6 @@ int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid);
 int ptlrpc_init_import(struct obd_import *imp);
 int ptlrpc_disconnect_import(struct obd_import *imp);
 int ptlrpc_import_recovery_state_machine(struct obd_import *imp);
-int ptlrpc_wait_for_connect(struct obd_import *imp);
 
 /* ptlrpc/pack_generic.c */
 int lustre_msg_swabbed(struct lustre_msg *msg);
index 65ef958..79f5a22 100644 (file)
@@ -408,6 +408,7 @@ int client_connect_import(struct lustre_handle *dlm_handle,
         }
 
         ptlrpc_pinger_add_import(imp);
+        EXIT;
 
         if (rc) {
 out_ldlm:
@@ -421,21 +422,7 @@ out_disco:
         }
 out_sem:
         up(&cli->cl_sem);
-
-        if (!rc && (ocd->ocd_connect_flags & OBD_CONNECT_BLOCK)) {
-                rc = ptlrpc_wait_for_connect(imp);
-                if (rc) {
-                        CERROR("Blocking connect failed %d, disconnecting\n",
-                               rc);
-                        /* connection was fully set up; do the full 
-                           disconnect.  We already dropped our ref above 
-                           though, so take another. */
-                        exp = class_conn2export(dlm_handle);
-                        client_disconnect_export(exp);
-                }
-        }
-
-        RETURN(rc);
+        return rc;
 }
 
 int client_disconnect_export(struct obd_export *exp)
@@ -482,6 +469,7 @@ int client_disconnect_export(struct obd_export *exp)
         else
                 rc = ptlrpc_disconnect_import(imp);
 
+        EXIT;
  out_no_disconnect:
         err = class_disconnect(exp);
         if (!rc && err)
index b8b5e7a..f54d94d 100644 (file)
@@ -261,7 +261,7 @@ static int parse_disk_data(struct lvfs_run_ctxt *mount_ctxt,
         len = file->f_dentry->d_inode->i_size;
         CDEBUG(D_MOUNT, "Have %s, size %lu\n", MOUNT_DATA_FILE, len);
         if (len != sizeof(*ldd)) {
-                CERROR("disk data size does not match: see %lu expect %u\n", 
+                CERROR("disk data size does not match: see %lu expect %lu\n", 
                        len, sizeof(*ldd));
                 GOTO(out_close, err = -EINVAL);
         }
@@ -345,20 +345,14 @@ int lustre_get_process_log(struct super_block *sb, char *profile,
         struct lustre_handle mgc_conn = {0, };
         struct obd_export *exp = NULL;
         struct llog_ctxt *ctxt;
-        struct obd_connect_data ocd;
-        struct obd_import *imp = mgc->u.cli.cl_import;
-
         int err, rc;
         LASSERT(mgc);
 
         CDEBUG(D_MOUNT, "parsing config log %s\n", profile);
 
-        ocd.ocd_connect_flags = OBD_CONNECT_BLOCK;
-        err = obd_connect(&mgc_conn, mgc, &(mgc->obd_uuid), &ocd);
+        err = obd_connect(&mgc_conn, mgc, &(mgc->obd_uuid), NULL);
         if (!err) {
-                /* Take a reference */
                 exp = class_conn2export(&mgc_conn);
-                LASSERT(exp->exp_obd == mgc);
                 ctxt = llog_get_context(exp->exp_obd, LLOG_CONFIG_REPL_CTXT);
         } else {
                 /* If we couldn't connect to the MGS, try reading a copy
index 3ac567a..a2e7dbb 100644 (file)
@@ -248,35 +248,6 @@ void ptlrpc_fail_import(struct obd_import *imp, int generation)
         EXIT;
 }
 
-/* still trying to connect */
-static int ptlrpc_import_in_connect(struct obd_import *imp)
-{
-        unsigned long flags;
-        int in_connect = 0;
-        spin_lock_irqsave(&imp->imp_lock, flags);
-        if (!imp->imp_invalid && 
-            (imp->imp_state == LUSTRE_IMP_CONNECTING ||
-             imp->imp_state == LUSTRE_IMP_DISCON))
-                in_connect = 1;
-        spin_unlock_irqrestore(&imp->imp_lock, flags);
-        return in_connect;
-}
-
-int ptlrpc_wait_for_connect(struct obd_import *imp)
-{
-        struct l_wait_info lwi;
-        int err;
-
-        lwi = LWI_INTR(NULL, NULL);
-        err = l_wait_event(imp->imp_recovery_waitq,
-                           !ptlrpc_import_in_connect(imp), &lwi);
-        CERROR("wait got %d (%s, %d)\n", err,
-               ptlrpc_import_state_name(imp->imp_state),
-               imp->imp_invalid);
-        return (imp->imp_invalid ? -ETIMEDOUT : 0);
-}
-EXPORT_SYMBOL(ptlrpc_wait_for_connect);
-
 static int import_select_connection(struct obd_import *imp)
 {
         struct obd_import_conn *imp_conn;
@@ -328,7 +299,7 @@ static int import_select_connection(struct obd_import *imp)
 int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid)
 {
         struct obd_device *obd = imp->imp_obd;
-        int initial_connect = 0, first_try;
+        int initial_connect = 0;
         int rc;
         __u64 committed_before_reconnect = 0;
         struct ptlrpc_request *request;
@@ -380,28 +351,10 @@ int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid)
                         GOTO(out, rc);
         }
 
-        first_try = (imp->imp_conn_current == NULL);
         rc = import_select_connection(imp);
         if (rc)
                 GOTO(out, rc);
 
-        if ((imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_BLOCK) &&
-            initial_connect && !first_try &&  
-            (imp->imp_conn_current == list_entry(imp->imp_conn_list.next,
-                                                 struct obd_import_conn,
-                                                 oic_item))) {
-                /* Never connected, tried everyone, and nobody answered. 
-                   Give up; in-progress ops will fail (probably EIO) */
-                LCONSOLE_ERROR("All %d connections for %s failed; I am "
-                               "deactivating the import.\n",
-                               imp->imp_conn_cnt - 1,
-                               imp->imp_target_uuid.uuid);
-                ptlrpc_deactivate_import(imp);
-                /* for ptlrpc_wait_for_connect */
-                wake_up(&imp->imp_recovery_waitq);
-                GOTO(out, rc = -ETIMEDOUT);
-        }
-
         request = ptlrpc_prep_req(imp, imp->imp_connect_op, 4, size, tmp);
         if (!request)
                 GOTO(out, rc = -ENOMEM);