staging/lustre/ldlm: In ldlm_pools_fini make sure there was init first.
authorOleg Drokin <green@linuxhacker.ru>
Mon, 6 Jul 2015 16:48:41 +0000 (12:48 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jul 2015 02:47:19 +0000 (19:47 -0700)
It turns out if you call ldlm_pools_fini without completing the
ldlm_pools_init, then attempt to unregister not yet registered
shrinkers makes the kernel very unhappy.
So make sure we have them registered first.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c

index 4519d779a0ef7b924d2149d6685a1a7daff20608..c234acb85f10063cef7aa0a8c9b8f71c8519b8b2 100644 (file)
@@ -1486,8 +1486,10 @@ EXPORT_SYMBOL(ldlm_pools_init);
 
 void ldlm_pools_fini(void)
 {
-       unregister_shrinker(&ldlm_pools_srv_shrinker);
-       unregister_shrinker(&ldlm_pools_cli_shrinker);
+       if (ldlm_pools_thread) {
+               unregister_shrinker(&ldlm_pools_srv_shrinker);
+               unregister_shrinker(&ldlm_pools_cli_shrinker);
+       }
        ldlm_pools_thread_stop();
 }
 EXPORT_SYMBOL(ldlm_pools_fini);