diff options
Diffstat (limited to 'net/ceph/osdmap.c')
-rw-r--r-- | net/ceph/osdmap.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 9d1aaa24def6..4dd000d128fd 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -690,6 +690,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | |||
690 | u16 version; | 690 | u16 version; |
691 | u32 len, max, i; | 691 | u32 len, max, i; |
692 | int err = -EINVAL; | 692 | int err = -EINVAL; |
693 | u32 epoch = 0; | ||
693 | void *start = *p; | 694 | void *start = *p; |
694 | struct ceph_pg_pool_info *pi; | 695 | struct ceph_pg_pool_info *pi; |
695 | 696 | ||
@@ -714,7 +715,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | |||
714 | 715 | ||
715 | ceph_decode_need(p, end, 2*sizeof(u64)+6*sizeof(u32), bad); | 716 | ceph_decode_need(p, end, 2*sizeof(u64)+6*sizeof(u32), bad); |
716 | ceph_decode_copy(p, &map->fsid, sizeof(map->fsid)); | 717 | ceph_decode_copy(p, &map->fsid, sizeof(map->fsid)); |
717 | map->epoch = ceph_decode_32(p); | 718 | epoch = map->epoch = ceph_decode_32(p); |
718 | ceph_decode_copy(p, &map->created, sizeof(map->created)); | 719 | ceph_decode_copy(p, &map->created, sizeof(map->created)); |
719 | ceph_decode_copy(p, &map->modified, sizeof(map->modified)); | 720 | ceph_decode_copy(p, &map->modified, sizeof(map->modified)); |
720 | 721 | ||
@@ -814,14 +815,18 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | |||
814 | goto bad; | 815 | goto bad; |
815 | } | 816 | } |
816 | 817 | ||
817 | /* ignore the rest of the map */ | 818 | /* ignore the rest */ |
818 | *p = end; | 819 | *p = end; |
819 | 820 | ||
820 | dout("osdmap_decode done %p %p\n", *p, end); | 821 | dout("full osdmap epoch %d max_osd %d\n", map->epoch, map->max_osd); |
821 | return map; | 822 | return map; |
822 | 823 | ||
823 | bad: | 824 | bad: |
824 | dout("osdmap_decode fail err %d\n", err); | 825 | pr_err("corrupt full osdmap (%d) epoch %d off %d (%p of %p-%p)\n", |
826 | err, epoch, (int)(*p - start), *p, start, end); | ||
827 | print_hex_dump(KERN_DEBUG, "osdmap: ", | ||
828 | DUMP_PREFIX_OFFSET, 16, 1, | ||
829 | start, end - start, true); | ||
825 | ceph_osdmap_destroy(map); | 830 | ceph_osdmap_destroy(map); |
826 | return ERR_PTR(err); | 831 | return ERR_PTR(err); |
827 | } | 832 | } |
@@ -845,6 +850,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
845 | int err = -EINVAL; | 850 | int err = -EINVAL; |
846 | u16 version; | 851 | u16 version; |
847 | 852 | ||
853 | dout("%s %p to %p len %d\n", __func__, *p, end, (int)(end - *p)); | ||
854 | |||
848 | ceph_decode_16_safe(p, end, version, bad); | 855 | ceph_decode_16_safe(p, end, version, bad); |
849 | if (version != 6) { | 856 | if (version != 6) { |
850 | pr_warning("got unknown v %d != 6 of inc osdmap\n", version); | 857 | pr_warning("got unknown v %d != 6 of inc osdmap\n", version); |
@@ -1032,11 +1039,13 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
1032 | 1039 | ||
1033 | /* ignore the rest */ | 1040 | /* ignore the rest */ |
1034 | *p = end; | 1041 | *p = end; |
1042 | |||
1043 | dout("inc osdmap epoch %d max_osd %d\n", map->epoch, map->max_osd); | ||
1035 | return map; | 1044 | return map; |
1036 | 1045 | ||
1037 | bad: | 1046 | bad: |
1038 | pr_err("corrupt inc osdmap epoch %d off %d (%p of %p-%p)\n", | 1047 | pr_err("corrupt inc osdmap (%d) epoch %d off %d (%p of %p-%p)\n", |
1039 | epoch, (int)(*p - start), *p, start, end); | 1048 | err, epoch, (int)(*p - start), *p, start, end); |
1040 | print_hex_dump(KERN_DEBUG, "osdmap: ", | 1049 | print_hex_dump(KERN_DEBUG, "osdmap: ", |
1041 | DUMP_PREFIX_OFFSET, 16, 1, | 1050 | DUMP_PREFIX_OFFSET, 16, 1, |
1042 | start, end - start, true); | 1051 | start, end - start, true); |