Skip to content

Commit

Permalink
client: Simplify blocklist tracking and interface
Browse files Browse the repository at this point in the history
I'm not sure if the blocklist events tracking in Client.cc was ever
the simplest way to track that state, but it definitely isn't now. We
can just hand our addr_vec to the OSDMap and ask it -- it handles
version compatibility issues and, happily, means the Client doesn't
need to learn to deal with ranges directly.

Signed-off-by: Greg Farnum <[email protected]>
  • Loading branch information
gregsfortytwo committed Apr 13, 2022
1 parent ed556e6 commit 5f57dae
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions src/client/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ void Client::_pre_init()

objecter_finisher.start();
filer.reset(new Filer(objecter, &objecter_finisher));
objecter->enable_blocklist_events();

objectcacher->start();
}
Expand Down Expand Up @@ -2715,36 +2714,15 @@ void Client::_handle_full_flag(int64_t pool)

void Client::handle_osd_map(const MConstRef<MOSDMap>& m)
{
std::set<entity_addr_t> new_blocklists;

std::scoped_lock cl(client_lock);
objecter->consume_blocklist_events(&new_blocklists);

const auto myaddrs = messenger->get_myaddrs();
bool new_blocklist = false;
bool prenautilus = objecter->with_osdmap(
bool new_blocklist = objecter->with_osdmap(
[&](const OSDMap& o) {
return o.require_osd_release < ceph_release_t::nautilus;
return o.is_blocklisted(myaddrs);
});
if (!blocklisted) {
for (auto a : myaddrs.v) {
// blocklist entries are always TYPE_ANY for nautilus+
a.set_type(entity_addr_t::TYPE_ANY);
if (new_blocklists.count(a)) {
new_blocklist = true;
break;
}
if (prenautilus) {
// ...except pre-nautilus, they were TYPE_LEGACY
a.set_type(entity_addr_t::TYPE_LEGACY);
if (new_blocklists.count(a)) {
new_blocklist = true;
break;
}
}
}
}
if (new_blocklist) {

if (new_blocklist && !blocklisted) {
auto epoch = objecter->with_osdmap([](const OSDMap &o){
return o.get_epoch();
});
Expand Down

0 comments on commit 5f57dae

Please sign in to comment.