aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-02-04 19:18:10 -0500
committerSage Weil <sage@newdream.net>2010-02-11 14:48:49 -0500
commit02f90c61096ec3ad691e808a4aa7ca5a06e550ec (patch)
tree5061c9797a1c27608cd9e06b4b759c621d1d4b61
parentf5a2041bd96c9f05ff10172b9c814c14f247084e (diff)
ceph: add uid field to ceph_pg_pool
Also verify encoding version as we go. Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--fs/ceph/osdmap.c20
-rw-r--r--fs/ceph/rados.h8
2 files changed, 28 insertions, 0 deletions
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c
index a143c51c2cfb..a6afe3836f7e 100644
--- a/fs/ceph/osdmap.c
+++ b/fs/ceph/osdmap.c
@@ -426,6 +426,11 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
426 map->pg_temp = RB_ROOT; 426 map->pg_temp = RB_ROOT;
427 427
428 ceph_decode_16_safe(p, end, version, bad); 428 ceph_decode_16_safe(p, end, version, bad);
429 if (version > CEPH_OSDMAP_VERSION) {
430 pr_warning("got unknown v %d > %d of osdmap\n", version,
431 CEPH_OSDMAP_VERSION);
432 goto bad;
433 }
429 434
430 ceph_decode_need(p, end, 2*sizeof(u64)+6*sizeof(u32), bad); 435 ceph_decode_need(p, end, 2*sizeof(u64)+6*sizeof(u32), bad);
431 ceph_decode_copy(p, &map->fsid, sizeof(map->fsid)); 436 ceph_decode_copy(p, &map->fsid, sizeof(map->fsid));
@@ -447,6 +452,11 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
447 if (i >= map->num_pools) 452 if (i >= map->num_pools)
448 goto bad; 453 goto bad;
449 ev = ceph_decode_8(p); /* encoding version */ 454 ev = ceph_decode_8(p); /* encoding version */
455 if (ev > CEPH_PG_POOL_VERSION) {
456 pr_warning("got unknown v %d > %d of ceph_pg_pool\n",
457 ev, CEPH_PG_POOL_VERSION);
458 goto bad;
459 }
450 ceph_decode_copy(p, &map->pg_pool[i].v, 460 ceph_decode_copy(p, &map->pg_pool[i].v,
451 sizeof(map->pg_pool->v)); 461 sizeof(map->pg_pool->v));
452 calc_pg_masks(&map->pg_pool[i]); 462 calc_pg_masks(&map->pg_pool[i]);
@@ -552,6 +562,11 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
552 struct rb_node *rbp; 562 struct rb_node *rbp;
553 563
554 ceph_decode_16_safe(p, end, version, bad); 564 ceph_decode_16_safe(p, end, version, bad);
565 if (version > CEPH_OSDMAP_INC_VERSION) {
566 pr_warning("got unknown v %d > %d of inc osdmap\n", version,
567 CEPH_OSDMAP_INC_VERSION);
568 goto bad;
569 }
555 570
556 ceph_decode_need(p, end, sizeof(fsid)+sizeof(modified)+2*sizeof(u32), 571 ceph_decode_need(p, end, sizeof(fsid)+sizeof(modified)+2*sizeof(u32),
557 bad); 572 bad);
@@ -624,6 +639,11 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
624 } 639 }
625 ceph_decode_need(p, end, 1 + sizeof(map->pg_pool->v), bad); 640 ceph_decode_need(p, end, 1 + sizeof(map->pg_pool->v), bad);
626 ev = ceph_decode_8(p); /* encoding version */ 641 ev = ceph_decode_8(p); /* encoding version */
642 if (ev > CEPH_PG_POOL_VERSION) {
643 pr_warning("got unknown v %d > %d of ceph_pg_pool\n",
644 ev, CEPH_PG_POOL_VERSION);
645 goto bad;
646 }
627 ceph_decode_copy(p, &map->pg_pool[pool].v, 647 ceph_decode_copy(p, &map->pg_pool[pool].v,
628 sizeof(map->pg_pool->v)); 648 sizeof(map->pg_pool->v));
629 calc_pg_masks(&map->pg_pool[pool]); 649 calc_pg_masks(&map->pg_pool[pool]);
diff --git a/fs/ceph/rados.h b/fs/ceph/rados.h
index 123fd845459e..1f4c78640541 100644
--- a/fs/ceph/rados.h
+++ b/fs/ceph/rados.h
@@ -9,6 +9,12 @@
9#include "msgr.h" 9#include "msgr.h"
10 10
11/* 11/*
12 * osdmap encoding versions
13 */
14#define CEPH_OSDMAP_INC_VERSION 3
15#define CEPH_OSDMAP_VERSION 3
16
17/*
12 * fs id 18 * fs id
13 */ 19 */
14struct ceph_fsid { 20struct ceph_fsid {
@@ -80,6 +86,7 @@ struct ceph_pg {
80 */ 86 */
81#define CEPH_PG_TYPE_REP 1 87#define CEPH_PG_TYPE_REP 1
82#define CEPH_PG_TYPE_RAID4 2 88#define CEPH_PG_TYPE_RAID4 2
89#define CEPH_PG_POOL_VERSION 2
83struct ceph_pg_pool { 90struct ceph_pg_pool {
84 __u8 type; /* CEPH_PG_TYPE_* */ 91 __u8 type; /* CEPH_PG_TYPE_* */
85 __u8 size; /* number of osds in each pg */ 92 __u8 size; /* number of osds in each pg */
@@ -92,6 +99,7 @@ struct ceph_pg_pool {
92 __le32 snap_epoch; /* epoch of last snap */ 99 __le32 snap_epoch; /* epoch of last snap */
93 __le32 num_snaps; 100 __le32 num_snaps;
94 __le32 num_removed_snap_intervals; 101 __le32 num_removed_snap_intervals;
102 __le64 uid;
95} __attribute__ ((packed)); 103} __attribute__ ((packed));
96 104
97/* 105/*