Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Fri, 24 Feb 2006 18:33:36 +0000 (18:33 +0000)
committernathan <nathan>
Fri, 24 Feb 2006 18:33:36 +0000 (18:33 +0000)
b=8007
Kick the mgs import a little harder.  If an mgs/mdt was restarted on a node
with a live mgc, the mgc wouldn't reconnect to the newly restarted
mgs. Throwing the ptlrpc_invalidate_import in there gives it a little more
incentive to reconnect - the mgs mount still gets EIO the first time, but
if you try it again it works.  I need help from somebody with more
knowledge of all these ptlrpc_ fns.

lustre/lov/lov_obd.c
lustre/mgc/mgc_request.c
lustre/obdclass/llog_obd.c
lustre/ptlrpc/import.c
lustre/ptlrpc/recover.c

index cbaff42..082aa2c 100644 (file)
@@ -128,6 +128,8 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
 
         if (activate) {
                 tgt_obd->obd_no_recov = 0;
+                /* FIXME this is probably supposed to be 
+                   ptlrpc_set_import_active.  Horrible naming. */
                 ptlrpc_activate_import(tgt_obd->u.cli.cl_import);
         }
 
index 8aa55db..878961f 100644 (file)
@@ -82,7 +82,7 @@ static spinlock_t       config_list_lock = SPIN_LOCK_UNLOCKED;
 static int config_log_get(struct config_llog_data *cld)
 {
         ENTRY;
-        CDEBUG(D_MGC, "log %s refs %d\n", cld->cld_logname,
+        CDEBUG(D_INFO, "log %s refs %d\n", cld->cld_logname,
                atomic_read(&cld->cld_refcount));
         atomic_inc(&cld->cld_refcount);
         if (cld->cld_stopping) {
@@ -95,7 +95,7 @@ static int config_log_get(struct config_llog_data *cld)
 static void config_log_put(struct config_llog_data *cld)
 {
         ENTRY;
-        CDEBUG(D_MGC, "log %s refs %d\n", cld->cld_logname,
+        CDEBUG(D_INFO, "log %s refs %d\n", cld->cld_logname,
                atomic_read(&cld->cld_refcount));
         if (atomic_dec_and_test(&cld->cld_refcount)) {
                 CDEBUG(D_MGC, "dropping config log %s\n", cld->cld_logname);
@@ -663,11 +663,13 @@ int mgc_set_info(struct obd_export *exp, obd_count keylen,
                                imp->imp_deactive, imp->imp_invalid, 
                                imp->imp_state);
                         /* can't put this in obdclass, module loop with ptlrpc*/
-                        /* remove 'invalid' flag */
+                        /* This seems to be necessary when restarting a 
+                           combo mgs/mdt while the mgc is alive */
+                        ptlrpc_invalidate_import(imp);
+                        /* Remove 'invalid' flag */
                         ptlrpc_activate_import(imp);
-                        /* reconnect */
-                        ptlrpc_set_import_active(imp, 1);
-                        //ptlrpc_recover_import(imp);
+                        /* Attempt a new connect */
+                        ptlrpc_recover_import(imp, NULL);
                 }
                 RETURN(0);
         }
@@ -714,6 +716,7 @@ static int mgc_import_event(struct obd_device *obd,
         int rc = 0;
 
         LASSERT(imp->imp_obd == obd);
+        CDEBUG(D_MGC, "import event %d\n", event);
 
         switch (event) {
         case IMP_EVENT_INVALIDATE: {
index 40d548e..6d5cbb4 100644 (file)
@@ -77,7 +77,8 @@ int llog_setup(struct obd_device *obd, int index, struct obd_device *disk_obd,
            setup does, because the lov/osc must clean up only when they are
            done, not when the mdt is done. So instead, we just assume that
            if the lov llogs are already set up then we must cleanup first. */
-                CERROR("obd %s ctxt %d already set up\n", obd->obd_name, index);
+                CDEBUG(D_CONFIG, "obd %s ctxt %d already set up\n", 
+                       obd->obd_name, index);
                 llog_cleanup(obd->obd_llog_ctxt[index]);
         }
 
index 4c1cdb6..f64addf 100644 (file)
@@ -206,6 +206,7 @@ void ptlrpc_invalidate_import(struct obd_import *imp)
         obd_import_event(imp->imp_obd, imp, IMP_EVENT_INVALIDATE);
 }
 
+/* unset imp_invalid */
 void ptlrpc_activate_import(struct obd_import *imp)
 {
         struct obd_device *obd = imp->imp_obd;
index 54555bb..ddc16e7 100644 (file)
@@ -305,6 +305,7 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
 }
 
 /*
+ * Administratively active/deactive a client. 
  * This should only be called by the ioctl interface, currently
  * with the lctl deactivate and activate commands.
  */
@@ -335,6 +336,7 @@ int ptlrpc_set_import_active(struct obd_import *imp, int active)
         RETURN(rc);
 }
 
+/* Attempt to reconnect an import */
 int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid)
 {
         int rc;
@@ -372,6 +374,7 @@ static int ptlrpc_recover_import_no_retry(struct obd_import *imp,
         ENTRY;
 
         spin_lock_irqsave(&imp->imp_lock, flags);
+        /* Check if reconnect is already in progress */
         if (imp->imp_state != LUSTRE_IMP_DISCON) {
                 in_recovery = 1;
         }