summaryrefslogtreecommitdiffstats
path: root/fs/ceph/msgpool.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-03-02 00:25:00 +0100
committerSage Weil <sage@newdream.net>2010-03-02 00:25:00 +0100
commit3ca02ef96e119d36bc1752baeae7dd0c59c2f325 (patch)
tree5ef2a149d0f67b3f59fd5c4b168712046f7ce7f2 /fs/ceph/msgpool.c
parentceph: fix snaptrace decoding on cap migration between mds (diff)
downloadlinux-3ca02ef96e119d36bc1752baeae7dd0c59c2f325.tar.xz
linux-3ca02ef96e119d36bc1752baeae7dd0c59c2f325.zip
ceph: reset front len on return to msgpool; BUG on mismatched front iov
Reset msg front len when a message is returned to the pool: the caller may have changed it. BUG if we try to send a message with a hdr.front_len that doesn't match the front iov. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/msgpool.c')
-rw-r--r--fs/ceph/msgpool.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ceph/msgpool.c b/fs/ceph/msgpool.c
index 2f04e0fc4666..ca3b44a89f2d 100644
--- a/fs/ceph/msgpool.c
+++ b/fs/ceph/msgpool.c
@@ -166,6 +166,10 @@ void ceph_msgpool_put(struct ceph_msgpool *pool, struct ceph_msg *msg)
{
spin_lock(&pool->lock);
if (pool->num < pool->min) {
+ /* reset msg front_len; user may have changed it */
+ msg->front.iov_len = pool->front_len;
+ msg->hdr.front_len = cpu_to_le32(pool->front_len);
+
kref_set(&msg->kref, 1); /* retake a single ref */
list_add(&msg->list_head, &pool->msgs);
pool->num++;