This fixes a valgrind error from OSD::handle_osd_map where primary is not
initialized and is compared after the call to pg_to_acting_osds().
We are still not distinguishing from "no mapping" to "pool doesn't exist,
no mapping". That is a somewhat larger change, though.
Signed-off-by: Sage Weil <sage@inktank.com>
int OSDMap::pg_to_osds(pg_t pg, vector<int> *raw, int *primary) const
{
*primary = -1;
+ raw->clear();
const pg_pool_t *pool = get_pg_pool(pg.pool());
if (!pool)
return 0;
void OSDMap::pg_to_raw_up(pg_t pg, vector<int> *up, int *primary) const
{
const pg_pool_t *pool = get_pg_pool(pg.pool());
- if (!pool)
+ if (!pool) {
+ if (primary)
+ *primary = -1;
+ if (up)
+ up->clear();
return;
+ }
vector<int> raw;
_pg_to_osds(*pool, pg, &raw, primary);
_raw_to_up_osds(pg, raw, up, primary);
vector<int> *acting, int *acting_primary) const
{
const pg_pool_t *pool = get_pg_pool(pg.pool());
- if (!pool)
+ if (!pool) {
+ if (up)
+ up->clear();
+ if (up_primary)
+ *up_primary = -1;
+ if (acting)
+ acting->clear();
+ if (acting_primary)
+ *acting_primary = -1;
return;
+ }
vector<int> raw;
vector<int> _up;
vector<int> _acting;