aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-08-09 18:03:46 -0400
committerSage Weil <sage@newdream.net>2011-10-25 19:10:15 -0400
commitb61c27636fffbaf1980e675282777b9467254a40 (patch)
treebd78cfefda4beb7e3de5fe97dd36fed3dbfa91c1 /net
parentf6a2f5be07463ef532b9f4e3cb9e42ab9df85832 (diff)
libceph: don't complain on msgpool alloc failures
The pool allocation failures are masked by the pool; there is no need to spam the console about them. (That's the whole point of having the pool in the first place.) Mark msg allocations whose failure is safely handled as such. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/messenger.c15
-rw-r--r--net/ceph/mon_client.c24
-rw-r--r--net/ceph/msgpool.c4
-rw-r--r--net/ceph/osd_client.c8
4 files changed, 32 insertions, 19 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 9918e9eb276e..2de711a0c037 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2281,7 +2281,8 @@ EXPORT_SYMBOL(ceph_con_keepalive);
2281 * construct a new message with given type, size 2281 * construct a new message with given type, size
2282 * the new msg has a ref count of 1. 2282 * the new msg has a ref count of 1.
2283 */ 2283 */
2284struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) 2284struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
2285 bool can_fail)
2285{ 2286{
2286 struct ceph_msg *m; 2287 struct ceph_msg *m;
2287 2288
@@ -2333,7 +2334,7 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
2333 m->front.iov_base = kmalloc(front_len, flags); 2334 m->front.iov_base = kmalloc(front_len, flags);
2334 } 2335 }
2335 if (m->front.iov_base == NULL) { 2336 if (m->front.iov_base == NULL) {
2336 pr_err("msg_new can't allocate %d bytes\n", 2337 dout("ceph_msg_new can't allocate %d bytes\n",
2337 front_len); 2338 front_len);
2338 goto out2; 2339 goto out2;
2339 } 2340 }
@@ -2348,7 +2349,13 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
2348out2: 2349out2:
2349 ceph_msg_put(m); 2350 ceph_msg_put(m);
2350out: 2351out:
2351 pr_err("msg_new can't create type %d front %d\n", type, front_len); 2352 if (!can_fail) {
2353 pr_err("msg_new can't create type %d front %d\n", type,
2354 front_len);
2355 } else {
2356 dout("msg_new can't create type %d front %d\n", type,
2357 front_len);
2358 }
2352 return NULL; 2359 return NULL;
2353} 2360}
2354EXPORT_SYMBOL(ceph_msg_new); 2361EXPORT_SYMBOL(ceph_msg_new);
@@ -2398,7 +2405,7 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con,
2398 } 2405 }
2399 if (!msg) { 2406 if (!msg) {
2400 *skip = 0; 2407 *skip = 0;
2401 msg = ceph_msg_new(type, front_len, GFP_NOFS); 2408 msg = ceph_msg_new(type, front_len, GFP_NOFS, false);
2402 if (!msg) { 2409 if (!msg) {
2403 pr_err("unable to allocate msg type %d len %d\n", 2410 pr_err("unable to allocate msg type %d len %d\n",
2404 type, front_len); 2411 type, front_len);
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 556721665335..af2ef3082499 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -517,10 +517,12 @@ int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf)
517 init_completion(&req->completion); 517 init_completion(&req->completion);
518 518
519 err = -ENOMEM; 519 err = -ENOMEM;
520 req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), GFP_NOFS); 520 req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), GFP_NOFS,
521 true);
521 if (!req->request) 522 if (!req->request)
522 goto out; 523 goto out;
523 req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, GFP_NOFS); 524 req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, GFP_NOFS,
525 true);
524 if (!req->reply) 526 if (!req->reply)
525 goto out; 527 goto out;
526 528
@@ -615,10 +617,12 @@ int ceph_monc_do_poolop(struct ceph_mon_client *monc, u32 op,
615 init_completion(&req->completion); 617 init_completion(&req->completion);
616 618
617 err = -ENOMEM; 619 err = -ENOMEM;
618 req->request = ceph_msg_new(CEPH_MSG_POOLOP, sizeof(*h), GFP_NOFS); 620 req->request = ceph_msg_new(CEPH_MSG_POOLOP, sizeof(*h), GFP_NOFS,
621 true);
619 if (!req->request) 622 if (!req->request)
620 goto out; 623 goto out;
621 req->reply = ceph_msg_new(CEPH_MSG_POOLOP_REPLY, 1024, GFP_NOFS); 624 req->reply = ceph_msg_new(CEPH_MSG_POOLOP_REPLY, 1024, GFP_NOFS,
625 true);
622 if (!req->reply) 626 if (!req->reply)
623 goto out; 627 goto out;
624 628
@@ -765,19 +769,21 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
765 err = -ENOMEM; 769 err = -ENOMEM;
766 monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK, 770 monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK,
767 sizeof(struct ceph_mon_subscribe_ack), 771 sizeof(struct ceph_mon_subscribe_ack),
768 GFP_NOFS); 772 GFP_NOFS, true);
769 if (!monc->m_subscribe_ack) 773 if (!monc->m_subscribe_ack)
770 goto out_con; 774 goto out_con;
771 775
772 monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS); 776 monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS,
777 true);
773 if (!monc->m_subscribe) 778 if (!monc->m_subscribe)
774 goto out_subscribe_ack; 779 goto out_subscribe_ack;
775 780
776 monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, GFP_NOFS); 781 monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, GFP_NOFS,
782 true);
777 if (!monc->m_auth_reply) 783 if (!monc->m_auth_reply)
778 goto out_subscribe; 784 goto out_subscribe;
779 785
780 monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_NOFS); 786 monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_NOFS, true);
781 monc->pending_auth = 0; 787 monc->pending_auth = 0;
782 if (!monc->m_auth) 788 if (!monc->m_auth)
783 goto out_auth_reply; 789 goto out_auth_reply;
@@ -970,7 +976,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
970 case CEPH_MSG_MON_MAP: 976 case CEPH_MSG_MON_MAP:
971 case CEPH_MSG_MDS_MAP: 977 case CEPH_MSG_MDS_MAP:
972 case CEPH_MSG_OSD_MAP: 978 case CEPH_MSG_OSD_MAP:
973 m = ceph_msg_new(type, front_len, GFP_NOFS); 979 m = ceph_msg_new(type, front_len, GFP_NOFS, false);
974 break; 980 break;
975 } 981 }
976 982
diff --git a/net/ceph/msgpool.c b/net/ceph/msgpool.c
index 1f4cb30a42c5..11d5f4196a73 100644
--- a/net/ceph/msgpool.c
+++ b/net/ceph/msgpool.c
@@ -12,7 +12,7 @@ static void *msgpool_alloc(gfp_t gfp_mask, void *arg)
12 struct ceph_msgpool *pool = arg; 12 struct ceph_msgpool *pool = arg;
13 struct ceph_msg *msg; 13 struct ceph_msg *msg;
14 14
15 msg = ceph_msg_new(0, pool->front_len, gfp_mask); 15 msg = ceph_msg_new(0, pool->front_len, gfp_mask, true);
16 if (!msg) { 16 if (!msg) {
17 dout("msgpool_alloc %s failed\n", pool->name); 17 dout("msgpool_alloc %s failed\n", pool->name);
18 } else { 18 } else {
@@ -61,7 +61,7 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool,
61 WARN_ON(1); 61 WARN_ON(1);
62 62
63 /* try to alloc a fresh message */ 63 /* try to alloc a fresh message */
64 return ceph_msg_new(0, front_len, GFP_NOFS); 64 return ceph_msg_new(0, front_len, GFP_NOFS, false);
65 } 65 }
66 66
67 msg = mempool_alloc(pool->pool, GFP_NOFS); 67 msg = mempool_alloc(pool->pool, GFP_NOFS);
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 88ad8a2501b5..01ceb59a8b4a 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -227,7 +227,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
227 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); 227 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0);
228 else 228 else
229 msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, 229 msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY,
230 OSD_OPREPLY_FRONT_LEN, gfp_flags); 230 OSD_OPREPLY_FRONT_LEN, gfp_flags, true);
231 if (!msg) { 231 if (!msg) {
232 ceph_osdc_put_request(req); 232 ceph_osdc_put_request(req);
233 return NULL; 233 return NULL;
@@ -250,7 +250,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
250 if (use_mempool) 250 if (use_mempool)
251 msg = ceph_msgpool_get(&osdc->msgpool_op, 0); 251 msg = ceph_msgpool_get(&osdc->msgpool_op, 0);
252 else 252 else
253 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, gfp_flags); 253 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, gfp_flags, true);
254 if (!msg) { 254 if (!msg) {
255 ceph_osdc_put_request(req); 255 ceph_osdc_put_request(req);
256 return NULL; 256 return NULL;
@@ -2032,7 +2032,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
2032 if (front > req->r_reply->front.iov_len) { 2032 if (front > req->r_reply->front.iov_len) {
2033 pr_warning("get_reply front %d > preallocated %d\n", 2033 pr_warning("get_reply front %d > preallocated %d\n",
2034 front, (int)req->r_reply->front.iov_len); 2034 front, (int)req->r_reply->front.iov_len);
2035 m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, GFP_NOFS); 2035 m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, GFP_NOFS, false);
2036 if (!m) 2036 if (!m)
2037 goto out; 2037 goto out;
2038 ceph_msg_put(req->r_reply); 2038 ceph_msg_put(req->r_reply);
@@ -2080,7 +2080,7 @@ static struct ceph_msg *alloc_msg(struct ceph_connection *con,
2080 switch (type) { 2080 switch (type) {
2081 case CEPH_MSG_OSD_MAP: 2081 case CEPH_MSG_OSD_MAP:
2082 case CEPH_MSG_WATCH_NOTIFY: 2082 case CEPH_MSG_WATCH_NOTIFY:
2083 return ceph_msg_new(type, front, GFP_NOFS); 2083 return ceph_msg_new(type, front, GFP_NOFS, false);
2084 case CEPH_MSG_OSD_OPREPLY: 2084 case CEPH_MSG_OSD_OPREPLY:
2085 return get_reply(con, hdr, skip); 2085 return get_reply(con, hdr, skip);
2086 default: 2086 default: