All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH] libceph: initialize data fields on last msg put
Date: Mon, 25 Mar 2013 11:56:48 -0500	[thread overview]
Message-ID: <515081D0.4080405@inktank.com> (raw)

(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

Signed-off-by: Alex Elder <elder@inktank.com>
---
 net/ceph/messenger.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 997dacc..2ccbd189 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -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)
-- 
1.7.9.5


             reply	other threads:[~2013-03-25 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 16:56 Alex Elder [this message]
2013-03-29 18:28 ` [PATCH] libceph: initialize data fields on last msg put Josh Durgin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=515081D0.4080405@inktank.com \
    --to=elder@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.