PG: clear want_pg_temp in clear_primary_state only if primary

Clearing it in that way in on_shutdown() can cause a stray
shard to clobber the want_pg_temp value created by the primary
shard on the same osd.  Thus, instead only clear it if we are
the primary.

Fixes: #7719
Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
Samuel Just 2014-03-14 13:09:30 -07:00
parent 984f1c3df3
commit e330097802
2 changed files with 4 additions and 4 deletions

View File

@ -830,6 +830,8 @@ void PG::clear_primary_state(bool staying_primary)
if (!staying_primary)
agent_clear();
osd->remove_want_pg_temp(info.pgid.pgid);
}
/**
@ -4772,8 +4774,6 @@ void PG::start_peering_interval(
}
}
}
// make sure we clear out any pg_temp change requests
osd->remove_want_pg_temp(info.pgid.pgid);
cancel_recovery();
if (acting.empty() && !up.empty() && up_primary == pg_whoami) {

View File

@ -8920,8 +8920,8 @@ void ReplicatedPG::on_shutdown()
osd->remote_reserver.cancel_reservation(info.pgid);
osd->local_reserver.cancel_reservation(info.pgid);
clear_primary_state(false); // Not staying primary
osd->remove_want_pg_temp(info.pgid.pgid);
if (is_primary())
clear_primary_state(false); // Not staying primary
cancel_recovery();
}