Whamcloud - gitweb
LU-3810 obd: Cleanup client import if client_obd_setup fails
[fs/lustre-release.git] / lustre / ldlm / ldlm_lib.c
index 961faea..6b18781 100644 (file)
@@ -370,6 +370,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
        cfs_atomic_set(&cli->cl_lru_in_list, 0);
        CFS_INIT_LIST_HEAD(&cli->cl_lru_list);
        client_obd_list_lock_init(&cli->cl_lru_list_lock);
+       cfs_atomic_set(&cli->cl_unstable_count, 0);
 
        init_waitqueue_head(&cli->cl_destroy_waitq);
        cfs_atomic_set(&cli->cl_destroy_in_flight, 0);
@@ -472,15 +473,16 @@ EXPORT_SYMBOL(client_obd_setup);
 
 int client_obd_cleanup(struct obd_device *obddev)
 {
-        ENTRY;
+       ENTRY;
 
-        ldlm_namespace_free_post(obddev->obd_namespace);
-        obddev->obd_namespace = NULL;
+       ldlm_namespace_free_post(obddev->obd_namespace);
+       obddev->obd_namespace = NULL;
 
-        LASSERT(obddev->u.cli.cl_import == NULL);
+       obd_cleanup_client_import(obddev);
+       LASSERT(obddev->u.cli.cl_import == NULL);
 
-        ldlm_put_ref();
-        RETURN(0);
+       ldlm_put_ref();
+       RETURN(0);
 }
 EXPORT_SYMBOL(client_obd_cleanup);
 
@@ -1995,8 +1997,8 @@ static int target_recovery_thread(void *arg)
         thread->t_env = env;
         thread->t_id = -1; /* force filter_iobuf_get/put to use local buffers */
         env->le_ctx.lc_thread = thread;
-        thread->t_data = NULL;
-        thread->t_watchdog = NULL;
+       tgt_io_thread_init(thread); /* init thread_big_cache for IO requests */
+       thread->t_watchdog = NULL;
 
        CDEBUG(D_HA, "%s: started recovery thread pid %d\n", obd->obd_name,
               current_pid());
@@ -2091,9 +2093,10 @@ static int target_recovery_thread(void *arg)
         trd->trd_processing_task = 0;
        complete(&trd->trd_finishing);
 
-        OBD_FREE_PTR(thread);
-        OBD_FREE_PTR(env);
-        RETURN(rc);
+       tgt_io_thread_done(thread);
+       OBD_FREE_PTR(thread);
+       OBD_FREE_PTR(env);
+       RETURN(rc);
 }
 
 static int target_start_recovery_thread(struct lu_target *lut,