OSDMap: fix damaging input osdmap from remove_down_temps

The default copy constructor copies shared_ptrs do vectors that are then
modified by apply_incremental, which means that the const osdmap argument
isn't in fact const.  Fix this by doing a deep(ish) copy.

Fixes: #7060
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2014-01-24 11:04:37 -08:00
parent bd54b9841b
commit 368852f6c0

View File

@ -1073,7 +1073,8 @@ void OSDMap::remove_down_temps(CephContext *cct,
const OSDMap& osdmap, Incremental *pending_inc)
{
ldout(cct, 10) << "remove_down_pg_temp" << dendl;
OSDMap tmpmap(osdmap);
OSDMap tmpmap;
tmpmap.deepish_copy_from(osdmap);
tmpmap.apply_incremental(*pending_inc);
for (map<pg_t,vector<int> >::iterator p = tmpmap.pg_temp->begin();