summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-10-07 16:38:19 -0700
committerSage Weil <sage@newdream.net>2009-10-07 16:38:55 -0700
commite251e288082d5e89604eee1fef0c31bed1fe8f02 (patch)
tree5da0110e270076238b4bba407de707337d4b723b
parentb28813a61d6ffe05ad353a86965607bb7a7fd60f (diff)
downloadlinux-3.10-e251e288082d5e89604eee1fef0c31bed1fe8f02.tar.gz
linux-3.10-e251e288082d5e89604eee1fef0c31bed1fe8f02.tar.bz2
linux-3.10-e251e288082d5e89604eee1fef0c31bed1fe8f02.zip
ceph: fix mdsmap decoding when multiple mds's are present
A misplaced sizeof() around namelen was throwing things off. Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--fs/ceph/mdsmap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index 15913cbeb28..09180d8fafe 100644
--- a/fs/ceph/mdsmap.c
+++ b/fs/ceph/mdsmap.c
@@ -85,28 +85,28 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
void *pexport_targets = NULL;
ceph_decode_need(p, end, sizeof(addr) + 1 + sizeof(u32), bad);
- *p += sizeof(addr); /* skip addr key */
+ ceph_decode_copy(p, &addr, sizeof(addr));
ceph_decode_8(p, infoversion);
ceph_decode_32(p, namelen); /* skip mds name */
*p += namelen;
ceph_decode_need(p, end,
- 5*sizeof(u32) + sizeof(u64) +
+ 4*sizeof(u32) + sizeof(u64) +
sizeof(addr) + sizeof(struct ceph_timespec),
bad);
ceph_decode_32(p, mds);
ceph_decode_32(p, inc);
ceph_decode_32(p, state);
ceph_decode_64(p, state_seq);
- ceph_decode_copy(p, &addr, sizeof(addr));
+ *p += sizeof(addr);
*p += sizeof(struct ceph_timespec);
*p += sizeof(u32);
ceph_decode_32_safe(p, end, namelen, bad);
- *p += sizeof(namelen);
+ *p += namelen;
if (infoversion >= 2) {
ceph_decode_32_safe(p, end, num_export_targets, bad);
pexport_targets = *p;
- *p += sizeof(num_export_targets * sizeof(u32));
+ *p += num_export_targets * sizeof(u32);
} else {
num_export_targets = 0;
}