aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/osd_client.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-10-14 20:36:07 -0400
committerSage Weil <sage@newdream.net>2009-10-15 21:14:43 -0400
commit8f3bc053c610826a657714649ea596f07875db2e (patch)
tree97823cb2a202439bb9f9839e2d326ac95d728dd0 /fs/ceph/osd_client.c
parent07bd10fb9853a41a7f0bb271721cca97d15eccae (diff)
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>
Diffstat (limited to 'fs/ceph/osd_client.c')
-rw-r--r--fs/ceph/osd_client.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index bbd9a5d23712..0a254054a82a 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -161,7 +161,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
161 if (snapc) 161 if (snapc)
162 msg_size += sizeof(u64) * snapc->num_snaps; 162 msg_size += sizeof(u64) * snapc->num_snaps;
163 if (use_mempool) 163 if (use_mempool)
164 msg = ceph_msgpool_get(&osdc->msgpool_op); 164 msg = ceph_msgpool_get(&osdc->msgpool_op, 0);
165 else 165 else
166 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, 0, 0, NULL); 166 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, 0, 0, NULL);
167 if (IS_ERR(msg)) { 167 if (IS_ERR(msg)) {
@@ -1271,10 +1271,11 @@ static struct ceph_msg *alloc_msg(struct ceph_connection *con,
1271 struct ceph_osd *osd = con->private; 1271 struct ceph_osd *osd = con->private;
1272 struct ceph_osd_client *osdc = osd->o_osdc; 1272 struct ceph_osd_client *osdc = osd->o_osdc;
1273 int type = le16_to_cpu(hdr->type); 1273 int type = le16_to_cpu(hdr->type);
1274 int front = le32_to_cpu(hdr->front_len);
1274 1275
1275 switch (type) { 1276 switch (type) {
1276 case CEPH_MSG_OSD_OPREPLY: 1277 case CEPH_MSG_OSD_OPREPLY:
1277 return ceph_msgpool_get(&osdc->msgpool_op_reply); 1278 return ceph_msgpool_get(&osdc->msgpool_op_reply, front);
1278 } 1279 }
1279 return ceph_alloc_msg(con, hdr); 1280 return ceph_alloc_msg(con, hdr);
1280} 1281}