Whamcloud - gitweb
LU-3810 obd: Cleanup client import if client_obd_setup fails
[fs/lustre-release.git] / lustre / mgc / mgc_request.c
index 5c130be..64ab255 100644 (file)
@@ -501,6 +501,7 @@ static DECLARE_COMPLETION(rq_exit);
 
 static void do_requeue(struct config_llog_data *cld)
 {
+       int rc = 0;
         ENTRY;
         LASSERT(cfs_atomic_read(&cld->cld_refcount) > 0);
 
@@ -508,13 +509,15 @@ static void do_requeue(struct config_llog_data *cld)
            export which is being disconnected. Take the client
            semaphore to make the check non-racy. */
        down_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem);
-        if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
-                CDEBUG(D_MGC, "updating log %s\n", cld->cld_logname);
-                mgc_process_log(cld->cld_mgcexp->exp_obd, cld);
-        } else {
-                CDEBUG(D_MGC, "disconnecting, won't update log %s\n",
-                       cld->cld_logname);
-        }
+       if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
+               CDEBUG(D_MGC, "updating log %s\n", cld->cld_logname);
+               rc = mgc_process_log(cld->cld_mgcexp->exp_obd, cld);
+               if (rc && rc != -ENOENT)
+                       CERROR("failed processing log: %d\n", rc);
+       } else {
+               CDEBUG(D_MGC, "disconnecting, won't update log %s\n",
+                      cld->cld_logname);
+       }
        up_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem);
 
         EXIT;
@@ -890,27 +893,27 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
        struct lprocfs_static_vars      lvars;
        int                             rc;
-        ENTRY;
+       ENTRY;
 
        rc = ptlrpcd_addref();
        if (rc < 0)
                RETURN(rc);
 
-        rc = client_obd_setup(obd, lcfg);
-        if (rc)
-                GOTO(err_decref, rc);
+       rc = client_obd_setup(obd, lcfg);
+       if (rc)
+               GOTO(err_decref, rc);
 
        rc = mgc_llog_init(NULL, obd);
-        if (rc) {
-                CERROR("failed to setup llogging subsystems\n");
-                GOTO(err_cleanup, rc);
-        }
+       if (rc) {
+               CERROR("failed to setup llogging subsystems\n");
+               GOTO(err_cleanup, rc);
+       }
 
-        lprocfs_mgc_init_vars(&lvars);
-        lprocfs_obd_setup(obd, lvars.obd_vars);
-        sptlrpc_lprocfs_cliobd_attach(obd);
+       lprocfs_mgc_init_vars(&lvars);
+       lprocfs_obd_setup(obd, lvars.obd_vars);
+       sptlrpc_lprocfs_cliobd_attach(obd);
 
-        if (cfs_atomic_inc_return(&mgc_count) == 1) {
+       if (cfs_atomic_inc_return(&mgc_count) == 1) {
                rq_state = 0;
                init_waitqueue_head(&rq_waitq);
 
@@ -925,15 +928,15 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                }
                /* rc is the task_struct pointer of mgc_requeue_thread. */
                rc = 0;
-        }
+       }
 
-        RETURN(rc);
+       RETURN(rc);
 
 err_cleanup:
-        client_obd_cleanup(obd);
+       client_obd_cleanup(obd);
 err_decref:
-        ptlrpcd_decref();
-        RETURN(rc);
+       ptlrpcd_decref();
+       RETURN(rc);
 }
 
 /* based on ll_mdc_blocking_ast */