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

Method handle_cap_import

src/client/Client.cc:5740–5781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5738}
5739
5740void Client::handle_cap_import(MetaSession *session, Inode *in, const MConstRef<MClientCaps>& m)
5741{
5742 mds_rank_t mds = session->mds_num;
5743
5744 ldout(cct, 5) << __func__ << " ino " << m->get_ino() << " mseq " << m->get_mseq()
5745 << " IMPORT from mds." << mds << dendl;
5746
5747 const mds_rank_t peer_mds = mds_rank_t(m->peer.mds);
5748 Cap *cap = NULL;
5749 UserPerm cap_perms;
5750 if (auto it = in->caps.find(peer_mds); m->peer.cap_id && it != in->caps.end()) {
5751 cap = &it->second;
5752 cap_perms = cap->latest_perms;
5753 }
5754
5755 // add/update it
5756 SnapRealm *realm = NULL;
5757 update_snap_trace(session, m->snapbl, &realm);
5758
5759 int issued = m->get_caps();
5760 int wanted = m->get_wanted();
5761 add_update_cap(in, session, m->get_cap_id(),
5762 issued, wanted, m->get_seq(), m->get_mseq(),
5763 m->get_realm(), CEPH_CAP_FLAG_AUTH, cap_perms);
5764
5765 if (cap && cap->cap_id == m->peer.cap_id) {
5766 remove_cap(cap, (m->peer.flags & CEPH_CAP_FLAG_RELEASE));
5767 }
5768
5769 if (realm)
5770 put_snap_realm(realm);
5771
5772 if (in->auth_cap && in->auth_cap->session == session) {
5773 if (!(wanted & CEPH_CAP_ANY_FILE_WR) ||
5774 in->requested_max_size > m->get_max_size()) {
5775 in->requested_max_size = 0;
5776 ldout(cct, 15) << "reset requested_max_size after cap import" << dendl;
5777 }
5778 // reflush any/all caps (if we are now the auth_cap)
5779 kick_flushing_caps(in, session);
5780 }
5781}
5782
5783void Client::handle_cap_export(MetaSession *session, Inode *in, const MConstRef<MClientCaps>& m)
5784{

Callers

nothing calls this directly

Calls 10

get_wantedMethod · 0.80
get_inoMethod · 0.45
get_mseqMethod · 0.45
findMethod · 0.45
endMethod · 0.45
get_capsMethod · 0.45
get_cap_idMethod · 0.45
get_seqMethod · 0.45
get_realmMethod · 0.45
get_max_sizeMethod · 0.45

Tested by

no test coverage detected