summaryrefslogtreecommitdiffstats
path: root/fs/ceph/osdmap.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-01-25 16:03:02 -0800
committerSage Weil <sage@newdream.net>2010-01-25 16:03:02 -0800
commit361be8601d78e488b5249032cc4e779b81d7928e (patch)
tree9a443ca3913854104e88620db70fbdf6fc7f1d3a /fs/ceph/osdmap.c
parent0d59ab81c3d3adf466c3fd37d7fb6d46b05d1fd4 (diff)
downloadlinux-361be8601d78e488b5249032cc4e779b81d7928e.tar.bz2
ceph: precede encoded ceph_pg_pool struct with version
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/osdmap.c')
-rw-r--r--fs/ceph/osdmap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c
index 0dbd606e21c4..a143c51c2cfb 100644
--- a/fs/ceph/osdmap.c
+++ b/fs/ceph/osdmap.c
@@ -414,6 +414,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
struct ceph_osdmap *map;
u16 version;
u32 len, max, i;
+ u8 ev;
int err = -EINVAL;
void *start = *p;
@@ -441,10 +442,11 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
}
ceph_decode_32_safe(p, end, max, bad);
while (max--) {
- ceph_decode_need(p, end, 4+sizeof(map->pg_pool->v), bad);
+ ceph_decode_need(p, end, 4+1+sizeof(map->pg_pool->v), bad);
i = ceph_decode_32(p);
if (i >= map->num_pools)
goto bad;
+ ev = ceph_decode_8(p); /* encoding version */
ceph_decode_copy(p, &map->pg_pool[i].v,
sizeof(map->pg_pool->v));
calc_pg_masks(&map->pg_pool[i]);
@@ -603,6 +605,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
/* new_pool */
ceph_decode_32_safe(p, end, len, bad);
while (len--) {
+ __u8 ev;
+
ceph_decode_32_safe(p, end, pool, bad);
if (pool >= map->num_pools) {
void *pg_pool = kcalloc(pool + 1,
@@ -618,6 +622,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
map->pg_pool = pg_pool;
map->num_pools = pool+1;
}
+ ceph_decode_need(p, end, 1 + sizeof(map->pg_pool->v), bad);
+ ev = ceph_decode_8(p); /* encoding version */
ceph_decode_copy(p, &map->pg_pool[pool].v,
sizeof(map->pg_pool->v));
calc_pg_masks(&map->pg_pool[pool]);