From 99e58f5854725ed42d91a7bc0d8db9a251701e1b Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 25 Oct 2023 21:30:31 -0400 Subject: [PATCH] mds: use const qualifier for MDRequestRef The ref should be const even if its contents are not. Signed-off-by: Patrick Donnelly --- src/mds/Locker.cc | 34 +++---- src/mds/Locker.h | 30 +++--- src/mds/MDCache.cc | 60 +++++------ src/mds/MDCache.h | 54 +++++----- src/mds/MDSRank.cc | 2 +- src/mds/MDSRank.h | 2 +- src/mds/Migrator.cc | 2 +- src/mds/Migrator.h | 2 +- src/mds/Server.cc | 243 ++++++++++++++++++++++---------------------- src/mds/Server.h | 192 +++++++++++++++++----------------- 10 files changed, 311 insertions(+), 310 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index b4a28fb8379..3b75e16937e 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -139,7 +139,7 @@ void Locker::send_lock_message(SimpleLock *lock, int msg, const bufferlist &data } } -bool Locker::try_rdlock_snap_layout(CInode *in, MDRequestRef& mdr, +bool Locker::try_rdlock_snap_layout(CInode *in, const MDRequestRef& mdr, int n, bool want_layout) { dout(10) << __func__ << " " << *mdr << " " << *in << dendl; @@ -205,10 +205,10 @@ failed: } struct MarkEventOnDestruct { - MDRequestRef& mdr; + MDRequestRef mdr; std::string_view message; bool mark_event; - MarkEventOnDestruct(MDRequestRef& _mdr, std::string_view _message) : + MarkEventOnDestruct(const MDRequestRef& _mdr, std::string_view _message) : mdr(_mdr), message(_message), mark_event(true) {} @@ -220,7 +220,7 @@ struct MarkEventOnDestruct { /* If this function returns false, the mdr has been placed * on the appropriate wait list */ -bool Locker::acquire_locks(MDRequestRef& mdr, +bool Locker::acquire_locks(const MDRequestRef& mdr, MutationImpl::LockOpVec& lov, CInode *auth_pin_freeze, bool auth_pin_nonblocking) @@ -892,7 +892,7 @@ void Locker::invalidate_lock_caches(SimpleLock *lock) } } -void Locker::create_lock_cache(MDRequestRef& mdr, CInode *diri, file_layout_t *dir_layout) +void Locker::create_lock_cache(const MDRequestRef& mdr, CInode *diri, file_layout_t *dir_layout) { if (mdr->lock_cache) return; @@ -1039,7 +1039,7 @@ void Locker::create_lock_cache(MDRequestRef& mdr, CInode *diri, file_layout_t *d mdr->lock_cache = lock_cache; } -bool Locker::find_and_attach_lock_cache(MDRequestRef& mdr, CInode *diri) +bool Locker::find_and_attach_lock_cache(const MDRequestRef& mdr, CInode *diri) { if (mdr->lock_cache) return true; @@ -1569,7 +1569,7 @@ bool Locker::rdlock_try(SimpleLock *lock, client_t client) return false; } -bool Locker::rdlock_start(SimpleLock *lock, MDRequestRef& mut, bool as_anon) +bool Locker::rdlock_start(SimpleLock *lock, const MDRequestRef& mut, bool as_anon) { dout(7) << "rdlock_start on " << *lock << " on " << *lock->get_parent() << dendl; @@ -1660,7 +1660,7 @@ void Locker::rdlock_finish(const MutationImpl::lock_iterator& it, MutationImpl * } } -bool Locker::rdlock_try_set(MutationImpl::LockOpVec& lov, MDRequestRef& mdr) +bool Locker::rdlock_try_set(MutationImpl::LockOpVec& lov, const MDRequestRef& mdr) { dout(10) << __func__ << dendl; for (const auto& p : lov) { @@ -1747,7 +1747,7 @@ bool Locker::wrlock_try(SimpleLock *lock, const MutationRef& mut, client_t clien return false; } -bool Locker::wrlock_start(const MutationImpl::LockOp &op, MDRequestRef& mut) +bool Locker::wrlock_start(const MutationImpl::LockOp &op, const MDRequestRef& mut) { SimpleLock *lock = op.lock; if (lock->get_type() == CEPH_LOCK_IVERSION || @@ -1840,7 +1840,7 @@ void Locker::wrlock_finish(const MutationImpl::lock_iterator& it, MutationImpl * // remote wrlock -void Locker::remote_wrlock_start(SimpleLock *lock, mds_rank_t target, MDRequestRef& mut) +void Locker::remote_wrlock_start(SimpleLock *lock, mds_rank_t target, const MDRequestRef& mut) { dout(7) << "remote_wrlock_start mds." << target << " on " << *lock << " on " << *lock->get_parent() << dendl; @@ -1891,7 +1891,7 @@ void Locker::remote_wrlock_finish(const MutationImpl::lock_iterator& it, Mutatio // ------------------ // xlock -bool Locker::xlock_start(SimpleLock *lock, MDRequestRef& mut) +bool Locker::xlock_start(SimpleLock *lock, const MDRequestRef& mut) { if (lock->get_type() == CEPH_LOCK_IVERSION || lock->get_type() == CEPH_LOCK_DVERSION) @@ -2179,7 +2179,7 @@ void Locker::file_update_finish(CInode *in, MutationRef& mut, unsigned flags, Capability* Locker::issue_new_caps(CInode *in, int mode, - MDRequestRef& mdr, + const MDRequestRef& mdr, SnapRealm *realm) { dout(7) << "issue_new_caps for mode " << mode << " on " << *in << dendl; @@ -3415,7 +3415,7 @@ public: } }; -void Locker::process_request_cap_release(MDRequestRef& mdr, client_t client, const ceph_mds_request_release& item, +void Locker::process_request_cap_release(const MDRequestRef& mdr, client_t client, const ceph_mds_request_release& item, std::string_view dname) { inodeno_t ino = (uint64_t)item.ino; @@ -3534,7 +3534,7 @@ void Locker::kick_issue_caps(CInode *in, client_t client, ceph_seq_t seq) issue_caps(in, cap); } -void Locker::kick_cap_releases(MDRequestRef& mdr) +void Locker::kick_cap_releases(const MDRequestRef& mdr) { client_t client = mdr->get_client(); for (map::iterator p = mdr->cap_releases.begin(); @@ -4253,7 +4253,7 @@ void Locker::handle_client_lease(const cref_t &m) } -void Locker::issue_client_lease(CDentry *dn, CInode *in, MDRequestRef &mdr, utime_t now, +void Locker::issue_client_lease(CDentry *dn, CInode *in, const MDRequestRef& mdr, utime_t now, bufferlist &bl) { client_t client = mdr->get_client(); @@ -5329,7 +5329,7 @@ void Locker::local_wrlock_grab(LocalLockC *lock, MutationRef& mut) ceph_assert(it->is_wrlock()); } -bool Locker::local_wrlock_start(LocalLockC *lock, MDRequestRef& mut) +bool Locker::local_wrlock_start(LocalLockC *lock, const MDRequestRef& mut) { dout(7) << "local_wrlock_start on " << *lock << " on " << *lock->get_parent() << dendl; @@ -5361,7 +5361,7 @@ void Locker::local_wrlock_finish(const MutationImpl::lock_iterator& it, Mutation } } -bool Locker::local_xlock_start(LocalLockC *lock, MDRequestRef& mut) +bool Locker::local_xlock_start(LocalLockC *lock, const MDRequestRef& mut) { dout(7) << "local_xlock_start on " << *lock << " on " << *lock->get_parent() << dendl; diff --git a/src/mds/Locker.h b/src/mds/Locker.h index 03772f029cd..eed421ba0db 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -51,12 +51,12 @@ public: void nudge_log(SimpleLock *lock); - bool acquire_locks(MDRequestRef& mdr, + bool acquire_locks(const MDRequestRef& mdr, MutationImpl::LockOpVec& lov, CInode *auth_pin_freeze=NULL, bool auth_pin_nonblocking=false); - bool try_rdlock_snap_layout(CInode *in, MDRequestRef& mdr, + bool try_rdlock_snap_layout(CInode *in, const MDRequestRef& mdr, int n=0, bool want_layout=false); void notify_freeze_waiter(MDSCacheObject *o); @@ -68,8 +68,8 @@ public: void drop_locks_for_fragment_unfreeze(MutationImpl *mut); int get_cap_bit_for_lock_cache(int op); - void create_lock_cache(MDRequestRef& mdr, CInode *diri, file_layout_t *dir_layout=nullptr); - bool find_and_attach_lock_cache(MDRequestRef& mdr, CInode *diri); + void create_lock_cache(const MDRequestRef& mdr, CInode *diri, file_layout_t *dir_layout=nullptr); + bool find_and_attach_lock_cache(const MDRequestRef& mdr, CInode *diri); void invalidate_lock_caches(CDir *dir); void invalidate_lock_caches(SimpleLock *lock); void invalidate_lock_cache(MDLockCache *lock_cache); @@ -95,20 +95,20 @@ public: bool _rdlock_kick(SimpleLock *lock, bool as_anon); bool rdlock_try(SimpleLock *lock, client_t client); - bool rdlock_start(SimpleLock *lock, MDRequestRef& mut, bool as_anon=false); + bool rdlock_start(SimpleLock *lock, const MDRequestRef& mut, bool as_anon=false); void rdlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut, bool *pneed_issue); - bool rdlock_try_set(MutationImpl::LockOpVec& lov, MDRequestRef& mdr); + bool rdlock_try_set(MutationImpl::LockOpVec& lov, const MDRequestRef& mdr); bool rdlock_try_set(MutationImpl::LockOpVec& lov, MutationRef& mut); void wrlock_force(SimpleLock *lock, MutationRef& mut); bool wrlock_try(SimpleLock *lock, const MutationRef& mut, client_t client=-1); - bool wrlock_start(const MutationImpl::LockOp &op, MDRequestRef& mut); + bool wrlock_start(const MutationImpl::LockOp &op, const MDRequestRef& mut); void wrlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut, bool *pneed_issue); - void remote_wrlock_start(SimpleLock *lock, mds_rank_t target, MDRequestRef& mut); + void remote_wrlock_start(SimpleLock *lock, mds_rank_t target, const MDRequestRef& mut); void remote_wrlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut); - bool xlock_start(SimpleLock *lock, MDRequestRef& mut); + bool xlock_start(SimpleLock *lock, const MDRequestRef& mut); void _finish_xlock(SimpleLock *lock, client_t xlocker, bool *pneed_issue); void xlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut, bool *pneed_issue); @@ -137,10 +137,10 @@ public: // process_request_cap_release to preserve ordering. bool should_defer_client_cap_frozen(CInode *in); - void process_request_cap_release(MDRequestRef& mdr, client_t client, const ceph_mds_request_release& r, + void process_request_cap_release(const MDRequestRef& mdr, client_t client, const ceph_mds_request_release& r, std::string_view dname); - void kick_cap_releases(MDRequestRef& mdr); + void kick_cap_releases(const MDRequestRef& mdr); void kick_issue_caps(CInode *in, client_t client, ceph_seq_t seq); void remove_client_cap(CInode *in, Capability *cap, bool kill=false); @@ -162,7 +162,7 @@ public: // -- file i/o -- version_t issue_file_data_version(CInode *in); - Capability* issue_new_caps(CInode *in, int mode, MDRequestRef& mdr, SnapRealm *conrealm); + Capability* issue_new_caps(CInode *in, int mode, const MDRequestRef& mdr, SnapRealm *conrealm); int get_allowed_caps(CInode *in, Capability *cap, int &all_allowed, int &loner_allowed, int &xlocker_allowed); int issue_caps(CInode *in, Capability *only_cap=0); @@ -186,7 +186,7 @@ public: // -- client leases -- void handle_client_lease(const cref_t &m); - void issue_client_lease(CDentry *dn, CInode *in, MDRequestRef &mdr, utime_t now, bufferlist &bl); + void issue_client_lease(CDentry *dn, CInode *in, const MDRequestRef &mdr, utime_t now, bufferlist &bl); void revoke_client_leases(SimpleLock *lock); static void encode_lease(bufferlist& bl, const session_info_t& info, const LeaseStat& ls); @@ -225,9 +225,9 @@ protected: void _do_cap_release(client_t client, inodeno_t ino, uint64_t cap_id, ceph_seq_t mseq, ceph_seq_t seq); void caps_tick(); - bool local_wrlock_start(LocalLockC *lock, MDRequestRef& mut); + bool local_wrlock_start(LocalLockC *lock, const MDRequestRef& mut); void local_wrlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut); - bool local_xlock_start(LocalLockC *lock, MDRequestRef& mut); + bool local_xlock_start(LocalLockC *lock, const MDRequestRef& mut); void local_xlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut); void handle_file_lock(ScatterLock *lock, const cref_t &m); diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 35fca081a6b..cffa6e7dad0 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -3531,7 +3531,7 @@ MDPeerUpdate* MDCache::get_uncommitted_peer(metareqid_t reqid, mds_rank_t leader return su; } -void MDCache::finish_rollback(metareqid_t reqid, MDRequestRef& mdr) { +void MDCache::finish_rollback(metareqid_t reqid, const MDRequestRef& mdr) { auto p = resolve_need_rollback.find(reqid); ceph_assert(p != resolve_need_rollback.end()); if (mds->is_resolve()) { @@ -8255,7 +8255,7 @@ void MDCache::dispatch(const cref_t &m) } } -int MDCache::path_traverse(MDRequestRef& mdr, MDSContextFactory& cf, +int MDCache::path_traverse(const MDRequestRef& mdr, MDSContextFactory& cf, const filepath& path, int flags, vector *pdnvec, CInode **pin) { @@ -8672,7 +8672,7 @@ int MDCache::path_traverse(MDRequestRef& mdr, MDSContextFactory& cf, return 0; } -int MDCache::maybe_request_forward_to_auth(MDRequestRef& mdr, MDSContextFactory& cf, +int MDCache::maybe_request_forward_to_auth(const MDRequestRef& mdr, MDSContextFactory& cf, MDSCacheObject *p) { if (p->is_ambiguous_auth()) { @@ -8754,7 +8754,7 @@ void MDCache::open_remote_dirfrag(CInode *diri, frag_t approxfg, MDSContext *fin * will return inode for primary, or link up/open up remote link's inode as necessary. * If it's not available right now, puts mdr on wait list and returns null. */ -CInode *MDCache::get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected) +CInode *MDCache::get_dentry_inode(CDentry *dn, const MDRequestRef& mdr, bool projected) { CDentry::linkage_t *dnl; if (projected) @@ -9682,7 +9682,7 @@ MDRequestRef MDCache::request_get(metareqid_t rid) return p->second; } -void MDCache::request_finish(MDRequestRef& mdr) +void MDCache::request_finish(const MDRequestRef& mdr) { dout(7) << "request_finish " << *mdr << dendl; mdr->mark_event("finishing request"); @@ -9729,7 +9729,7 @@ void MDCache::request_finish(MDRequestRef& mdr) } -void MDCache::request_forward(MDRequestRef& mdr, mds_rank_t who, int port) +void MDCache::request_forward(const MDRequestRef& mdr, mds_rank_t who, int port) { CachedStackStringStream css; *css << "forwarding request to mds." << who; @@ -9754,7 +9754,7 @@ void MDCache::request_forward(MDRequestRef& mdr, mds_rank_t who, int port) } -void MDCache::dispatch_request(MDRequestRef& mdr) +void MDCache::dispatch_request(const MDRequestRef& mdr) { if (mdr->client_request) { mds->server->dispatch_client_request(mdr); @@ -9790,7 +9790,7 @@ void MDCache::dispatch_request(MDRequestRef& mdr) } -void MDCache::request_drop_foreign_locks(MDRequestRef& mdr) +void MDCache::request_drop_foreign_locks(const MDRequestRef& mdr) { if (!mdr->has_more()) return; @@ -9845,19 +9845,19 @@ void MDCache::request_drop_foreign_locks(MDRequestRef& mdr) * this function can get called more than once */ } -void MDCache::request_drop_non_rdlocks(MDRequestRef& mdr) +void MDCache::request_drop_non_rdlocks(const MDRequestRef& mdr) { request_drop_foreign_locks(mdr); mds->locker->drop_non_rdlocks(mdr.get()); } -void MDCache::request_drop_locks(MDRequestRef& mdr) +void MDCache::request_drop_locks(const MDRequestRef& mdr) { request_drop_foreign_locks(mdr); mds->locker->drop_locks(mdr.get()); } -void MDCache::request_cleanup(MDRequestRef& mdr) +void MDCache::request_cleanup(const MDRequestRef& mdr) { dout(15) << "request_cleanup " << *mdr << dendl; @@ -9899,7 +9899,7 @@ void MDCache::request_cleanup(MDRequestRef& mdr) mdr->mark_event("cleaned up request"); } -void MDCache::request_kill(MDRequestRef& mdr) +void MDCache::request_kill(const MDRequestRef& mdr) { // rollback peer requests is tricky. just let the request proceed. if (mdr->has_more() && @@ -11147,7 +11147,7 @@ void MDCache::decode_remote_dentry_link(CDir *dir, CDentry *dn, bufferlist::cons DECODE_FINISH(p); } -void MDCache::send_dentry_link(CDentry *dn, MDRequestRef& mdr) +void MDCache::send_dentry_link(CDentry *dn, const MDRequestRef& mdr) { dout(7) << __func__ << " " << *dn << dendl; @@ -11217,7 +11217,7 @@ void MDCache::handle_dentry_link(const cref_t &m) // UNLINK -void MDCache::send_dentry_unlink(CDentry *dn, CDentry *straydn, MDRequestRef& mdr) +void MDCache::send_dentry_unlink(CDentry *dn, CDentry *straydn, const MDRequestRef& mdr) { dout(10) << __func__ << " " << *dn << dendl; // share unlink news with replicas @@ -11537,7 +11537,7 @@ class C_MDC_FragmentFrozen : public MDSInternalContext { MDCache *mdcache; MDRequestRef mdr; public: - C_MDC_FragmentFrozen(MDCache *m, MDRequestRef& r) : + C_MDC_FragmentFrozen(MDCache *m, const MDRequestRef& r) : MDSInternalContext(m->mds), mdcache(m), mdr(r) {} void finish(int r) override { mdcache->fragment_frozen(mdr, r); @@ -11695,13 +11695,13 @@ void MDCache::fragment_freeze_dirs(const std::vector& dirs) class C_MDC_FragmentMarking : public MDCacheContext { MDRequestRef mdr; public: - C_MDC_FragmentMarking(MDCache *m, MDRequestRef& r) : MDCacheContext(m), mdr(r) {} + C_MDC_FragmentMarking(MDCache *m, const MDRequestRef& r) : MDCacheContext(m), mdr(r) {} void finish(int r) override { mdcache->fragment_mark_and_complete(mdr); } }; -void MDCache::fragment_mark_and_complete(MDRequestRef& mdr) +void MDCache::fragment_mark_and_complete(const MDRequestRef& mdr) { dirfrag_t basedirfrag = mdr->more()->fragment_base; map::iterator it = fragments.find(basedirfrag); @@ -11883,7 +11883,7 @@ void MDCache::find_stale_fragment_freeze() class C_MDC_FragmentPrep : public MDCacheLogContext { MDRequestRef mdr; public: - C_MDC_FragmentPrep(MDCache *m, MDRequestRef& r) : MDCacheLogContext(m), mdr(r) {} + C_MDC_FragmentPrep(MDCache *m, const MDRequestRef& r) : MDCacheLogContext(m), mdr(r) {} void finish(int r) override { mdcache->_fragment_logged(mdr); } @@ -11892,7 +11892,7 @@ public: class C_MDC_FragmentStore : public MDCacheContext { MDRequestRef mdr; public: - C_MDC_FragmentStore(MDCache *m, MDRequestRef& r) : MDCacheContext(m), mdr(r) {} + C_MDC_FragmentStore(MDCache *m, const MDRequestRef& r) : MDCacheContext(m), mdr(r) {} void finish(int r) override { mdcache->_fragment_stored(mdr); } @@ -11926,7 +11926,7 @@ public: } }; -void MDCache::fragment_frozen(MDRequestRef& mdr, int r) +void MDCache::fragment_frozen(const MDRequestRef& mdr, int r) { dirfrag_t basedirfrag = mdr->more()->fragment_base; map::iterator it = fragments.find(basedirfrag); @@ -11945,7 +11945,7 @@ void MDCache::fragment_frozen(MDRequestRef& mdr, int r) dispatch_fragment_dir(mdr); } -void MDCache::dispatch_fragment_dir(MDRequestRef& mdr) +void MDCache::dispatch_fragment_dir(const MDRequestRef& mdr) { dirfrag_t basedirfrag = mdr->more()->fragment_base; map::iterator it = fragments.find(basedirfrag); @@ -12050,7 +12050,7 @@ void MDCache::dispatch_fragment_dir(MDRequestRef& mdr) mds->mdlog->flush(); } -void MDCache::_fragment_logged(MDRequestRef& mdr) +void MDCache::_fragment_logged(const MDRequestRef& mdr) { dirfrag_t basedirfrag = mdr->more()->fragment_base; auto& info = fragments.at(basedirfrag); @@ -12080,7 +12080,7 @@ void MDCache::_fragment_logged(MDRequestRef& mdr) gather.activate(); } -void MDCache::_fragment_stored(MDRequestRef& mdr) +void MDCache::_fragment_stored(const MDRequestRef& mdr) { dirfrag_t basedirfrag = mdr->more()->fragment_base; fragment_info_t &info = fragments.at(basedirfrag); @@ -12972,7 +12972,7 @@ void MDCache::enqueue_scrub( enqueue_scrub_work(mdr); } -void MDCache::enqueue_scrub_work(MDRequestRef& mdr) +void MDCache::enqueue_scrub_work(const MDRequestRef& mdr) { CInode *in; CF_MDS_RetryRequestFactory cf(this, mdr, true); @@ -13004,7 +13004,7 @@ void MDCache::enqueue_scrub_work(MDRequestRef& mdr) struct C_MDC_RespondInternalRequest : public MDCacheLogContext { MDRequestRef mdr; - C_MDC_RespondInternalRequest(MDCache *c, MDRequestRef& m) : + C_MDC_RespondInternalRequest(MDCache *c, const MDRequestRef& m) : MDCacheLogContext(c), mdr(m) {} void finish(int r) override { mdr->apply(); @@ -13036,7 +13036,7 @@ void MDCache::repair_dirfrag_stats(CDir *dir) repair_dirfrag_stats_work(mdr); } -void MDCache::repair_dirfrag_stats_work(MDRequestRef& mdr) +void MDCache::repair_dirfrag_stats_work(const MDRequestRef& mdr) { CDir *dir = static_cast(mdr->internal_op_private); dout(10) << __func__ << " " << *dir << dendl; @@ -13143,7 +13143,7 @@ void MDCache::repair_inode_stats(CInode *diri) repair_inode_stats_work(mdr); } -void MDCache::repair_inode_stats_work(MDRequestRef& mdr) +void MDCache::repair_inode_stats_work(const MDRequestRef& mdr) { CInode *diri = static_cast(mdr->internal_op_private); dout(10) << __func__ << " " << *diri << dendl; @@ -13243,7 +13243,7 @@ void MDCache::rdlock_dirfrags_stats(CInode *diri, MDSInternalContext* fin) return rdlock_dirfrags_stats_work(mdr); } -void MDCache::rdlock_dirfrags_stats_work(MDRequestRef& mdr) +void MDCache::rdlock_dirfrags_stats_work(const MDRequestRef& mdr) { CInode *diri = static_cast(mdr->internal_op_private); dout(10) << __func__ << " " << *diri << dendl; @@ -13289,11 +13289,11 @@ protected: MDRequestRef mdr; MDSRank *get_mds() override { return mds; } public: - C_FinishIOMDR(MDSRank *mds_, MDRequestRef& mdr_) : mds(mds_), mdr(mdr_) {} + C_FinishIOMDR(MDSRank *mds_, const MDRequestRef& mdr_) : mds(mds_), mdr(mdr_) {} void finish(int r) override { mds->server->respond_to_request(mdr, r); } }; -void MDCache::flush_dentry_work(MDRequestRef& mdr) +void MDCache::flush_dentry_work(const MDRequestRef& mdr) { MutationImpl::LockOpVec lov; CInode *in = mds->server->rdlock_path_pin_ref(mdr, true); diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 5c1f34da4df..94347b8249c 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -415,16 +415,16 @@ class MDCache { return active_requests.count(rid); } MDRequestRef request_get(metareqid_t rid); - void request_pin_ref(MDRequestRef& r, CInode *ref, std::vector& trace); - void request_finish(MDRequestRef& mdr); - void request_forward(MDRequestRef& mdr, mds_rank_t mds, int port=0); - void dispatch_request(MDRequestRef& mdr); - void request_drop_foreign_locks(MDRequestRef& mdr); - void request_drop_non_rdlocks(MDRequestRef& r); - void request_drop_locks(MDRequestRef& r); - void request_cleanup(MDRequestRef& r); + void request_pin_ref(const MDRequestRef& r, CInode *ref, std::vector& trace); + void request_finish(const MDRequestRef& mdr); + void request_forward(const MDRequestRef& mdr, mds_rank_t mds, int port=0); + void dispatch_request(const MDRequestRef& mdr); + void request_drop_foreign_locks(const MDRequestRef& mdr); + void request_drop_non_rdlocks(const MDRequestRef& r); + void request_drop_locks(const MDRequestRef& r); + void request_cleanup(const MDRequestRef& r); - void request_kill(MDRequestRef& r); // called when session closes + void request_kill(const MDRequestRef& r); // called when session closes // journal/snap helpers CInode *pick_inode_snap(CInode *in, snapid_t follows); @@ -500,7 +500,7 @@ class MDCache { void add_rollback(metareqid_t reqid, mds_rank_t leader) { resolve_need_rollback[reqid] = leader; } - void finish_rollback(metareqid_t reqid, MDRequestRef& mdr); + void finish_rollback(metareqid_t reqid, const MDRequestRef& mdr); // ambiguous imports void add_ambiguous_import(dirfrag_t base, const std::vector& bounds); @@ -845,17 +845,17 @@ class MDCache { * If it returns 2 the request has been forwarded, and again the requester * should unwind itself and back out. */ - int path_traverse(MDRequestRef& mdr, MDSContextFactory& cf, + int path_traverse(const MDRequestRef& mdr, MDSContextFactory& cf, const filepath& path, int flags, std::vector *pdnvec, CInode **pin=nullptr); - int maybe_request_forward_to_auth(MDRequestRef& mdr, MDSContextFactory& cf, + int maybe_request_forward_to_auth(const MDRequestRef& mdr, MDSContextFactory& cf, MDSCacheObject *p); CInode *cache_traverse(const filepath& path); void open_remote_dirfrag(CInode *diri, frag_t fg, MDSContext *fin); - CInode *get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected=false); + CInode *get_dentry_inode(CDentry *dn, const MDRequestRef& mdr, bool projected=false); bool parallel_fetch(std::map& pathmap, std::set& missing); bool parallel_fetch_traverse_dir(inodeno_t ino, filepath& path, @@ -913,8 +913,8 @@ class MDCache { // -- namespace -- void encode_remote_dentry_link(CDentry::linkage_t *dnl, bufferlist& bl); void decode_remote_dentry_link(CDir *dir, CDentry *dn, bufferlist::const_iterator& p); - void send_dentry_link(CDentry *dn, MDRequestRef& mdr); - void send_dentry_unlink(CDentry *dn, CDentry *straydn, MDRequestRef& mdr); + void send_dentry_link(CDentry *dn, const MDRequestRef& mdr); + void send_dentry_unlink(CDentry *dn, CDentry *straydn, const MDRequestRef& mdr); void wait_for_uncommitted_fragment(dirfrag_t dirfrag, MDSContext *c) { uncommitted_fragments.at(dirfrag).waiters.push_back(c); @@ -1160,7 +1160,7 @@ class MDCache { int dump_cache(std::string_view fn, Formatter *f, double timeout); - void flush_dentry_work(MDRequestRef& mdr); + void flush_dentry_work(const MDRequestRef& mdr); /** * Resolve path to a dentry and pass it onto the ScrubStack. * @@ -1169,10 +1169,10 @@ class MDCache { * this scrub (we won't block them on a whole scrub as it can take a very * long time) */ - void enqueue_scrub_work(MDRequestRef& mdr); - void repair_inode_stats_work(MDRequestRef& mdr); - void repair_dirfrag_stats_work(MDRequestRef& mdr); - void rdlock_dirfrags_stats_work(MDRequestRef& mdr); + void enqueue_scrub_work(const MDRequestRef& mdr); + void repair_inode_stats_work(const MDRequestRef& mdr); + void repair_dirfrag_stats_work(const MDRequestRef& mdr); + void rdlock_dirfrags_stats_work(const MDRequestRef& mdr); ceph::unordered_map inode_map; // map of head inodes by ino std::map snap_inode_map; // map of snap inodes by ino @@ -1347,14 +1347,14 @@ class MDCache { bool can_fragment(CInode *diri, const std::vector& dirs); void fragment_freeze_dirs(const std::vector& dirs); - void fragment_mark_and_complete(MDRequestRef& mdr); - void fragment_frozen(MDRequestRef& mdr, int r); + void fragment_mark_and_complete(const MDRequestRef& mdr); + void fragment_frozen(const MDRequestRef& mdr, int r); void fragment_unmark_unfreeze_dirs(const std::vector& dirs); void fragment_drop_locks(fragment_info_t &info); void fragment_maybe_finish(const fragment_info_iterator& it); - void dispatch_fragment_dir(MDRequestRef& mdr); - void _fragment_logged(MDRequestRef& mdr); - void _fragment_stored(MDRequestRef& mdr); + void dispatch_fragment_dir(const MDRequestRef& mdr); + void _fragment_logged(const MDRequestRef& mdr); + void _fragment_stored(const MDRequestRef& mdr); void _fragment_committed(dirfrag_t f, const MDRequestRef& mdr); void _fragment_old_purged(dirfrag_t f, int bits, const MDRequestRef& mdr); @@ -1413,14 +1413,14 @@ class C_MDS_RetryRequest : public MDSInternalContext { MDCache *cache; MDRequestRef mdr; public: - C_MDS_RetryRequest(MDCache *c, MDRequestRef& r) : + C_MDS_RetryRequest(MDCache *c, const MDRequestRef& r) : MDSInternalContext(c->mds), cache(c), mdr(r) {} void finish(int r) override; }; class CF_MDS_RetryRequestFactory : public MDSContextFactory { public: - CF_MDS_RetryRequestFactory(MDCache *cache, MDRequestRef &mdr, bool dl) : + CF_MDS_RetryRequestFactory(MDCache *cache, const MDRequestRef& mdr, bool dl) : mdcache(cache), mdr(mdr), drop_locks(dl) {} MDSContext *build() override; private: diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 20ddf3eec58..7625ac4a9fd 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1483,7 +1483,7 @@ void MDSRank::send_message_mds(const ref_t& m, const entity_addrvec_t & messenger->send_to_mds(ref_t(m).detach(), addr); } -void MDSRank::forward_message_mds(MDRequestRef& mdr, mds_rank_t mds) +void MDSRank::forward_message_mds(const MDRequestRef& mdr, mds_rank_t mds) { ceph_assert(mds != whoami); diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index 48043df4baf..fd680863ca9 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -307,7 +307,7 @@ class MDSRank { void send_message_mds(const ref_t& m, mds_rank_t mds); void send_message_mds(const ref_t& m, const entity_addrvec_t &addr); - void forward_message_mds(MDRequestRef& mdr, mds_rank_t mds); + void forward_message_mds(const MDRequestRef& mdr, mds_rank_t mds); void send_message_client_counted(const ref_t& m, client_t client); void send_message_client_counted(const ref_t& m, Session* session); void send_message_client_counted(const ref_t& m, const ConnectionRef& connection); diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 1dd4cb17737..a3e9d31ded1 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -1003,7 +1003,7 @@ public: } }; -void Migrator::dispatch_export_dir(MDRequestRef& mdr, int count) +void Migrator::dispatch_export_dir(const MDRequestRef& mdr, int count) { CDir *dir = mdr->more()->export_dir; dout(7) << *mdr << " " << *dir << dendl; diff --git a/src/mds/Migrator.h b/src/mds/Migrator.h index be24e311100..53bf99fb639 100644 --- a/src/mds/Migrator.h +++ b/src/mds/Migrator.h @@ -185,7 +185,7 @@ public: // -- import/export -- // exporter - void dispatch_export_dir(MDRequestRef& mdr, int count); + void dispatch_export_dir(const MDRequestRef& mdr, int count); void export_dir(CDir *dir, mds_rank_t dest); void export_empty_import(CDir *dir); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 30861aace0d..235688251ee 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -160,7 +160,7 @@ public: explicit ServerLogContext(Server *s) : server(s) { ceph_assert(server != NULL); } - explicit ServerLogContext(Server *s, MDRequestRef& r) : server(s), mdr(r) { + explicit ServerLogContext(Server *s, const MDRequestRef& r) : server(s), mdr(r) { ceph_assert(server != NULL); } }; @@ -2023,7 +2023,7 @@ void Server::force_clients_readonly() /******* * some generic stuff for finishing off requests */ -void Server::journal_and_reply(MDRequestRef& mdr, CInode *in, CDentry *dn, LogEvent *le, MDSLogContextBase *fin) +void Server::journal_and_reply(const MDRequestRef& mdr, CInode *in, CDentry *dn, LogEvent *le, MDSLogContextBase *fin) { dout(10) << "journal_and_reply tracei " << in << " tracedn " << dn << dendl; ceph_assert(!mdr->has_completed); @@ -2057,7 +2057,7 @@ void Server::journal_and_reply(MDRequestRef& mdr, CInode *in, CDentry *dn, LogEv mdlog->flush(); } -void Server::submit_mdlog_entry(LogEvent *le, MDSLogContextBase *fin, MDRequestRef& mdr, +void Server::submit_mdlog_entry(LogEvent *le, MDSLogContextBase *fin, const MDRequestRef& mdr, std::string_view event) { if (mdr) { @@ -2071,7 +2071,7 @@ void Server::submit_mdlog_entry(LogEvent *le, MDSLogContextBase *fin, MDRequestR /* * send response built from mdr contents and error code; clean up mdr */ -void Server::respond_to_request(MDRequestRef& mdr, int r) +void Server::respond_to_request(const MDRequestRef& mdr, int r) { if (mdr->client_request) { if (mdr->is_batch_head()) { @@ -2191,7 +2191,7 @@ void Server::perf_gather_op_latency(const cref_t &req, utime_t l logger->tinc(code, lat); } -void Server::early_reply(MDRequestRef& mdr, CInode *tracei, CDentry *tracedn) +void Server::early_reply(const MDRequestRef& mdr, CInode *tracei, CDentry *tracedn) { if (!g_conf()->mds_early_reply) return; @@ -2270,7 +2270,7 @@ void Server::early_reply(MDRequestRef& mdr, CInode *tracei, CDentry *tracedn) * include a trace to tracei * Clean up mdr */ -void Server::reply_client_request(MDRequestRef& mdr, const ref_t &reply) +void Server::reply_client_request(const MDRequestRef& mdr, const ref_t &reply) { ceph_assert(mdr.get()); const cref_t &req = mdr->client_request; @@ -2384,7 +2384,7 @@ void Server::reply_client_request(MDRequestRef& mdr, const ref_t & */ void Server::set_trace_dist(const ref_t &reply, CInode *in, CDentry *dn, - MDRequestRef& mdr) + const MDRequestRef& mdr) { // skip doing this for debugging purposes? if (g_conf()->mds_inject_traceless_reply_probability && @@ -2631,7 +2631,7 @@ void Server::handle_osd_map() }); } -void Server::dispatch_client_request(MDRequestRef& mdr) +void Server::dispatch_client_request(const MDRequestRef& mdr) { // we shouldn't be waiting on anyone. ceph_assert(!mdr->has_more() || mdr->more()->waiting_on_peer.empty()); @@ -2648,7 +2648,8 @@ void Server::dispatch_client_request(MDRequestRef& mdr) mdr->batch_op_map->erase(it); return; } - mdr = std::move(new_batch_head); + mds->finisher->queue(new C_MDS_RetryRequest(mdcache, new_batch_head)); + return; } else { return; } @@ -3024,7 +3025,7 @@ void Server::handle_peer_request_reply(const cref_t &m) } } -void Server::dispatch_peer_request(MDRequestRef& mdr) +void Server::dispatch_peer_request(const MDRequestRef& mdr) { dout(7) << "dispatch_peer_request " << *mdr << " " << *mdr->peer_request << dendl; @@ -3138,7 +3139,7 @@ void Server::dispatch_peer_request(MDRequestRef& mdr) } } -void Server::handle_peer_auth_pin(MDRequestRef& mdr) +void Server::handle_peer_auth_pin(const MDRequestRef& mdr) { dout(10) << "handle_peer_auth_pin " << *mdr << dendl; @@ -3264,7 +3265,7 @@ blocked: return; } -void Server::handle_peer_auth_pin_ack(MDRequestRef& mdr, const cref_t &ack) +void Server::handle_peer_auth_pin_ack(const MDRequestRef& mdr, const cref_t &ack) { dout(10) << "handle_peer_auth_pin_ack on " << *mdr << " " << *ack << dendl; mds_rank_t from = mds_rank_t(ack->get_source().num()); @@ -3341,7 +3342,7 @@ void Server::handle_peer_auth_pin_ack(MDRequestRef& mdr, const cref_tsession) { int r = mdr->session->check_access( @@ -3363,7 +3364,7 @@ bool Server::check_access(MDRequestRef& mdr, CInode *in, unsigned mask) * check whether fragment has reached maximum size * */ -bool Server::check_fragment_space(MDRequestRef &mdr, CDir *dir) +bool Server::check_fragment_space(const MDRequestRef& mdr, CDir *dir) { const auto size = dir->get_frag_size(); const auto max = bal_fragment_size_max; @@ -3382,7 +3383,7 @@ bool Server::check_fragment_space(MDRequestRef &mdr, CDir *dir) * check whether entries in a dir reached maximum size * */ -bool Server::check_dir_max_entries(MDRequestRef &mdr, CDir *in) +bool Server::check_dir_max_entries(const MDRequestRef& mdr, CDir *in) { const uint64_t size = in->inode->get_projected_inode()->dirstat.nfiles + in->inode->get_projected_inode()->dirstat.nsubdirs; @@ -3395,7 +3396,7 @@ bool Server::check_dir_max_entries(MDRequestRef &mdr, CDir *in) } -CDentry* Server::prepare_stray_dentry(MDRequestRef& mdr, CInode *in) +CDentry* Server::prepare_stray_dentry(const MDRequestRef& mdr, CInode *in) { string straydname; in->name_stray_dentry(straydname); @@ -3437,7 +3438,7 @@ CDentry* Server::prepare_stray_dentry(MDRequestRef& mdr, CInode *in) * * create a new inode. set c/m/atime. hit dir pop. */ -CInode* Server::prepare_new_inode(MDRequestRef& mdr, CDir *dir, inodeno_t useino, unsigned mode, +CInode* Server::prepare_new_inode(const MDRequestRef& mdr, CDir *dir, inodeno_t useino, unsigned mode, const file_layout_t *layout) { CInode *in = new CInode(mdcache); @@ -3567,7 +3568,7 @@ CInode* Server::prepare_new_inode(MDRequestRef& mdr, CDir *dir, inodeno_t useino return in; } -void Server::journal_allocated_inos(MDRequestRef& mdr, EMetaBlob *blob) +void Server::journal_allocated_inos(const MDRequestRef& mdr, EMetaBlob *blob) { dout(20) << "journal_allocated_inos sessionmapv " << mds->sessionmap.get_projected() << " inotablev " << mds->inotable->get_projected_version() @@ -3580,7 +3581,7 @@ void Server::journal_allocated_inos(MDRequestRef& mdr, EMetaBlob *blob) mds->inotable->get_projected_version()); } -void Server::apply_allocated_inos(MDRequestRef& mdr, Session *session) +void Server::apply_allocated_inos(const MDRequestRef& mdr, Session *session) { dout(10) << "apply_allocated_inos " << mdr->alloc_ino << " / " << mdr->prealloc_inos @@ -3607,14 +3608,14 @@ void Server::apply_allocated_inos(MDRequestRef& mdr, Session *session) struct C_MDS_TryOpenInode : public ServerContext { MDRequestRef mdr; inodeno_t ino; - C_MDS_TryOpenInode(Server *s, MDRequestRef& r, inodeno_t i) : + C_MDS_TryOpenInode(Server *s, const MDRequestRef& r, inodeno_t i) : ServerContext(s), mdr(r), ino(i) {} void finish(int r) override { server->_try_open_ino(mdr, r, ino); } }; -void Server::_try_open_ino(MDRequestRef& mdr, int r, inodeno_t ino) +void Server::_try_open_ino(const MDRequestRef& mdr, int r, inodeno_t ino) { dout(10) << "_try_open_ino " << mdr.get() << " ino " << ino << " r=" << r << dendl; @@ -3639,7 +3640,7 @@ class C_MDS_TryFindInode : public ServerContext { MDCache *mdcache; inodeno_t ino; public: - C_MDS_TryFindInode(Server *s, MDRequestRef& r, MDCache *m, inodeno_t i) : + C_MDS_TryFindInode(Server *s, const MDRequestRef& r, MDCache *m, inodeno_t i) : ServerContext(s), mdr(r), mdcache(m), ino(i) {} void finish(int r) override { if (r == -CEPHFS_ESTALE) { // :( find_ino_peers failed @@ -3671,7 +3672,7 @@ public: /* If this returns null, the request has been handled * as appropriate: forwarded on, or the client's been replied to */ -CInode* Server::rdlock_path_pin_ref(MDRequestRef& mdr, +CInode* Server::rdlock_path_pin_ref(const MDRequestRef& mdr, bool want_auth, bool no_want_auth) { @@ -3749,7 +3750,7 @@ CInode* Server::rdlock_path_pin_ref(MDRequestRef& mdr, * to ensure tail dentry and target inode are both auth in one mds. the tail dentry * will not be xlocked too if authexist and the target inode exists. */ -CDentry* Server::rdlock_path_xlock_dentry(MDRequestRef& mdr, +CDentry* Server::rdlock_path_xlock_dentry(const MDRequestRef& mdr, bool create, bool okexist, bool authexist, bool want_layout) { @@ -3859,7 +3860,7 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequestRef& mdr, * order. */ std::pair -Server::rdlock_two_paths_xlock_destdn(MDRequestRef& mdr, bool xlock_srcdn) +Server::rdlock_two_paths_xlock_destdn(const MDRequestRef& mdr, bool xlock_srcdn) { const filepath& refpath = mdr->get_filepath(); @@ -4013,7 +4014,7 @@ Server::rdlock_two_paths_xlock_destdn(MDRequestRef& mdr, bool xlock_srcdn) * @param mdr request * @returns the pointer, or NULL if it had to be delayed (but mdr is taken care of) */ -CDir* Server::try_open_auth_dirfrag(CInode *diri, frag_t fg, MDRequestRef& mdr) +CDir* Server::try_open_auth_dirfrag(CInode *diri, frag_t fg, const MDRequestRef& mdr) { CDir *dir = diri->get_dirfrag(fg); @@ -4054,7 +4055,7 @@ CDir* Server::try_open_auth_dirfrag(CInode *diri, frag_t fg, MDRequestRef& mdr) // =============================================================================== // STAT -void Server::handle_client_getattr(MDRequestRef& mdr, bool is_lookup) +void Server::handle_client_getattr(const MDRequestRef& mdr, bool is_lookup) { const cref_t &req = mdr->client_request; @@ -4193,7 +4194,7 @@ void Server::handle_client_getattr(MDRequestRef& mdr, bool is_lookup) struct C_MDS_LookupIno2 : public ServerContext { MDRequestRef mdr; - C_MDS_LookupIno2(Server *s, MDRequestRef& r) : ServerContext(s), mdr(r) {} + C_MDS_LookupIno2(Server *s, const MDRequestRef& r) : ServerContext(s), mdr(r) {} void finish(int r) override { server->_lookup_ino_2(mdr, r); } @@ -4202,7 +4203,7 @@ struct C_MDS_LookupIno2 : public ServerContext { /* * filepath: ino */ -void Server::handle_client_lookup_ino(MDRequestRef& mdr, +void Server::handle_client_lookup_ino(const MDRequestRef& mdr, bool want_parent, bool want_dentry) { const cref_t &req = mdr->client_request; @@ -4305,7 +4306,7 @@ void Server::handle_client_lookup_ino(MDRequestRef& mdr, } } -void Server::_lookup_snap_ino(MDRequestRef& mdr) +void Server::_lookup_snap_ino(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; @@ -4380,7 +4381,7 @@ void Server::_lookup_snap_ino(MDRequestRef& mdr) } } -void Server::_lookup_ino_2(MDRequestRef& mdr, int r) +void Server::_lookup_ino_2(const MDRequestRef& mdr, int r) { inodeno_t ino = mdr->client_request->get_filepath().get_ino(); dout(10) << "_lookup_ino_2 " << mdr.get() << " ino " << ino << " r=" << r << dendl; @@ -4403,7 +4404,7 @@ void Server::_lookup_ino_2(MDRequestRef& mdr, int r) /* This function takes responsibility for the passed mdr*/ -void Server::handle_client_open(MDRequestRef& mdr) +void Server::handle_client_open(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; dout(7) << "open on " << req->get_filepath() << dendl; @@ -4597,7 +4598,7 @@ class C_MDS_openc_finish : public ServerLogContext { CDentry *dn; CInode *newi; public: - C_MDS_openc_finish(Server *s, MDRequestRef& r, CDentry *d, CInode *ni) : + C_MDS_openc_finish(Server *s, const MDRequestRef& r, CDentry *d, CInode *ni) : ServerLogContext(s, r), dn(d), newi(ni) {} void finish(int r) override { ceph_assert(r == 0); @@ -4627,7 +4628,7 @@ public: }; /* This function takes responsibility for the passed mdr*/ -void Server::handle_client_openc(MDRequestRef& mdr) +void Server::handle_client_openc(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; client_t client = mdr->get_client(); @@ -4802,7 +4803,7 @@ void Server::handle_client_openc(MDRequestRef& mdr) } -void Server::_finalize_readdir(MDRequestRef& mdr, +void Server::_finalize_readdir(const MDRequestRef& mdr, CInode *diri, CDir* dir, bool start, @@ -4844,7 +4845,7 @@ void Server::_finalize_readdir(MDRequestRef& mdr, respond_to_request(mdr, 0); } -void Server::handle_client_readdir(MDRequestRef& mdr) +void Server::handle_client_readdir(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; Session *session = mds->get_session(req); @@ -5095,7 +5096,7 @@ class C_MDS_inode_update_finish : public ServerLogContext { CInode *in; bool truncating_smaller, changed_ranges, adjust_realm; public: - C_MDS_inode_update_finish(Server *s, MDRequestRef& r, CInode *i, + C_MDS_inode_update_finish(Server *s, const MDRequestRef& r, CInode *i, bool sm=false, bool cr=false, bool ar=false) : ServerLogContext(s, r), in(i), truncating_smaller(sm), changed_ranges(cr), adjust_realm(ar) { } @@ -5129,7 +5130,7 @@ public: } }; -void Server::handle_client_file_setlock(MDRequestRef& mdr) +void Server::handle_client_file_setlock(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; MutationImpl::LockOpVec lov; @@ -5232,7 +5233,7 @@ void Server::handle_client_file_setlock(MDRequestRef& mdr) dout(10) << " state after lock change: " << *lock_state << dendl; } -void Server::handle_client_file_readlock(MDRequestRef& mdr) +void Server::handle_client_file_readlock(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; MutationImpl::LockOpVec lov; @@ -5285,7 +5286,7 @@ void Server::handle_client_file_readlock(MDRequestRef& mdr) respond_to_request(mdr, 0); } -void Server::handle_client_setattr(MDRequestRef& mdr) +void Server::handle_client_setattr(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; MutationImpl::LockOpVec lov; @@ -5480,7 +5481,7 @@ void Server::handle_client_setattr(MDRequestRef& mdr) } /* Takes responsibility for mdr */ -void Server::do_open_truncate(MDRequestRef& mdr, int cmode) +void Server::do_open_truncate(const MDRequestRef& mdr, int cmode) { CInode *in = mdr->in[0]; client_t client = mdr->get_client(); @@ -5544,7 +5545,7 @@ void Server::do_open_truncate(MDRequestRef& mdr, int cmode) /* This function cleans up the passed mdr */ -void Server::handle_client_setlayout(MDRequestRef& mdr) +void Server::handle_client_setlayout(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; CInode *cur = rdlock_path_pin_ref(mdr, true); @@ -5632,7 +5633,7 @@ void Server::handle_client_setlayout(MDRequestRef& mdr) journal_and_reply(mdr, cur, 0, le, new C_MDS_inode_update_finish(this, mdr, cur)); } -bool Server::xlock_policylock(MDRequestRef& mdr, CInode *in, bool want_layout, bool xlock_snaplock) +bool Server::xlock_policylock(const MDRequestRef& mdr, CInode *in, bool want_layout, bool xlock_snaplock) { if (mdr->locking_state & MutationImpl::ALL_LOCKED) return true; @@ -5659,7 +5660,7 @@ bool Server::xlock_policylock(MDRequestRef& mdr, CInode *in, bool want_layout, b return true; } -CInode* Server::try_get_auth_inode(MDRequestRef& mdr, inodeno_t ino) +CInode* Server::try_get_auth_inode(const MDRequestRef& mdr, inodeno_t ino) { CInode *in = mdcache->get_inode(ino); if (!in || in->state_test(CInode::STATE_PURGING)) { @@ -5674,7 +5675,7 @@ CInode* Server::try_get_auth_inode(MDRequestRef& mdr, inodeno_t ino) return in; } -void Server::handle_client_setdirlayout(MDRequestRef& mdr) +void Server::handle_client_setdirlayout(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; @@ -5994,7 +5995,7 @@ void Server::create_quota_realm(CInode *in) * Return 0 on success, otherwise this function takes * responsibility for the passed mdr. */ -int Server::check_layout_vxattr(MDRequestRef& mdr, +int Server::check_layout_vxattr(const MDRequestRef& mdr, string name, string value, file_layout_t *layout) @@ -6046,7 +6047,7 @@ int Server::check_layout_vxattr(MDRequestRef& mdr, return 0; } -void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur) +void Server::handle_set_vxattr(const MDRequestRef& mdr, CInode *cur) { const cref_t &req = mdr->client_request; MutationImpl::LockOpVec lov; @@ -6349,7 +6350,7 @@ void Server::handle_set_vxattr(MDRequestRef& mdr, CInode *cur) return; } -void Server::handle_remove_vxattr(MDRequestRef& mdr, CInode *cur) +void Server::handle_remove_vxattr(const MDRequestRef& mdr, CInode *cur) { const cref_t &req = mdr->client_request; string name(req->get_path2()); @@ -6582,7 +6583,7 @@ void Server::mirror_info_removexattr_handler(CInode *cur, InodeStoreBase::xattr_ xattr_rm(xattrs, Server::MirrorXattrInfo::FS_ID); } -void Server::handle_client_setxattr(MDRequestRef& mdr) +void Server::handle_client_setxattr(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; string name(req->get_path2()); @@ -6679,7 +6680,7 @@ void Server::handle_client_setxattr(MDRequestRef& mdr) journal_and_reply(mdr, cur, 0, le, new C_MDS_inode_update_finish(this, mdr, cur)); } -void Server::handle_client_removexattr(MDRequestRef& mdr) +void Server::handle_client_removexattr(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; std::string name(req->get_path2()); @@ -6748,7 +6749,7 @@ void Server::handle_client_removexattr(MDRequestRef& mdr) journal_and_reply(mdr, cur, 0, le, new C_MDS_inode_update_finish(this, mdr, cur)); } -void Server::handle_client_getvxattr(MDRequestRef& mdr) +void Server::handle_client_getvxattr(const MDRequestRef& mdr) { const auto& req = mdr->client_request; string xattr_name{req->get_path2()}; @@ -6914,7 +6915,7 @@ class C_MDS_mknod_finish : public ServerLogContext { CDentry *dn; CInode *newi; public: - C_MDS_mknod_finish(Server *s, MDRequestRef& r, CDentry *d, CInode *ni) : + C_MDS_mknod_finish(Server *s, const MDRequestRef& r, CDentry *d, CInode *ni) : ServerLogContext(s, r), dn(d), newi(ni) {} void finish(int r) override { ceph_assert(r == 0); @@ -6960,7 +6961,7 @@ public: }; -void Server::handle_client_mknod(MDRequestRef& mdr) +void Server::handle_client_mknod(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; client_t client = mdr->get_client(); @@ -7062,7 +7063,7 @@ void Server::handle_client_mknod(MDRequestRef& mdr) // MKDIR /* This function takes responsibility for the passed mdr*/ -void Server::handle_client_mkdir(MDRequestRef& mdr) +void Server::handle_client_mkdir(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; @@ -7156,7 +7157,7 @@ void Server::handle_client_mkdir(MDRequestRef& mdr) // SYMLINK -void Server::handle_client_symlink(MDRequestRef& mdr) +void Server::handle_client_symlink(const MDRequestRef& mdr) { const auto& req = mdr->client_request; @@ -7223,7 +7224,7 @@ void Server::handle_client_symlink(MDRequestRef& mdr) // LINK -void Server::handle_client_link(MDRequestRef& mdr) +void Server::handle_client_link(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; @@ -7355,7 +7356,7 @@ class C_MDS_link_local_finish : public ServerLogContext { version_t tipv; bool adjust_realm; public: - C_MDS_link_local_finish(Server *s, MDRequestRef& r, CDentry *d, CInode *ti, + C_MDS_link_local_finish(Server *s, const MDRequestRef& r, CDentry *d, CInode *ti, version_t dnpv_, version_t tipv_, bool ar) : ServerLogContext(s, r), dn(d), targeti(ti), dnpv(dnpv_), tipv(tipv_), adjust_realm(ar) { } @@ -7366,7 +7367,7 @@ public: }; -void Server::_link_local(MDRequestRef& mdr, CDentry *dn, CInode *targeti, SnapRealm *target_realm) +void Server::_link_local(const MDRequestRef& mdr, CDentry *dn, CInode *targeti, SnapRealm *target_realm) { dout(10) << "_link_local " << *dn << " to " << *targeti << dendl; @@ -7408,7 +7409,7 @@ void Server::_link_local(MDRequestRef& mdr, CDentry *dn, CInode *targeti, SnapRe new C_MDS_link_local_finish(this, mdr, dn, targeti, dnpv, tipv, adjust_realm)); } -void Server::_link_local_finish(MDRequestRef& mdr, CDentry *dn, CInode *targeti, +void Server::_link_local_finish(const MDRequestRef& mdr, CDentry *dn, CInode *targeti, version_t dnpv, version_t tipv, bool adjust_realm) { dout(10) << "_link_local_finish " << *dn << " to " << *targeti << dendl; @@ -7448,7 +7449,7 @@ class C_MDS_link_remote_finish : public ServerLogContext { CInode *targeti; version_t dpv; public: - C_MDS_link_remote_finish(Server *s, MDRequestRef& r, bool i, CDentry *d, CInode *ti) : + C_MDS_link_remote_finish(Server *s, const MDRequestRef& r, bool i, CDentry *d, CInode *ti) : ServerLogContext(s, r), inc(i), dn(d), targeti(ti), dpv(d->get_projected_version()) {} void finish(int r) override { @@ -7457,7 +7458,7 @@ public: } }; -void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targeti) +void Server::_link_remote(const MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targeti) { dout(10) << "_link_remote " << (inc ? "link ":"unlink ") @@ -7530,7 +7531,7 @@ void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targ new C_MDS_link_remote_finish(this, mdr, inc, dn, targeti)); } -void Server::_link_remote_finish(MDRequestRef& mdr, bool inc, +void Server::_link_remote_finish(const MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targeti, version_t dpv) { @@ -7583,7 +7584,7 @@ class C_MDS_PeerLinkPrep : public ServerLogContext { CInode *targeti; bool adjust_realm; public: - C_MDS_PeerLinkPrep(Server *s, MDRequestRef& r, CInode *t, bool ar) : + C_MDS_PeerLinkPrep(Server *s, const MDRequestRef& r, CInode *t, bool ar) : ServerLogContext(s, r), targeti(t), adjust_realm(ar) { } void finish(int r) override { ceph_assert(r == 0); @@ -7595,14 +7596,14 @@ class C_MDS_PeerLinkCommit : public ServerContext { MDRequestRef mdr; CInode *targeti; public: - C_MDS_PeerLinkCommit(Server *s, MDRequestRef& r, CInode *t) : + C_MDS_PeerLinkCommit(Server *s, const MDRequestRef& r, CInode *t) : ServerContext(s), mdr(r), targeti(t) { } void finish(int r) override { server->_commit_peer_link(mdr, r, targeti); } }; -void Server::handle_peer_link_prep(MDRequestRef& mdr) +void Server::handle_peer_link_prep(const MDRequestRef& mdr) { dout(10) << "handle_peer_link_prep " << *mdr << " on " << mdr->peer_request->get_object_info() @@ -7704,7 +7705,7 @@ void Server::handle_peer_link_prep(MDRequestRef& mdr) mdlog->flush(); } -void Server::_logged_peer_link(MDRequestRef& mdr, CInode *targeti, bool adjust_realm) +void Server::_logged_peer_link(const MDRequestRef& mdr, CInode *targeti, bool adjust_realm) { dout(10) << "_logged_peer_link " << *mdr << " " << *targeti << dendl; @@ -7738,13 +7739,13 @@ void Server::_logged_peer_link(MDRequestRef& mdr, CInode *targeti, bool adjust_r struct C_MDS_CommittedPeer : public ServerLogContext { - C_MDS_CommittedPeer(Server *s, MDRequestRef& m) : ServerLogContext(s, m) {} + C_MDS_CommittedPeer(Server *s, const MDRequestRef& m) : ServerLogContext(s, m) {} void finish(int r) override { server->_committed_peer(mdr); } }; -void Server::_commit_peer_link(MDRequestRef& mdr, int r, CInode *targeti) +void Server::_commit_peer_link(const MDRequestRef& mdr, int r, CInode *targeti) { dout(10) << "_commit_peer_link " << *mdr << " r=" << r @@ -7766,7 +7767,7 @@ void Server::_commit_peer_link(MDRequestRef& mdr, int r, CInode *targeti) } } -void Server::_committed_peer(MDRequestRef& mdr) +void Server::_committed_peer(const MDRequestRef& mdr) { dout(10) << "_committed_peer " << *mdr << dendl; @@ -7782,7 +7783,7 @@ void Server::_committed_peer(MDRequestRef& mdr) struct C_MDS_LoggedLinkRollback : public ServerLogContext { MutationRef mut; map> splits; - C_MDS_LoggedLinkRollback(Server *s, MutationRef& m, MDRequestRef& r, + C_MDS_LoggedLinkRollback(Server *s, MutationRef& m, const MDRequestRef& r, map>&& _splits) : ServerLogContext(s, r), mut(m), splits(std::move(_splits)) { } @@ -7791,7 +7792,7 @@ struct C_MDS_LoggedLinkRollback : public ServerLogContext { } }; -void Server::do_link_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr) +void Server::do_link_rollback(bufferlist &rbl, mds_rank_t leader, const MDRequestRef& mdr) { link_rollback rollback; auto p = rbl.cbegin(); @@ -7870,7 +7871,7 @@ void Server::do_link_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdlog->flush(); } -void Server::_link_rollback_finish(MutationRef& mut, MDRequestRef& mdr, +void Server::_link_rollback_finish(MutationRef& mut, const MDRequestRef& mdr, map>& splits) { dout(10) << "_link_rollback_finish" << dendl; @@ -7891,7 +7892,7 @@ void Server::_link_rollback_finish(MutationRef& mut, MDRequestRef& mdr, } -void Server::handle_peer_link_prep_ack(MDRequestRef& mdr, const cref_t &m) +void Server::handle_peer_link_prep_ack(const MDRequestRef& mdr, const cref_t &m) { dout(10) << "handle_peer_link_prep_ack " << *mdr << " " << *m << dendl; @@ -7923,7 +7924,7 @@ void Server::handle_peer_link_prep_ack(MDRequestRef& mdr, const cref_t &req = mdr->client_request; client_t client = mdr->get_client(); @@ -8080,7 +8081,7 @@ class C_MDS_unlink_local_finish : public ServerLogContext { CDentry *straydn; version_t dnpv; // deleted dentry public: - C_MDS_unlink_local_finish(Server *s, MDRequestRef& r, CDentry *d, CDentry *sd) : + C_MDS_unlink_local_finish(Server *s, const MDRequestRef& r, CDentry *d, CDentry *sd) : ServerLogContext(s, r), dn(d), straydn(sd), dnpv(d->get_projected_version()) {} void finish(int r) override { @@ -8089,7 +8090,7 @@ public: } }; -void Server::_unlink_local(MDRequestRef& mdr, CDentry *dn, CDentry *straydn) +void Server::_unlink_local(const MDRequestRef& mdr, CDentry *dn, CDentry *straydn) { dout(10) << "_unlink_local " << *dn << dendl; @@ -8178,7 +8179,7 @@ void Server::_unlink_local(MDRequestRef& mdr, CDentry *dn, CDentry *straydn) journal_and_reply(mdr, 0, dn, le, new C_MDS_unlink_local_finish(this, mdr, dn, straydn)); } -void Server::_unlink_local_finish(MDRequestRef& mdr, +void Server::_unlink_local_finish(const MDRequestRef& mdr, CDentry *dn, CDentry *straydn, version_t dnpv) { @@ -8240,7 +8241,7 @@ void Server::_unlink_local_finish(MDRequestRef& mdr, } } -bool Server::_rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, vector& trace, CDentry *straydn) +bool Server::_rmdir_prepare_witness(const MDRequestRef& mdr, mds_rank_t who, vector& trace, CDentry *straydn) { if (mds->is_cluster_degraded() && !mds->mdsmap->is_clientreplay_or_active_or_stopping(who)) { @@ -8269,7 +8270,7 @@ bool Server::_rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, vector_logged_peer_rmdir(mdr, dn, straydn); @@ -8279,14 +8280,14 @@ struct C_MDS_PeerRmdirPrep : public ServerLogContext { struct C_MDS_PeerRmdirCommit : public ServerContext { MDRequestRef mdr; CDentry *straydn; - C_MDS_PeerRmdirCommit(Server *s, MDRequestRef& r, CDentry *sd) + C_MDS_PeerRmdirCommit(Server *s, const MDRequestRef& r, CDentry *sd) : ServerContext(s), mdr(r), straydn(sd) { } void finish(int r) override { server->_commit_peer_rmdir(mdr, r, straydn); } }; -void Server::handle_peer_rmdir_prep(MDRequestRef& mdr) +void Server::handle_peer_rmdir_prep(const MDRequestRef& mdr) { dout(10) << "handle_peer_rmdir_prep " << *mdr << " " << mdr->peer_request->srcdnpath @@ -8372,7 +8373,7 @@ void Server::handle_peer_rmdir_prep(MDRequestRef& mdr) mdlog->flush(); } -void Server::_logged_peer_rmdir(MDRequestRef& mdr, CDentry *dn, CDentry *straydn) +void Server::_logged_peer_rmdir(const MDRequestRef& mdr, CDentry *dn, CDentry *straydn) { dout(10) << "_logged_peer_rmdir " << *mdr << " on " << *dn << dendl; CInode *in = dn->get_linkage()->get_inode(); @@ -8412,7 +8413,7 @@ void Server::_logged_peer_rmdir(MDRequestRef& mdr, CDentry *dn, CDentry *straydn } } -void Server::handle_peer_rmdir_prep_ack(MDRequestRef& mdr, const cref_t &ack) +void Server::handle_peer_rmdir_prep_ack(const MDRequestRef& mdr, const cref_t &ack) { dout(10) << "handle_peer_rmdir_prep_ack " << *mdr << " " << *ack << dendl; @@ -8434,7 +8435,7 @@ void Server::handle_peer_rmdir_prep_ack(MDRequestRef& mdr, const cref_tmore()->waiting_on_peer << dendl; } -void Server::_commit_peer_rmdir(MDRequestRef& mdr, int r, CDentry *straydn) +void Server::_commit_peer_rmdir(const MDRequestRef& mdr, int r, CDentry *straydn) { dout(10) << "_commit_peer_rmdir " << *mdr << " r=" << r << dendl; @@ -8467,14 +8468,14 @@ struct C_MDS_LoggedRmdirRollback : public ServerLogContext { metareqid_t reqid; CDentry *dn; CDentry *straydn; - C_MDS_LoggedRmdirRollback(Server *s, MDRequestRef& m, metareqid_t mr, CDentry *d, CDentry *st) + C_MDS_LoggedRmdirRollback(Server *s, const MDRequestRef& m, metareqid_t mr, CDentry *d, CDentry *st) : ServerLogContext(s, m), reqid(mr), dn(d), straydn(st) {} void finish(int r) override { server->_rmdir_rollback_finish(mdr, reqid, dn, straydn); } }; -void Server::do_rmdir_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr) +void Server::do_rmdir_rollback(bufferlist &rbl, mds_rank_t leader, const MDRequestRef& mdr) { // unlink the other rollback methods, the rmdir rollback is only // needed to record the subtree changes in the journal for inode @@ -8544,7 +8545,7 @@ void Server::do_rmdir_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdlog->flush(); } -void Server::_rmdir_rollback_finish(MDRequestRef& mdr, metareqid_t reqid, CDentry *dn, CDentry *straydn) +void Server::_rmdir_rollback_finish(const MDRequestRef& mdr, metareqid_t reqid, CDentry *dn, CDentry *straydn) { dout(10) << "_rmdir_rollback_finish " << reqid << dendl; @@ -8575,7 +8576,7 @@ void Server::_rmdir_rollback_finish(MDRequestRef& mdr, metareqid_t reqid, CDentr * the unlocked varient this is a fastpath check. we can't really be * sure until we rdlock the filelock. */ -bool Server::_dir_is_nonempty_unlocked(MDRequestRef& mdr, CInode *in) +bool Server::_dir_is_nonempty_unlocked(const MDRequestRef& mdr, CInode *in) { dout(10) << "dir_is_nonempty_unlocked " << *in << dendl; ceph_assert(in->is_auth()); @@ -8600,7 +8601,7 @@ bool Server::_dir_is_nonempty_unlocked(MDRequestRef& mdr, CInode *in) return false; } -bool Server::_dir_is_nonempty(MDRequestRef& mdr, CInode *in) +bool Server::_dir_is_nonempty(const MDRequestRef& mdr, CInode *in) { dout(10) << "dir_is_nonempty " << *in << dendl; ceph_assert(in->is_auth()); @@ -8636,7 +8637,7 @@ class C_MDS_rename_finish : public ServerLogContext { CDentry *destdn; CDentry *straydn; public: - C_MDS_rename_finish(Server *s, MDRequestRef& r, + C_MDS_rename_finish(Server *s, const MDRequestRef& r, CDentry *sdn, CDentry *ddn, CDentry *stdn) : ServerLogContext(s, r), srcdn(sdn), destdn(ddn), straydn(stdn) { } @@ -8661,7 +8662,7 @@ public: * * This function takes responsibility for the passed mdr. */ -void Server::handle_client_rename(MDRequestRef& mdr) +void Server::handle_client_rename(const MDRequestRef& mdr) { const auto& req = mdr->client_request; dout(7) << "handle_client_rename " << *req << dendl; @@ -9102,7 +9103,7 @@ void Server::handle_client_rename(MDRequestRef& mdr) } -void Server::_rename_finish(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn) +void Server::_rename_finish(const MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn) { dout(10) << "_rename_finish " << *mdr << dendl; @@ -9150,7 +9151,7 @@ void Server::_rename_finish(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, // helpers -bool Server::_rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, set &witnesse, +bool Server::_rename_prepare_witness(const MDRequestRef& mdr, mds_rank_t who, set &witnesse, vector& srctrace, vector& dsttrace, CDentry *straydn) { const auto& client_req = mdr->client_request; @@ -9195,7 +9196,7 @@ bool Server::_rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, setmore()->inode_import_v; @@ -9264,7 +9265,7 @@ bool Server::_need_force_journal(CInode *diri, bool empty) return force_journal; } -void Server::_rename_prepare(MDRequestRef& mdr, +void Server::_rename_prepare(const MDRequestRef& mdr, EMetaBlob *metablob, bufferlist *client_map_bl, CDentry *srcdn, CDentry *destdn, std::string_view alternate_name, CDentry *straydn) @@ -9618,7 +9619,7 @@ void Server::_rename_prepare(MDRequestRef& mdr, } -void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn) +void Server::_rename_apply(const MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn) { dout(10) << "_rename_apply " << *mdr << " " << *srcdn << " " << *destdn << dendl; dout(10) << " pvs " << mdr->more()->pvmap << dendl; @@ -9822,7 +9823,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C class C_MDS_PeerRenamePrep : public ServerLogContext { CDentry *srcdn, *destdn, *straydn; public: - C_MDS_PeerRenamePrep(Server *s, MDRequestRef& m, CDentry *sr, CDentry *de, CDentry *st) : + C_MDS_PeerRenamePrep(Server *s, const MDRequestRef& m, CDentry *sr, CDentry *de, CDentry *st) : ServerLogContext(s, m), srcdn(sr), destdn(de), straydn(st) {} void finish(int r) override { server->_logged_peer_rename(mdr, srcdn, destdn, straydn); @@ -9833,7 +9834,7 @@ class C_MDS_PeerRenameCommit : public ServerContext { MDRequestRef mdr; CDentry *srcdn, *destdn, *straydn; public: - C_MDS_PeerRenameCommit(Server *s, MDRequestRef& m, CDentry *sr, CDentry *de, CDentry *st) : + C_MDS_PeerRenameCommit(Server *s, const MDRequestRef& m, CDentry *sr, CDentry *de, CDentry *st) : ServerContext(s), mdr(m), srcdn(sr), destdn(de), straydn(st) {} void finish(int r) override { server->_commit_peer_rename(mdr, r, srcdn, destdn, straydn); @@ -9843,14 +9844,14 @@ public: class C_MDS_PeerRenameSessionsFlushed : public ServerContext { MDRequestRef mdr; public: - C_MDS_PeerRenameSessionsFlushed(Server *s, MDRequestRef& r) : + C_MDS_PeerRenameSessionsFlushed(Server *s, const MDRequestRef& r) : ServerContext(s), mdr(r) {} void finish(int r) override { server->_peer_rename_sessions_flushed(mdr); } }; -void Server::handle_peer_rename_prep(MDRequestRef& mdr) +void Server::handle_peer_rename_prep(const MDRequestRef& mdr) { dout(10) << "handle_peer_rename_prep " << *mdr << " " << mdr->peer_request->srcdnpath @@ -10088,7 +10089,7 @@ void Server::handle_peer_rename_prep(MDRequestRef& mdr) } } -void Server::_logged_peer_rename(MDRequestRef& mdr, +void Server::_logged_peer_rename(const MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn) { dout(10) << "_logged_peer_rename " << *mdr << dendl; @@ -10166,7 +10167,7 @@ void Server::_logged_peer_rename(MDRequestRef& mdr, } } -void Server::_commit_peer_rename(MDRequestRef& mdr, int r, +void Server::_commit_peer_rename(const MDRequestRef& mdr, int r, CDentry *srcdn, CDentry *destdn, CDentry *straydn) { dout(10) << "_commit_peer_rename " << *mdr << " r=" << r << dendl; @@ -10306,7 +10307,7 @@ struct C_MDS_LoggedRenameRollback : public ServerLogContext { CDentry *straydn; map> splits[2]; bool finish_mdr; - C_MDS_LoggedRenameRollback(Server *s, MutationRef& m, MDRequestRef& r, + C_MDS_LoggedRenameRollback(Server *s, MutationRef& m, const MDRequestRef& r, CDentry *sd, version_t pv, CDentry *dd, CDentry *st, map> _splits[2], bool f) : ServerLogContext(s, r), mut(m), srcdn(sd), srcdnpv(pv), destdn(dd), @@ -10320,7 +10321,7 @@ struct C_MDS_LoggedRenameRollback : public ServerLogContext { } }; -void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr, +void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t leader, const MDRequestRef& mdr, bool finish_mdr) { rename_rollback rollback; @@ -10645,7 +10646,7 @@ void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef } } -void Server::_rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentry *srcdn, +void Server::_rename_rollback_finish(MutationRef& mut, const MDRequestRef& mdr, CDentry *srcdn, version_t srcdnpv, CDentry *destdn, CDentry *straydn, map> splits[2], bool finish_mdr) { @@ -10721,7 +10722,7 @@ void Server::_rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentr mut->cleanup(); } -void Server::handle_peer_rename_prep_ack(MDRequestRef& mdr, const cref_t &ack) +void Server::handle_peer_rename_prep_ack(const MDRequestRef& mdr, const cref_t &ack) { dout(10) << "handle_peer_rename_prep_ack " << *mdr << " witnessed by " << ack->get_source() @@ -10767,7 +10768,7 @@ void Server::handle_peer_rename_prep_ack(MDRequestRef& mdr, const cref_tmore()->waiting_on_peer << dendl; } -void Server::handle_peer_rename_notify_ack(MDRequestRef& mdr, const cref_t &ack) +void Server::handle_peer_rename_notify_ack(const MDRequestRef& mdr, const cref_t &ack) { dout(10) << "handle_peer_rename_notify_ack " << *mdr << " from mds." << ack->get_source() << dendl; @@ -10786,7 +10787,7 @@ void Server::handle_peer_rename_notify_ack(MDRequestRef& mdr, const cref_t &req = mdr->client_request; @@ -10906,7 +10907,7 @@ void Server::handle_client_lssnap(MDRequestRef& mdr) struct C_MDS_mksnap_finish : public ServerLogContext { CInode *diri; SnapInfo info; - C_MDS_mksnap_finish(Server *s, MDRequestRef& r, CInode *di, SnapInfo &i) : + C_MDS_mksnap_finish(Server *s, const MDRequestRef& r, CInode *di, SnapInfo &i) : ServerLogContext(s, r), diri(di), info(i) {} void finish(int r) override { server->_mksnap_finish(mdr, diri, info); @@ -10914,7 +10915,7 @@ struct C_MDS_mksnap_finish : public ServerLogContext { }; /* This function takes responsibility for the passed mdr*/ -void Server::handle_client_mksnap(MDRequestRef& mdr) +void Server::handle_client_mksnap(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; // make sure we have as new a map as the client @@ -11072,7 +11073,7 @@ void Server::handle_client_mksnap(MDRequestRef& mdr) mdlog->flush(); } -void Server::_mksnap_finish(MDRequestRef& mdr, CInode *diri, SnapInfo &info) +void Server::_mksnap_finish(const MDRequestRef& mdr, CInode *diri, SnapInfo &info) { dout(10) << "_mksnap_finish " << *mdr << " " << info << dendl; @@ -11103,7 +11104,7 @@ void Server::_mksnap_finish(MDRequestRef& mdr, CInode *diri, SnapInfo &info) struct C_MDS_rmsnap_finish : public ServerLogContext { CInode *diri; snapid_t snapid; - C_MDS_rmsnap_finish(Server *s, MDRequestRef& r, CInode *di, snapid_t sn) : + C_MDS_rmsnap_finish(Server *s, const MDRequestRef& r, CInode *di, snapid_t sn) : ServerLogContext(s, r), diri(di), snapid(sn) {} void finish(int r) override { server->_rmsnap_finish(mdr, diri, snapid); @@ -11111,7 +11112,7 @@ struct C_MDS_rmsnap_finish : public ServerLogContext { }; /* This function takes responsibility for the passed mdr*/ -void Server::handle_client_rmsnap(MDRequestRef& mdr) +void Server::handle_client_rmsnap(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; @@ -11204,7 +11205,7 @@ void Server::handle_client_rmsnap(MDRequestRef& mdr) mdlog->flush(); } -void Server::_rmsnap_finish(MDRequestRef& mdr, CInode *diri, snapid_t snapid) +void Server::_rmsnap_finish(const MDRequestRef& mdr, CInode *diri, snapid_t snapid) { dout(10) << "_rmsnap_finish " << *mdr << " " << snapid << dendl; snapid_t stid = mdr->more()->stid; @@ -11233,7 +11234,7 @@ void Server::_rmsnap_finish(MDRequestRef& mdr, CInode *diri, snapid_t snapid) struct C_MDS_renamesnap_finish : public ServerLogContext { CInode *diri; snapid_t snapid; - C_MDS_renamesnap_finish(Server *s, MDRequestRef& r, CInode *di, snapid_t sn) : + C_MDS_renamesnap_finish(Server *s, const MDRequestRef& r, CInode *di, snapid_t sn) : ServerLogContext(s, r), diri(di), snapid(sn) {} void finish(int r) override { server->_renamesnap_finish(mdr, diri, snapid); @@ -11241,7 +11242,7 @@ struct C_MDS_renamesnap_finish : public ServerLogContext { }; /* This function takes responsibility for the passed mdr*/ -void Server::handle_client_renamesnap(MDRequestRef& mdr) +void Server::handle_client_renamesnap(const MDRequestRef& mdr) { const cref_t &req = mdr->client_request; if (req->get_filepath().get_ino() != req->get_filepath2().get_ino()) { @@ -11348,7 +11349,7 @@ void Server::handle_client_renamesnap(MDRequestRef& mdr) mdlog->flush(); } -void Server::_renamesnap_finish(MDRequestRef& mdr, CInode *diri, snapid_t snapid) +void Server::_renamesnap_finish(const MDRequestRef& mdr, CInode *diri, snapid_t snapid) { dout(10) << "_renamesnap_finish " << *mdr << " " << snapid << dendl; @@ -11370,7 +11371,7 @@ void Server::_renamesnap_finish(MDRequestRef& mdr, CInode *diri, snapid_t snapid respond_to_request(mdr, 0); } -void Server::handle_client_readdir_snapdiff(MDRequestRef& mdr) +void Server::handle_client_readdir_snapdiff(const MDRequestRef& mdr) { const cref_t& req = mdr->client_request; Session* session = mds->get_session(req); @@ -11557,7 +11558,7 @@ const bufferlist& Server::get_snap_trace(client_t client, SnapRealm *realm) cons void Server::_readdir_diff( utime_t now, - MDRequestRef& mdr, + const MDRequestRef& mdr, CInode* diri, CDir* dir, SnapRealm* realm, @@ -11642,7 +11643,7 @@ void Server::_readdir_diff( } bool Server::build_snap_diff( - MDRequestRef& mdr, + const MDRequestRef& mdr, CDir* dir, int bytes_left, dentry_key_t* skip_key, diff --git a/src/mds/Server.h b/src/mds/Server.h index 4715a0880c8..89cda03155d 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -162,61 +162,61 @@ public: void handle_client_request(const cref_t &m); void handle_client_reply(const cref_t &m); - void journal_and_reply(MDRequestRef& mdr, CInode *tracei, CDentry *tracedn, + void journal_and_reply(const MDRequestRef& mdr, CInode *tracei, CDentry *tracedn, LogEvent *le, MDSLogContextBase *fin); void submit_mdlog_entry(LogEvent *le, MDSLogContextBase *fin, - MDRequestRef& mdr, std::string_view event); - void dispatch_client_request(MDRequestRef& mdr); + const MDRequestRef& mdr, std::string_view event); + void dispatch_client_request(const MDRequestRef& mdr); void perf_gather_op_latency(const cref_t &req, utime_t lat); - void early_reply(MDRequestRef& mdr, CInode *tracei, CDentry *tracedn); - void respond_to_request(MDRequestRef& mdr, int r = 0); + void early_reply(const MDRequestRef& mdr, CInode *tracei, CDentry *tracedn); + void respond_to_request(const MDRequestRef& mdr, int r = 0); void set_trace_dist(const ref_t &reply, CInode *in, CDentry *dn, - MDRequestRef& mdr); + const MDRequestRef& mdr); void handle_peer_request(const cref_t &m); void handle_peer_request_reply(const cref_t &m); - void dispatch_peer_request(MDRequestRef& mdr); - void handle_peer_auth_pin(MDRequestRef& mdr); - void handle_peer_auth_pin_ack(MDRequestRef& mdr, const cref_t &ack); + void dispatch_peer_request(const MDRequestRef& mdr); + void handle_peer_auth_pin(const MDRequestRef& mdr); + void handle_peer_auth_pin_ack(const MDRequestRef& mdr, const cref_t &ack); // some helpers - bool check_fragment_space(MDRequestRef& mdr, CDir *in); - bool check_dir_max_entries(MDRequestRef& mdr, CDir *in); - bool check_access(MDRequestRef& mdr, CInode *in, unsigned mask); + bool check_fragment_space(const MDRequestRef& mdr, CDir *in); + bool check_dir_max_entries(const MDRequestRef& mdr, CDir *in); + bool check_access(const MDRequestRef& mdr, CInode *in, unsigned mask); bool _check_access(Session *session, CInode *in, unsigned mask, int caller_uid, int caller_gid, int setattr_uid, int setattr_gid); - CDentry *prepare_stray_dentry(MDRequestRef& mdr, CInode *in); - CInode* prepare_new_inode(MDRequestRef& mdr, CDir *dir, inodeno_t useino, unsigned mode, + CDentry *prepare_stray_dentry(const MDRequestRef& mdr, CInode *in); + CInode* prepare_new_inode(const MDRequestRef& mdr, CDir *dir, inodeno_t useino, unsigned mode, const file_layout_t *layout=nullptr); - void journal_allocated_inos(MDRequestRef& mdr, EMetaBlob *blob); - void apply_allocated_inos(MDRequestRef& mdr, Session *session); + void journal_allocated_inos(const MDRequestRef& mdr, EMetaBlob *blob); + void apply_allocated_inos(const MDRequestRef& mdr, Session *session); - void _try_open_ino(MDRequestRef& mdr, int r, inodeno_t ino); - CInode* rdlock_path_pin_ref(MDRequestRef& mdr, bool want_auth, + void _try_open_ino(const MDRequestRef& mdr, int r, inodeno_t ino); + CInode* rdlock_path_pin_ref(const MDRequestRef& mdr, bool want_auth, bool no_want_auth=false); - CDentry* rdlock_path_xlock_dentry(MDRequestRef& mdr, bool create, + CDentry* rdlock_path_xlock_dentry(const MDRequestRef& mdr, bool create, bool okexist=false, bool authexist=false, bool want_layout=false); std::pair - rdlock_two_paths_xlock_destdn(MDRequestRef& mdr, bool xlock_srcdn); + rdlock_two_paths_xlock_destdn(const MDRequestRef& mdr, bool xlock_srcdn); - CDir* try_open_auth_dirfrag(CInode *diri, frag_t fg, MDRequestRef& mdr); + CDir* try_open_auth_dirfrag(CInode *diri, frag_t fg, const MDRequestRef& mdr); // requests on existing inodes. - void handle_client_getattr(MDRequestRef& mdr, bool is_lookup); - void handle_client_lookup_ino(MDRequestRef& mdr, + void handle_client_getattr(const MDRequestRef& mdr, bool is_lookup); + void handle_client_lookup_ino(const MDRequestRef& mdr, bool want_parent, bool want_dentry); - void _lookup_snap_ino(MDRequestRef& mdr); - void _lookup_ino_2(MDRequestRef& mdr, int r); - void handle_client_readdir(MDRequestRef& mdr); - void handle_client_file_setlock(MDRequestRef& mdr); - void handle_client_file_readlock(MDRequestRef& mdr); + void _lookup_snap_ino(const MDRequestRef& mdr); + void _lookup_ino_2(const MDRequestRef& mdr, int r); + void handle_client_readdir(const MDRequestRef& mdr); + void handle_client_file_setlock(const MDRequestRef& mdr); + void handle_client_file_readlock(const MDRequestRef& mdr); - bool xlock_policylock(MDRequestRef& mdr, CInode *in, + bool xlock_policylock(const MDRequestRef& mdr, CInode *in, bool want_layout=false, bool xlock_snaplock=false); - CInode* try_get_auth_inode(MDRequestRef& mdr, inodeno_t ino); - void handle_client_setattr(MDRequestRef& mdr); - void handle_client_setlayout(MDRequestRef& mdr); - void handle_client_setdirlayout(MDRequestRef& mdr); + CInode* try_get_auth_inode(const MDRequestRef& mdr, inodeno_t ino); + void handle_client_setattr(const MDRequestRef& mdr); + void handle_client_setlayout(const MDRequestRef& mdr); + void handle_client_setdirlayout(const MDRequestRef& mdr); int parse_quota_vxattr(std::string name, std::string value, quota_info_t *quota); void create_quota_realm(CInode *in); @@ -226,100 +226,100 @@ public: file_layout_t *layout); int parse_layout_vxattr(std::string name, std::string value, const OSDMap& osdmap, file_layout_t *layout, bool validate=true); - int check_layout_vxattr(MDRequestRef& mdr, + int check_layout_vxattr(const MDRequestRef& mdr, std::string name, std::string value, file_layout_t *layout); - void handle_set_vxattr(MDRequestRef& mdr, CInode *cur); - void handle_remove_vxattr(MDRequestRef& mdr, CInode *cur); - void handle_client_getvxattr(MDRequestRef& mdr); - void handle_client_setxattr(MDRequestRef& mdr); - void handle_client_removexattr(MDRequestRef& mdr); + void handle_set_vxattr(const MDRequestRef& mdr, CInode *cur); + void handle_remove_vxattr(const MDRequestRef& mdr, CInode *cur); + void handle_client_getvxattr(const MDRequestRef& mdr); + void handle_client_setxattr(const MDRequestRef& mdr); + void handle_client_removexattr(const MDRequestRef& mdr); - void handle_client_fsync(MDRequestRef& mdr); + void handle_client_fsync(const MDRequestRef& mdr); // open - void handle_client_open(MDRequestRef& mdr); - void handle_client_openc(MDRequestRef& mdr); // O_CREAT variant. - void do_open_truncate(MDRequestRef& mdr, int cmode); // O_TRUNC variant. + void handle_client_open(const MDRequestRef& mdr); + void handle_client_openc(const MDRequestRef& mdr); // O_CREAT variant. + void do_open_truncate(const MDRequestRef& mdr, int cmode); // O_TRUNC variant. // namespace changes - void handle_client_mknod(MDRequestRef& mdr); - void handle_client_mkdir(MDRequestRef& mdr); - void handle_client_symlink(MDRequestRef& mdr); + void handle_client_mknod(const MDRequestRef& mdr); + void handle_client_mkdir(const MDRequestRef& mdr); + void handle_client_symlink(const MDRequestRef& mdr); // link - void handle_client_link(MDRequestRef& mdr); - void _link_local(MDRequestRef& mdr, CDentry *dn, CInode *targeti, SnapRealm *target_realm); - void _link_local_finish(MDRequestRef& mdr, CDentry *dn, CInode *targeti, + void handle_client_link(const MDRequestRef& mdr); + void _link_local(const MDRequestRef& mdr, CDentry *dn, CInode *targeti, SnapRealm *target_realm); + void _link_local_finish(const MDRequestRef& mdr, CDentry *dn, CInode *targeti, version_t, version_t, bool); - void _link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targeti); - void _link_remote_finish(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targeti, + void _link_remote(const MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targeti); + void _link_remote_finish(const MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targeti, version_t); - void handle_peer_link_prep(MDRequestRef& mdr); - void _logged_peer_link(MDRequestRef& mdr, CInode *targeti, bool adjust_realm); - void _commit_peer_link(MDRequestRef& mdr, int r, CInode *targeti); - void _committed_peer(MDRequestRef& mdr); // use for rename, too - void handle_peer_link_prep_ack(MDRequestRef& mdr, const cref_t &m); - void do_link_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr); - void _link_rollback_finish(MutationRef& mut, MDRequestRef& mdr, + void handle_peer_link_prep(const MDRequestRef& mdr); + void _logged_peer_link(const MDRequestRef& mdr, CInode *targeti, bool adjust_realm); + void _commit_peer_link(const MDRequestRef& mdr, int r, CInode *targeti); + void _committed_peer(const MDRequestRef& mdr); // use for rename, too + void handle_peer_link_prep_ack(const MDRequestRef& mdr, const cref_t &m); + void do_link_rollback(bufferlist &rbl, mds_rank_t leader, const MDRequestRef& mdr); + void _link_rollback_finish(MutationRef& mut, const MDRequestRef& mdr, std::map>& split); // unlink - void handle_client_unlink(MDRequestRef& mdr); - bool _dir_is_nonempty_unlocked(MDRequestRef& mdr, CInode *rmdiri); - bool _dir_is_nonempty(MDRequestRef& mdr, CInode *rmdiri); - void _unlink_local(MDRequestRef& mdr, CDentry *dn, CDentry *straydn); - void _unlink_local_finish(MDRequestRef& mdr, + void handle_client_unlink(const MDRequestRef& mdr); + bool _dir_is_nonempty_unlocked(const MDRequestRef& mdr, CInode *rmdiri); + bool _dir_is_nonempty(const MDRequestRef& mdr, CInode *rmdiri); + void _unlink_local(const MDRequestRef& mdr, CDentry *dn, CDentry *straydn); + void _unlink_local_finish(const MDRequestRef& mdr, CDentry *dn, CDentry *straydn, version_t); - bool _rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, std::vector& trace, CDentry *straydn); - void handle_peer_rmdir_prep(MDRequestRef& mdr); - void _logged_peer_rmdir(MDRequestRef& mdr, CDentry *srcdn, CDentry *straydn); - void _commit_peer_rmdir(MDRequestRef& mdr, int r, CDentry *straydn); - void handle_peer_rmdir_prep_ack(MDRequestRef& mdr, const cref_t &ack); - void do_rmdir_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr); - void _rmdir_rollback_finish(MDRequestRef& mdr, metareqid_t reqid, CDentry *dn, CDentry *straydn); + bool _rmdir_prepare_witness(const MDRequestRef& mdr, mds_rank_t who, std::vector& trace, CDentry *straydn); + void handle_peer_rmdir_prep(const MDRequestRef& mdr); + void _logged_peer_rmdir(const MDRequestRef& mdr, CDentry *srcdn, CDentry *straydn); + void _commit_peer_rmdir(const MDRequestRef& mdr, int r, CDentry *straydn); + void handle_peer_rmdir_prep_ack(const MDRequestRef& mdr, const cref_t &ack); + void do_rmdir_rollback(bufferlist &rbl, mds_rank_t leader, const MDRequestRef& mdr); + void _rmdir_rollback_finish(const MDRequestRef& mdr, metareqid_t reqid, CDentry *dn, CDentry *straydn); // rename - void handle_client_rename(MDRequestRef& mdr); - void _rename_finish(MDRequestRef& mdr, + void handle_client_rename(const MDRequestRef& mdr); + void _rename_finish(const MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn); - void handle_client_lssnap(MDRequestRef& mdr); - void handle_client_mksnap(MDRequestRef& mdr); - void _mksnap_finish(MDRequestRef& mdr, CInode *diri, SnapInfo &info); - void handle_client_rmsnap(MDRequestRef& mdr); - void _rmsnap_finish(MDRequestRef& mdr, CInode *diri, snapid_t snapid); - void handle_client_renamesnap(MDRequestRef& mdr); - void _renamesnap_finish(MDRequestRef& mdr, CInode *diri, snapid_t snapid); - void handle_client_readdir_snapdiff(MDRequestRef& mdr); + void handle_client_lssnap(const MDRequestRef& mdr); + void handle_client_mksnap(const MDRequestRef& mdr); + void _mksnap_finish(const MDRequestRef& mdr, CInode *diri, SnapInfo &info); + void handle_client_rmsnap(const MDRequestRef& mdr); + void _rmsnap_finish(const MDRequestRef& mdr, CInode *diri, snapid_t snapid); + void handle_client_renamesnap(const MDRequestRef& mdr); + void _renamesnap_finish(const MDRequestRef& mdr, CInode *diri, snapid_t snapid); + void handle_client_readdir_snapdiff(const MDRequestRef& mdr); // helpers - bool _rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, std::set &witnesse, + bool _rename_prepare_witness(const MDRequestRef& mdr, mds_rank_t who, std::set &witnesse, std::vector& srctrace, std::vector& dsttrace, CDentry *straydn); - version_t _rename_prepare_import(MDRequestRef& mdr, CDentry *srcdn, bufferlist *client_map_bl); + version_t _rename_prepare_import(const MDRequestRef& mdr, CDentry *srcdn, bufferlist *client_map_bl); bool _need_force_journal(CInode *diri, bool empty); - void _rename_prepare(MDRequestRef& mdr, + void _rename_prepare(const MDRequestRef& mdr, EMetaBlob *metablob, bufferlist *client_map_bl, CDentry *srcdn, CDentry *destdn, std::string_view alternate_name, CDentry *straydn); /* set not_journaling=true if you're going to discard the results -- * this bypasses the asserts to make sure we're journaling the right * things on the right nodes */ - void _rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn); + void _rename_apply(const MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn); // slaving - void handle_peer_rename_prep(MDRequestRef& mdr); - void handle_peer_rename_prep_ack(MDRequestRef& mdr, const cref_t &m); - void handle_peer_rename_notify_ack(MDRequestRef& mdr, const cref_t &m); - void _peer_rename_sessions_flushed(MDRequestRef& mdr); - void _logged_peer_rename(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn); - void _commit_peer_rename(MDRequestRef& mdr, int r, CDentry *srcdn, CDentry *destdn, CDentry *straydn); - void do_rename_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr, bool finish_mdr=false); - void _rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentry *srcdn, version_t srcdnpv, + void handle_peer_rename_prep(const MDRequestRef& mdr); + void handle_peer_rename_prep_ack(const MDRequestRef& mdr, const cref_t &m); + void handle_peer_rename_notify_ack(const MDRequestRef& mdr, const cref_t &m); + void _peer_rename_sessions_flushed(const MDRequestRef& mdr); + void _logged_peer_rename(const MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn); + void _commit_peer_rename(const MDRequestRef& mdr, int r, CDentry *srcdn, CDentry *destdn, CDentry *straydn); + void do_rename_rollback(bufferlist &rbl, mds_rank_t leader, const MDRequestRef& mdr, bool finish_mdr=false); + void _rename_rollback_finish(MutationRef& mut, const MDRequestRef& mdr, CDentry *srcdn, version_t srcdnpv, CDentry *destdn, CDentry *staydn, std::map> splits[2], bool finish_mdr); @@ -481,10 +481,10 @@ private: xattr_name == "ceph.mirror.dirty_snap_id"; } - void reply_client_request(MDRequestRef& mdr, const ref_t &reply); + void reply_client_request(const MDRequestRef& mdr, const ref_t &reply); void flush_session(Session *session, MDSGatherBuilder& gather); - void _finalize_readdir(MDRequestRef& mdr, + void _finalize_readdir(const MDRequestRef& mdr, CInode *diri, CDir* dir, bool start, @@ -495,7 +495,7 @@ private: bufferlist& dnbl); void _readdir_diff( utime_t now, - MDRequestRef& mdr, + const MDRequestRef& mdr, CInode* diri, CDir* dir, SnapRealm* realm, @@ -506,7 +506,7 @@ private: unsigned req_flags, bufferlist& dirbl); bool build_snap_diff( - MDRequestRef& mdr, + const MDRequestRef& mdr, CDir* dir, int bytes_left, dentry_key_t* skip_key, -- 2.39.5