MCPcopy Create free account
hub / github.com/ceph/ceph / fetch_fsmap

Method fetch_fsmap

src/client/Client.cc:6698–6741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6696}
6697
6698int Client::fetch_fsmap(bool user)
6699{
6700 ceph_assert(ceph_mutex_is_locked_by_me(client_lock));
6701
6702 // Retrieve FSMap to enable looking up daemon addresses. We need FSMap
6703 // rather than MDSMap because no one MDSMap contains all the daemons, and
6704 // a `tell` can address any daemon.
6705 version_t fsmap_latest;
6706 bs::error_code ec;
6707 do {
6708 client_lock.unlock();
6709 std::tie(fsmap_latest, std::ignore) =
6710 monclient->get_version("fsmap", ca::use_blocked[ec]);
6711 client_lock.lock();
6712 } while (ec == bs::errc::resource_unavailable_try_again);
6713
6714 if (ec) {
6715 lderr(cct) << "Failed to learn FSMap version: " << ec << dendl;
6716 return ceph::from_error_code(ec);
6717 }
6718
6719 ldout(cct, 10) << __func__ << " learned FSMap version " << fsmap_latest << dendl;
6720
6721 if (user) {
6722 if (!fsmap_user || fsmap_user->get_epoch() < fsmap_latest) {
6723 monclient->sub_want("fsmap.user", fsmap_latest, CEPH_SUBSCRIBE_ONETIME);
6724 monclient->renew_subs();
6725 wait_on_list(waiting_for_fsmap);
6726 }
6727 ceph_assert(fsmap_user);
6728 ceph_assert(fsmap_user->get_epoch() >= fsmap_latest);
6729 } else {
6730 if (!fsmap || fsmap->get_epoch() < fsmap_latest) {
6731 monclient->sub_want("fsmap", fsmap_latest, CEPH_SUBSCRIBE_ONETIME);
6732 monclient->renew_subs();
6733 wait_on_list(waiting_for_fsmap);
6734 }
6735 ceph_assert(fsmap);
6736 ceph_assert(fsmap->get_epoch() >= fsmap_latest);
6737 }
6738 ldout(cct, 10) << __func__ << " finished waiting for FSMap version "
6739 << fsmap_latest << dendl;
6740 return 0;
6741}
6742
6743/**
6744 *

Callers

nothing calls this directly

Calls 7

from_error_codeFunction · 0.85
unlockMethod · 0.45
get_versionMethod · 0.45
lockMethod · 0.45
get_epochMethod · 0.45
sub_wantMethod · 0.45
renew_subsMethod · 0.45

Tested by

no test coverage detected