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

Method handle_cap_export

src/client/Client.cc:5783–5826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5781}
5782
5783void Client::handle_cap_export(MetaSession *session, Inode *in, const MConstRef<MClientCaps>& m)
5784{
5785 mds_rank_t mds = session->mds_num;
5786
5787 ldout(cct, 5) << __func__ << " ino " << m->get_ino() << " mseq " << m->get_mseq()
5788 << " EXPORT from mds." << mds << dendl;
5789
5790 auto it = in->caps.find(mds);
5791 if (it != in->caps.end()) {
5792 Cap &cap = it->second;
5793 if (cap.cap_id == m->get_cap_id()) {
5794 if (m->peer.cap_id) {
5795 const auto peer_mds = mds_rank_t(m->peer.mds);
5796 auto tsession = _get_or_open_mds_session(peer_mds);
5797 auto it = in->caps.find(peer_mds);
5798 if (it != in->caps.end()) {
5799 Cap &tcap = it->second;
5800 if (tcap.cap_id == m->peer.cap_id &&
5801 ceph_seq_cmp(tcap.seq, m->peer.issue_seq) < 0) {
5802 tcap.cap_id = m->peer.cap_id;
5803 tcap.seq = m->peer.issue_seq - 1;
5804 tcap.issue_seq = m->peer.issue_seq - 1;
5805 tcap.issued |= cap.issued;
5806 tcap.implemented |= cap.issued;
5807 if (&cap == in->auth_cap)
5808 in->auth_cap = &tcap;
5809 if (in->auth_cap == &tcap && in->flushing_cap_item.is_on_list())
5810 adjust_session_flushing_caps(in, session, tsession.get());
5811 }
5812 } else {
5813 add_update_cap(in, tsession.get(), m->peer.cap_id, cap.issued, 0,
5814 m->peer.issue_seq - 1, m->peer.mseq, (uint64_t)-1,
5815 &cap == in->auth_cap ? CEPH_CAP_FLAG_AUTH : 0,
5816 cap.latest_perms);
5817 }
5818 } else {
5819 if (cap.wanted | cap.issued)
5820 in->flags |= I_CAP_DROPPED;
5821 }
5822
5823 remove_cap(&cap, false);
5824 }
5825 }
5826}
5827
5828void Client::handle_cap_trunc(MetaSession *session, Inode *in, const MConstRef<MClientCaps>& m)
5829{

Callers

nothing calls this directly

Calls 8

ceph_seq_cmpFunction · 0.85
get_inoMethod · 0.45
get_mseqMethod · 0.45
findMethod · 0.45
endMethod · 0.45
get_cap_idMethod · 0.45
is_on_listMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected