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

Method handle_caps

src/client/Client.cc:5644–5738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5642}
5643
5644void Client::handle_caps(const MConstRef<MClientCaps>& m)
5645{
5646 mds_rank_t mds = mds_rank_t(m->get_source().num());
5647
5648 std::scoped_lock cl(client_lock);
5649 auto session = _get_mds_session(mds, m->get_connection().get());
5650 if (!session) {
5651 return;
5652 }
5653
5654 if (m->osd_epoch_barrier && !objecter->have_map(m->osd_epoch_barrier)) {
5655 // Pause RADOS operations until we see the required epoch
5656 objecter->set_epoch_barrier(m->osd_epoch_barrier);
5657 }
5658
5659 if (m->osd_epoch_barrier > cap_epoch_barrier) {
5660 // Record the barrier so that we will transmit it to MDS when releasing
5661 set_cap_epoch_barrier(m->osd_epoch_barrier);
5662 }
5663
5664 got_mds_push(session.get());
5665
5666 // check whether the current inode is under subvolume for metrics collection
5667 if (m->subvolume_id > 0) {
5668 ldout(cct, 10) << __func__ << " adding " << m->get_ino() << " to subvolume tracker " << m->subvolume_id << dendl;
5669 subvolume_tracker->add_inode(m->get_ino(), m->subvolume_id);
5670 }
5671
5672 bool do_cap_release = false;
5673 Inode *in;
5674 vinodeno_t vino(m->get_ino(), CEPH_NOSNAP);
5675 if (auto it = inode_map.find(vino); it != inode_map.end()) {
5676 in = it->second;
5677
5678 /* MDS maybe waiting for cap release with increased seq */
5679 switch (m->get_op()) {
5680 case CEPH_CAP_OP_REVOKE:
5681 case CEPH_CAP_OP_GRANT:
5682 if (!in->caps.count(mds)) {
5683 do_cap_release = true;
5684 ldout(cct, 5) << __func__ << " vino " << vino << " don't have cap "
5685 << m->get_cap_id() << " op " << m->get_op()
5686 << ", immediately releasing" << dendl;
5687 }
5688 }
5689 } else {
5690 /* MDS maybe waiting for cap release with increased seq */
5691 switch (m->get_op()) {
5692 case CEPH_CAP_OP_IMPORT:
5693 case CEPH_CAP_OP_REVOKE:
5694 case CEPH_CAP_OP_GRANT:
5695 do_cap_release = true;
5696 ldout(cct, 5) << __func__ << " don't have vino " << vino << " op "
5697 << m->get_op() << ", immediately releasing" << dendl;
5698 break;
5699 default:
5700 ldout(cct, 5) << __func__ << " don't have vino " << vino << ", dropping" << dendl;
5701 return;

Callers

nothing calls this directly

Calls 15

have_mapMethod · 0.80
set_epoch_barrierMethod · 0.80
enqueue_cap_releaseMethod · 0.80
numMethod · 0.45
get_sourceMethod · 0.45
getMethod · 0.45
get_connectionMethod · 0.45
get_inoMethod · 0.45
add_inodeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
get_opMethod · 0.45

Tested by

no test coverage detected