Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7662d8ff authored by Sage Weil's avatar Sage Weil
Browse files

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: default avatarSage Weil <sage@newdream.net>
parent 9db4b3e3
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -830,15 +830,20 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
		map->osd_addr[osd] = addr;
		map->osd_addr[osd] = addr;
	}
	}


	/* new_down */
	/* new_state */
	ceph_decode_32_safe(p, end, len, bad);
	ceph_decode_32_safe(p, end, len, bad);
	while (len--) {
	while (len--) {
		u32 osd;
		u32 osd;
		u8 xorstate;
		ceph_decode_32_safe(p, end, osd, bad);
		ceph_decode_32_safe(p, end, osd, bad);
		xorstate = **(u8 **)p;
		(*p)++;  /* clean flag */
		(*p)++;  /* clean flag */
		if (xorstate == 0)
			xorstate = CEPH_OSD_UP;
		if (xorstate & CEPH_OSD_UP)
			pr_info("osd%d down\n", osd);
			pr_info("osd%d down\n", osd);
		if (osd < map->max_osd)
		if (osd < map->max_osd)
			map->osd_state[osd] &= ~CEPH_OSD_UP;
			map->osd_state[osd] ^= xorstate;
	}
	}


	/* new_weight */
	/* new_weight */