Commit 22481d15 authored by Zheng Liu's avatar Zheng Liu Committed by Jiri Slaby

bcache: unregister reboot notifier if bcache fails to unregister device

commit 2ecf0cdb upstream.

In bcache_init() function it forgot to unregister reboot notifier if
bcache fails to unregister a block device.  This commit fixes this.
Signed-off-by: default avatarZheng Liu <wenqing.lz@taobao.com>
Tested-by: default avatarJoshua Schmid <jschmid@suse.com>
Tested-by: default avatarEric Wheeler <bcache@linux.ewheeler.net>
Cc: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 172690be
...@@ -2043,8 +2043,10 @@ static int __init bcache_init(void) ...@@ -2043,8 +2043,10 @@ static int __init bcache_init(void)
closure_debug_init(); closure_debug_init();
bcache_major = register_blkdev(0, "bcache"); bcache_major = register_blkdev(0, "bcache");
if (bcache_major < 0) if (bcache_major < 0) {
unregister_reboot_notifier(&reboot);
return bcache_major; return bcache_major;
}
if (!(bcache_wq = create_workqueue("bcache")) || if (!(bcache_wq = create_workqueue("bcache")) ||
!(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) || !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment