From d5ba063cdf3a8b92862ef6657001725d6192fe86 Mon Sep 17 00:00:00 2001 From: Xinze Chi Date: Sun, 7 Feb 2016 18:50:29 +0800 Subject: [PATCH] OSDMap: reset osd_primary_affinity shared_ptr when deepish_copy_from Base on current logic, OSDMonitor may call create_pending and encode_pending twice for the some epoch. In encode_pending: tmp.deepish_copy_from(osdmap); tmp.apply_incremental(pending_inc); This Op would change the tmp osd_primary_affinity, but the osd_primary_affinity is declared as ceph::shared_ptr, so this would change the osdmap too. When this round encode_pending is proposed fail. We may call encode_pending again, but the osdmap is changed last round, so the pending_inc would be wrong. Fixes: #14686 Signed-off-by: Xinze Chi (cherry picked from commit 990b437f4e616a87f4f7438e51945d531170ca83) --- src/osd/OSDMap.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index acdc3af4f2cf..501453f5bf80 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -293,6 +293,9 @@ public: pg_temp.reset(new map >(*o.pg_temp)); osd_uuid.reset(new vector(*o.osd_uuid)); + if (o.osd_primary_affinity) + osd_primary_affinity.reset(new vector<__u32>(*o.osd_primary_affinity)); + // NOTE: this still references shared entity_addr_t's. osd_addrs.reset(new addrs_s(*o.osd_addrs)); -- 2.47.3