ceph: warn on allocation from msgpool with larger front_len

Pass the front_len we need when pulling a message off a msgpool,
and WARN if it is greater than the pool's size.  Then try to
allocate a new message (to continue without failing).

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil
2009-10-14 17:36:07 -07:00
parent 07bd10fb98
commit 8f3bc053c6
4 changed files with 26 additions and 9 deletions

View File

@@ -639,14 +639,15 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
{
struct ceph_mon_client *monc = con->private;
int type = le16_to_cpu(hdr->type);
int front = le32_to_cpu(hdr->front_len);
switch (type) {
case CEPH_MSG_CLIENT_MOUNT_ACK:
return ceph_msgpool_get(&monc->msgpool_mount_ack);
return ceph_msgpool_get(&monc->msgpool_mount_ack, front);
case CEPH_MSG_MON_SUBSCRIBE_ACK:
return ceph_msgpool_get(&monc->msgpool_subscribe_ack);
return ceph_msgpool_get(&monc->msgpool_subscribe_ack, front);
case CEPH_MSG_STATFS_REPLY:
return ceph_msgpool_get(&monc->msgpool_statfs_reply);
return ceph_msgpool_get(&monc->msgpool_statfs_reply, front);
}
return ceph_alloc_msg(con, hdr);
}