From: Sage Weil Date: Fri, 18 Sep 2009 21:04:50 +0000 (-0700) Subject: kclient: fall back to WARN + new allocation if msgpool is depleted X-Git-Tag: v0.15~29 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d0efb5a7f559aaa618e21195c458ff4f3169f024;p=ceph.git kclient: fall back to WARN + new allocation if msgpool is depleted --- diff --git a/src/kernel/msgpool.c b/src/kernel/msgpool.c index d4c1ed18d86..9c91fe0f88d 100644 --- a/src/kernel/msgpool.c +++ b/src/kernel/msgpool.c @@ -106,10 +106,6 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msg_pool *pool) wait_queue_t wait; struct ceph_msg *msg; - msg = ceph_msg_new(0, pool->front_len, 0, 0, NULL); - if (!IS_ERR(msg)) - return msg; - while (1) { spin_lock(&pool->lock); if (likely(pool->num)) { @@ -126,6 +122,13 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msg_pool *pool) pool->min, pool->blocking ? "waiting" : "failing"); spin_unlock(&pool->lock); + WARN_ON(1); + + /* maybe we can allocate it now? */ + msg = ceph_msg_new(0, pool->front_len, 0, 0, NULL); + if (!IS_ERR(msg)) + return msg; + if (!pool->blocking) return ERR_PTR(-ENOMEM);