Whamcloud - gitweb
Fix import levels when a reconnect happens without a previous timeout.
authoradilger <adilger>
Tue, 12 Aug 2003 16:13:58 +0000 (16:13 +0000)
committeradilger <adilger>
Tue, 12 Aug 2003 16:13:58 +0000 (16:13 +0000)
b=1597
r=shaver

lustre/mdc/mdc_request.c
lustre/osc/osc_request.c
lustre/ptlrpc/client.c
lustre/ptlrpc/ptlrpc_internal.h
lustre/ptlrpc/recover.c

index cbec10b..27f3717 100644 (file)
@@ -654,11 +654,15 @@ static int mdc_iocontrol(unsigned int cmd, struct lustre_handle *conn, int len,
         struct obd_device *obddev = class_conn2obd(conn);
         struct obd_ioctl_data *data = karg;
         struct obd_import *imp = obddev->u.cli.cl_import;
+        int rc;
         ENTRY;
-
+        
         switch (cmd) {
         case OBD_IOC_CLIENT_RECOVER:
-                RETURN(ptlrpc_recover_import(imp, data->ioc_inlbuf1));
+                rc = ptlrpc_recover_import(imp, data->ioc_inlbuf1);
+                if (rc < 0)
+                        RETURN(rc);
+                RETURN(0);
         case IOC_OSC_SET_ACTIVE:
                 RETURN(ptlrpc_set_import_active(imp, data->ioc_offset));
         default:
index 89061fd..da2999b 100644 (file)
@@ -1817,6 +1817,8 @@ static int osc_iocontrol(unsigned int cmd, struct lustre_handle *conn, int len,
         case OBD_IOC_CLIENT_RECOVER:
                 err = ptlrpc_recover_import(obd->u.cli.cl_import,
                                             data->ioc_inlbuf1);
+                if (err > 0)
+                        err = 0;
                 GOTO(out, err);
         case IOC_OSC_SET_ACTIVE:
                 err = ptlrpc_set_import_active(obd->u.cli.cl_import,
index f9319c0..725d4a1 100644 (file)
@@ -395,7 +395,6 @@ static int ptlrpc_check_status(struct ptlrpc_request *req)
         RETURN(err);
 }
 
-#warning this needs to change after robert fixes eviction handling
 static int after_reply(struct ptlrpc_request *req, int *restartp)
 {
         unsigned long flags;
@@ -443,7 +442,7 @@ static int after_reply(struct ptlrpc_request *req, int *restartp)
                         RETURN(-ENOTCONN);
                 }
 
-                ptlrpc_request_handle_eviction(req);
+                ptlrpc_request_handle_notconn(req);
 
                 if (req->rq_err)
                         RETURN(-EIO);
@@ -1287,7 +1286,6 @@ restart:
                     req->rq_import_generation < imp->imp_generation)
                         rc = -EIO;
 
-
                 if (rc) {
                         spin_unlock_irqrestore(&imp->imp_lock, flags);
                         GOTO(out, rc);
index 8d66c88..a84a29c 100644 (file)
@@ -39,7 +39,7 @@ extern int (*ptlrpc_ldlm_replay_locks)(struct obd_import *);
 int ptlrpc_get_ldlm_hooks(void);
 void ptlrpc_daemonize(void);
 
-void ptlrpc_request_handle_eviction(struct ptlrpc_request *);
+void ptlrpc_request_handle_notconn(struct ptlrpc_request *);
 void lustre_assert_wire_constants(void);
 
 void ptlrpc_lprocfs_register_service(struct obd_device *obddev,
index 70e9b5c..d379aff 100644 (file)
@@ -323,23 +323,32 @@ void ptlrpc_handle_failed_import(struct obd_import *imp)
         EXIT;
 }
 
-void ptlrpc_request_handle_eviction(struct ptlrpc_request *failed_req)
+void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
 {
         int rc;
         struct obd_import *imp= failed_req->rq_import;
         unsigned long flags;
         ENTRY;
 
-        CDEBUG(D_HA, "import %s of %s@%s evicted: reconnecting\n",
+        CDEBUG(D_HA, "import %s of %s@%s abruptly disconnected: reconnecting\n",
                imp->imp_obd->obd_name,
                imp->imp_target_uuid.uuid,
                imp->imp_connection->c_remote_uuid.uuid);
         rc = ptlrpc_recover_import(imp, NULL);
-        if (rc) {
+        if (rc < 0) {
                 ptlrpc_resend_req(failed_req);
                 if (rc != -EALREADY)
                         ptlrpc_handle_failed_import(imp);
+        } else if (rc == RECON_RESULT_RECOVERING) {
+                ptlrpc_resend_req(failed_req);
         } else {
+                if (rc != RECON_RESULT_EVICTED) {
+                        /* like LBUG, without the locking up */
+                        CERROR("unknown recover_import result %d\n", rc);
+                        portals_debug_dumplog();
+                        portals_run_lbug_upcall(__FILE__, __FUNCTION__,
+                                                __LINE__);
+                }
                 LASSERT(failed_req->rq_import_generation < imp->imp_generation);
                 spin_lock_irqsave (&failed_req->rq_lock, flags);
                 failed_req->rq_err = 1;
@@ -555,7 +564,6 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid)
                        imp->imp_target_uuid.uuid,
                        imp->imp_connection->c_remote_uuid.uuid);
                 ptlrpc_set_import_active(imp, 0);
-//                ptlrpc_invalidate_import_state(imp);
         } else {
                 LBUG();
         }
@@ -570,6 +578,8 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid)
 
         ptlrpc_wake_delayed(imp);
         EXIT;
+        if (!rc)
+                rc = recon_result;
  out:
         return rc;
 }