aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-25 12:54:30 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:17:22 -0400
commit888334f966fab232fe9158c2c2f0a935e356b583 (patch)
tree59566142b9a177590c0d38eaaeb6edb7dd01fa8f
parent7e2766a1135544a2972d2767f3a41afd5f55067f (diff)
libceph: initialize data fields on last msg put
When the last reference to a ceph message is dropped, ceph_msg_last_put() is called to clean things up. For "normal" messages (allocated via ceph_msg_new() rather than being allocated from a memory pool) it's sufficient to just release resources. But for a mempool-allocated message we actually have to re-initialize the data fields in the message back to initial state so they're ready to go in the event the message gets reused. Some of this was already done; this fleshes it out so it's done more completely. This resolves: http://tracker.ceph.com/issues/4540 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r--net/ceph/messenger.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 2aecc4896a03..0a9f6362d4d8 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -3331,12 +3331,17 @@ void ceph_msg_last_put(struct kref *kref)
3331 if (ceph_msg_has_pages(m)) { 3331 if (ceph_msg_has_pages(m)) {
3332 m->p.length = 0; 3332 m->p.length = 0;
3333 m->p.pages = NULL; 3333 m->p.pages = NULL;
3334 m->p.type = CEPH_OSD_DATA_TYPE_NONE;
3334 } 3335 }
3335
3336 if (ceph_msg_has_pagelist(m)) { 3336 if (ceph_msg_has_pagelist(m)) {
3337 ceph_pagelist_release(m->l.pagelist); 3337 ceph_pagelist_release(m->l.pagelist);
3338 kfree(m->l.pagelist); 3338 kfree(m->l.pagelist);
3339 m->l.pagelist = NULL; 3339 m->l.pagelist = NULL;
3340 m->l.type = CEPH_OSD_DATA_TYPE_NONE;
3341 }
3342 if (ceph_msg_has_bio(m)) {
3343 m->b.bio = NULL;
3344 m->b.type = CEPH_OSD_DATA_TYPE_NONE;
3340 } 3345 }
3341 3346
3342 if (m->pool) 3347 if (m->pool)