aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2009-12-15 12:50:36 -0500
committerSage Weil <sage@newdream.net>2009-12-21 19:39:51 -0500
commit93c20d98c29ccefa039c3843ccc37122caaf3d31 (patch)
treeed434cc0f9390c2821051979ae1237dd25f97217 /fs
parentb3d1dbbdd5670d8a9fb01f7dfb1cac522ff6795a (diff)
ceph: fix msgpool reservation leak
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/osd_client.c5
-rw-r--r--fs/ceph/osd_client.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index 67ef8ab06af4..63482ef3de01 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -145,6 +145,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
145 ceph_osdc_put_request(req); 145 ceph_osdc_put_request(req);
146 return ERR_PTR(-ENOMEM); 146 return ERR_PTR(-ENOMEM);
147 } 147 }
148 req->r_num_prealloc_reply = num_reply;
148 149
149 req->r_osdc = osdc; 150 req->r_osdc = osdc;
150 req->r_mempool = use_mempool; 151 req->r_mempool = use_mempool;
@@ -165,7 +166,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
165 else 166 else
166 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, 0, 0, NULL); 167 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, 0, 0, NULL);
167 if (IS_ERR(msg)) { 168 if (IS_ERR(msg)) {
168 ceph_msgpool_resv(&osdc->msgpool_op_reply, num_reply); 169 ceph_msgpool_resv(&osdc->msgpool_op_reply, -num_reply);
169 ceph_osdc_put_request(req); 170 ceph_osdc_put_request(req);
170 return ERR_PTR(PTR_ERR(msg)); 171 return ERR_PTR(PTR_ERR(msg));
171 } 172 }
@@ -465,6 +466,8 @@ static void __unregister_request(struct ceph_osd_client *osdc,
465 rb_erase(&req->r_node, &osdc->requests); 466 rb_erase(&req->r_node, &osdc->requests);
466 osdc->num_requests--; 467 osdc->num_requests--;
467 468
469 ceph_msgpool_resv(&osdc->msgpool_op_reply, -req->r_num_prealloc_reply);
470
468 if (req->r_osd) { 471 if (req->r_osd) {
469 /* make sure the original request isn't in flight. */ 472 /* make sure the original request isn't in flight. */
470 ceph_con_revoke(&req->r_osd->o_con, req->r_request); 473 ceph_con_revoke(&req->r_osd->o_con, req->r_request);
diff --git a/fs/ceph/osd_client.h b/fs/ceph/osd_client.h
index 20ee61847416..2e4cfd1e9f10 100644
--- a/fs/ceph/osd_client.h
+++ b/fs/ceph/osd_client.h
@@ -48,6 +48,7 @@ struct ceph_osd_request {
48 int r_flags; /* any additional flags for the osd */ 48 int r_flags; /* any additional flags for the osd */
49 u32 r_sent; /* >0 if r_request is sending/sent */ 49 u32 r_sent; /* >0 if r_request is sending/sent */
50 int r_prepared_pages, r_got_reply; 50 int r_prepared_pages, r_got_reply;
51 int r_num_prealloc_reply;
51 52
52 struct ceph_osd_client *r_osdc; 53 struct ceph_osd_client *r_osdc;
53 struct kref r_kref; 54 struct kref r_kref;