kclient: drop middle, data in ceph_msg_put

And not msgpool reclaim.

This fixes bug where a reused message has nr_pages != 0 and
gets confused.
This commit is contained in:
Sage Weil 2009-08-19 13:44:49 -07:00
parent a849be3242
commit 11376ca2e7
2 changed files with 9 additions and 6 deletions

View File

@ -2389,7 +2389,6 @@ void ceph_msg_kfree(struct ceph_msg *m)
vfree(m->front.iov_base);
else
kfree(m->front.iov_base);
ceph_buffer_put(m->middle);
kfree(m);
dout("msg_kfree %p done\n", m);
}
@ -2412,6 +2411,15 @@ void ceph_msg_put(struct ceph_msg *m)
if (atomic_dec_and_test(&m->nref)) {
dout("ceph_msg_put last one on %p\n", m);
WARN_ON(!list_empty(&m->list_head));
/* drop middle, data, if any */
if (m->middle) {
ceph_buffer_put(m->middle);
m->middle = NULL;
}
m->nr_pages = 0;
m->pages = NULL;
if (m->pool)
ceph_msgpool_put(m->pool, m);
else

View File

@ -132,11 +132,6 @@ void ceph_msgpool_put(struct ceph_msg_pool *pool, struct ceph_msg *msg)
{
spin_lock(&pool->lock);
if (pool->num < pool->min) {
/* drop middle, if any */
if (msg->middle) {
ceph_buffer_put(msg->middle);
msg->middle = NULL;
}
ceph_msg_get(msg); /* retake a single ref */
list_add(&msg->list_head, &pool->msgs);
pool->num++;