diff options
author | Sage Weil <sage@newdream.net> | 2009-10-07 19:38:19 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-10-07 19:38:55 -0400 |
commit | e251e288082d5e89604eee1fef0c31bed1fe8f02 (patch) | |
tree | 5da0110e270076238b4bba407de707337d4b723b /fs/ceph/mdsmap.c | |
parent | b28813a61d6ffe05ad353a86965607bb7a7fd60f (diff) |
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>
Diffstat (limited to 'fs/ceph/mdsmap.c')
-rw-r--r-- | fs/ceph/mdsmap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c index 15913cbeb289..09180d8fafe4 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) | |||
85 | void *pexport_targets = NULL; | 85 | void *pexport_targets = NULL; |
86 | 86 | ||
87 | ceph_decode_need(p, end, sizeof(addr) + 1 + sizeof(u32), bad); | 87 | ceph_decode_need(p, end, sizeof(addr) + 1 + sizeof(u32), bad); |
88 | *p += sizeof(addr); /* skip addr key */ | 88 | ceph_decode_copy(p, &addr, sizeof(addr)); |
89 | ceph_decode_8(p, infoversion); | 89 | ceph_decode_8(p, infoversion); |
90 | ceph_decode_32(p, namelen); /* skip mds name */ | 90 | ceph_decode_32(p, namelen); /* skip mds name */ |
91 | *p += namelen; | 91 | *p += namelen; |
92 | 92 | ||
93 | ceph_decode_need(p, end, | 93 | ceph_decode_need(p, end, |
94 | 5*sizeof(u32) + sizeof(u64) + | 94 | 4*sizeof(u32) + sizeof(u64) + |
95 | sizeof(addr) + sizeof(struct ceph_timespec), | 95 | sizeof(addr) + sizeof(struct ceph_timespec), |
96 | bad); | 96 | bad); |
97 | ceph_decode_32(p, mds); | 97 | ceph_decode_32(p, mds); |
98 | ceph_decode_32(p, inc); | 98 | ceph_decode_32(p, inc); |
99 | ceph_decode_32(p, state); | 99 | ceph_decode_32(p, state); |
100 | ceph_decode_64(p, state_seq); | 100 | ceph_decode_64(p, state_seq); |
101 | ceph_decode_copy(p, &addr, sizeof(addr)); | 101 | *p += sizeof(addr); |
102 | *p += sizeof(struct ceph_timespec); | 102 | *p += sizeof(struct ceph_timespec); |
103 | *p += sizeof(u32); | 103 | *p += sizeof(u32); |
104 | ceph_decode_32_safe(p, end, namelen, bad); | 104 | ceph_decode_32_safe(p, end, namelen, bad); |
105 | *p += sizeof(namelen); | 105 | *p += namelen; |
106 | if (infoversion >= 2) { | 106 | if (infoversion >= 2) { |
107 | ceph_decode_32_safe(p, end, num_export_targets, bad); | 107 | ceph_decode_32_safe(p, end, num_export_targets, bad); |
108 | pexport_targets = *p; | 108 | pexport_targets = *p; |
109 | *p += sizeof(num_export_targets * sizeof(u32)); | 109 | *p += num_export_targets * sizeof(u32); |
110 | } else { | 110 | } else { |
111 | num_export_targets = 0; | 111 | num_export_targets = 0; |
112 | } | 112 | } |