提交 d920ff6f 编写于 作者: B Benoît Canet 提交者: Ilya Dryomov

libceph: Avoid holding the zero page on ceph_msgr_slab_init errors

ceph_msgr_slab_init may fail due to a temporary ENOMEM.

Delay a bit the initialization of zero_page in ceph_msgr_init and
reorder its cleanup in _ceph_msgr_exit so it's done in reverse
order of setup.

BUG_ON() will not suffer to be postponed in case it is triggered.
Signed-off-by: NBenoît Canet <benoit.canet@nodalink.com>
Reviewed-by: NAlex Elder <elder@linaro.org>
Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
上级 b79b2368
......@@ -276,22 +276,22 @@ static void _ceph_msgr_exit(void)
ceph_msgr_wq = NULL;
}
ceph_msgr_slab_exit();
BUG_ON(zero_page == NULL);
page_cache_release(zero_page);
zero_page = NULL;
ceph_msgr_slab_exit();
}
int ceph_msgr_init(void)
{
if (ceph_msgr_slab_init())
return -ENOMEM;
BUG_ON(zero_page != NULL);
zero_page = ZERO_PAGE(0);
page_cache_get(zero_page);
if (ceph_msgr_slab_init())
return -ENOMEM;
/*
* The number of active work items is limited by the number of
* connections, so leave @max_active at default.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册