Skip to content

Commit 7662d8f

Browse files
committed
libceph: handle new osdmap down/state change encoding
Old incrementals encode a 0 value (nearly always) when an osd goes down. Change that to allow any state bit(s) to be flipped. Special case 0 to mean flip the CEPH_OSD_UP bit to mimic the old behavior. Signed-off-by: Sage Weil <sage@newdream.net>
1 parent 9db4b3e commit 7662d8f

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎net/ceph/osdmap.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,15 +830,20 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
830830
map->osd_addr[osd] = addr;
831831
}
832832

833-
/* new_down */
833+
/* new_state */
834834
ceph_decode_32_safe(p, end, len, bad);
835835
while (len--) {
836836
u32 osd;
837+
u8 xorstate;
837838
ceph_decode_32_safe(p, end, osd, bad);
839+
xorstate = **(u8 **)p;
838840
(*p)++; /* clean flag */
839-
pr_info("osd%d down\n", osd);
841+
if (xorstate == 0)
842+
xorstate = CEPH_OSD_UP;
843+
if (xorstate & CEPH_OSD_UP)
844+
pr_info("osd%d down\n", osd);
840845
if (osd < map->max_osd)
841-
map->osd_state[osd] &= ~CEPH_OSD_UP;
846+
map->osd_state[osd] ^= xorstate;
842847
}
843848

844849
/* new_weight */

0 commit comments

Comments
 (0)