linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mm/zsmalloc: avoid unregister a NOT-registered zsmalloc zpool driver
@ 2014-11-13 13:37 Mahendran Ganesh
  2014-11-13 13:37 ` [PATCH 2/3] mm/zsmalloc: add __init/__exit to zs_init/zs_exit Mahendran Ganesh
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mahendran Ganesh @ 2014-11-13 13:37 UTC (permalink / raw)
  To: minchan, ngupta, ddstreet, sergey.senozhatsky
  Cc: linux-mm, linux-kernel, Mahendran Ganesh

Now zsmalloc can be registered as a zpool driver into zpool when
CONFIG_ZPOOL is enabled. During the init of zsmalloc, when error happens,
we need to do cleanup. But in current code, it will unregister a not yet
registered zsmalloc zpool driver(*zs_zpool_driver*).

This patch puts the cleanup in zs_init() instead of calling zs_exit()
where it will unregister a not-registered zpool driver.

Signed-off-by: Mahendran Ganesh <opensource.ganesh@gmail.com>
---
 mm/zsmalloc.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 839a48c..3d2bb36 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -907,10 +907,8 @@ static int zs_init(void)
 	__register_cpu_notifier(&zs_cpu_nb);
 	for_each_online_cpu(cpu) {
 		ret = zs_cpu_notifier(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
-		if (notifier_to_errno(ret)) {
-			cpu_notifier_register_done();
+		if (notifier_to_errno(ret))
 			goto fail;
-		}
 	}
 
 	cpu_notifier_register_done();
@@ -920,8 +918,14 @@ static int zs_init(void)
 #endif
 
 	return 0;
+
 fail:
-	zs_exit();
+	for_each_online_cpu(cpu)
+		zs_cpu_notifier(NULL, CPU_UP_CANCELED, (void *)(long)cpu);
+	__unregister_cpu_notifier(&zs_cpu_nb);
+
+	cpu_notifier_register_done();
+
 	return notifier_to_errno(ret);
 }
 
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-11-14 12:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13 13:37 [PATCH 1/3] mm/zsmalloc: avoid unregister a NOT-registered zsmalloc zpool driver Mahendran Ganesh
2014-11-13 13:37 ` [PATCH 2/3] mm/zsmalloc: add __init/__exit to zs_init/zs_exit Mahendran Ganesh
2014-11-14 12:59   ` Sergey Senozhatsky
2014-11-13 13:37 ` [PATCH 3/3] mm/zsmalloc: adjust zs_init/zs_exit location Mahendran Ganesh
2014-11-13 15:22 ` [PATCH 1/3] mm/zsmalloc: avoid unregister a NOT-registered zsmalloc zpool driver Sergey Senozhatsky
2014-11-13 15:30   ` Sergey Senozhatsky
2014-11-13 22:31     ` Sergey Senozhatsky
2014-11-13 23:29       ` Minchan Kim
2014-11-13 23:38   ` Ganesh Mahendran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).