ceph: precede encoded ceph_pg_pool struct with version
authorSage Weil <sage@newdream.net>
Tue, 26 Jan 2010 00:03:02 +0000 (16:03 -0800)
committerSage Weil <sage@newdream.net>
Tue, 26 Jan 2010 00:03:02 +0000 (16:03 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/ceph_fs.h
fs/ceph/osdmap.c

index d8923fed8c2e39275296574b5e5cddf054934a29..f3bfc3c4f6e669c9bb10477dfb66911c5b83e0c6 100644 (file)
@@ -38,7 +38,7 @@
 #define CEPH_OSD_PROTOCOL     8 /* cluster internal */
 #define CEPH_MDS_PROTOCOL     9 /* cluster internal */
 #define CEPH_MON_PROTOCOL     5 /* cluster internal */
-#define CEPH_OSDC_PROTOCOL   22 /* server/client */
+#define CEPH_OSDC_PROTOCOL   23 /* server/client */
 #define CEPH_MDSC_PROTOCOL   32 /* server/client */
 #define CEPH_MONC_PROTOCOL   15 /* server/client */
 
index 0dbd606e21c4fa34c502ade1e667c5a4876a47ab..a143c51c2cfb39c566c768f5c61d59c44c6099c4 100644 (file)
@@ -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]);