libceph: initialize data fields on last msg put
PATCH 1/1 libceph: initialize data fields on last msg put
(This patch is available in branch "review/wip-4540" of the ceph-client git repository, which is based on the current "testing" branch.)
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
--- net/ceph/messenger.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ceph/messenger.c +6 -1
@@ -3299,12 +3299,17 @@ void ceph_msg_last_put(struct kref *kref)if (ceph_msg_has_pages (m)) { m->p.length =0 ; m->p.pages =NULL ; + m->p.type =CEPH_OSD_DATA_TYPE_NONE ; } -if (ceph_msg_has_pagelist (m)) {ceph_pagelist_release (m->l.pagelist);kfree (m->l.pagelist); m->l.pagelist =NULL ; + m->l.type =CEPH_OSD_DATA_TYPE_NONE ; + } +if (ceph_msg_has_bio (m)) { + m->b.bio =NULL ; + m->b.type =CEPH_OSD_DATA_TYPE_NONE ; }if (m->pool)
Signature · 1 line
1.7.9.5
Quoted 47 lines · Alex Elder
(This patch is available in branch "review/wip-4540" of the ceph-client git repository, which is based on the current "testing" branch.)
When the last reference to a ceph message is dropped,
ceph_msg_last_put()is called to clean things up. For "normal" messages (allocated viaceph_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/4540Signed-off-by Alex Elder <[email protected]>--- net/ceph/messenger.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)net/ceph/messenger.c +6
-1@@ -3299,12 +3299,17 @@ void ceph_msg_last_put(struct kref *kref)if (ceph_msg_has_pages (m)) { m->p.length =0 ; m->p.pages =NULL ; + m->p.type =CEPH_OSD_DATA_TYPE_NONE ; } -if (ceph_msg_has_pagelist (m)) {ceph_pagelist_release (m->l.pagelist);kfree (m->l.pagelist); m->l.pagelist =NULL ; + m->l.type =CEPH_OSD_DATA_TYPE_NONE ; + } +if (ceph_msg_has_bio (m)) { + m->b.bio =NULL ; + m->b.type =CEPH_OSD_DATA_TYPE_NONE ; }if (m->pool)