aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBenoît Canet <benoit.canet@nodalink.com>2015-06-25 15:02:57 -0400
committerIlya Dryomov <idryomov@gmail.com>2015-09-08 16:14:28 -0400
commitd920ff6fc7c1ec3d7bd80432bff5575c0ebe426c (patch)
treeeb265cf997abf7109fde1705a4cd7f2266d05e11 /net
parentb79b23682a1649f30960fb5bd920ba46c89a1b14 (diff)
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: Benoît Canet <benoit.canet@nodalink.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/messenger.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index e3be1d22a247..0f9ea60a8971 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -276,22 +276,22 @@ static void _ceph_msgr_exit(void)
276 ceph_msgr_wq = NULL; 276 ceph_msgr_wq = NULL;
277 } 277 }
278 278
279 ceph_msgr_slab_exit();
280
281 BUG_ON(zero_page == NULL); 279 BUG_ON(zero_page == NULL);
282 page_cache_release(zero_page); 280 page_cache_release(zero_page);
283 zero_page = NULL; 281 zero_page = NULL;
282
283 ceph_msgr_slab_exit();
284} 284}
285 285
286int ceph_msgr_init(void) 286int ceph_msgr_init(void)
287{ 287{
288 if (ceph_msgr_slab_init())
289 return -ENOMEM;
290
288 BUG_ON(zero_page != NULL); 291 BUG_ON(zero_page != NULL);
289 zero_page = ZERO_PAGE(0); 292 zero_page = ZERO_PAGE(0);
290 page_cache_get(zero_page); 293 page_cache_get(zero_page);
291 294
292 if (ceph_msgr_slab_init())
293 return -ENOMEM;
294
295 /* 295 /*
296 * The number of active work items is limited by the number of 296 * The number of active work items is limited by the number of
297 * connections, so leave @max_active at default. 297 * connections, so leave @max_active at default.