Skip to contentSkip to conversation

libceph: Avoid holding the zero page on ceph_msgr_slab_init errors

PATCH New Benoît Canet 1 participant 1 message Jun 25, 2015 Ceph common code (libceph)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 it's 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.

---
 net/ceph/messenger.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
net/ceph/messenger.c +5 -5
index 38f06a4..ec68cd3 100644
@@ -275,22 +275,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.
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html