From d86a5c2ab76b740da235aeb1f5a994a84bb3515f Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Sat, 2 Mar 2024 22:22:19 -0500 Subject: [PATCH] mds: print lock cache during invalidation Signed-off-by: Patrick Donnelly --- src/mds/Locker.cc | 4 ++++ src/mds/Mutation.cc | 15 +++++++++++++++ src/mds/Mutation.h | 1 + 3 files changed, 20 insertions(+) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 16e138edded28..19ead4c4647d6 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -895,6 +895,8 @@ public: void Locker::put_lock_cache(MDLockCache* lock_cache) { + dout(20) << __func__ << ": " << *lock_cache << dendl; + ceph_assert(lock_cache->ref > 0); if (--lock_cache->ref > 0) return; @@ -928,6 +930,8 @@ int Locker::get_cap_bit_for_lock_cache(int op) void Locker::invalidate_lock_cache(MDLockCache *lock_cache) { + dout(15) << __func__ << ": " << *lock_cache << dendl; + ceph_assert(lock_cache->item_cap_lock_cache.is_on_list()); if (lock_cache->invalidating) { ceph_assert(!lock_cache->client_cap); diff --git a/src/mds/Mutation.cc b/src/mds/Mutation.cc index ecc455de08db6..6ff87183914b8 100644 --- a/src/mds/Mutation.cc +++ b/src/mds/Mutation.cc @@ -624,3 +624,18 @@ void MDLockCache::detach_dirfrags() } items_dir.reset(); } + +void MDLockCache::print(std::ostream& out) const { + out << "MDLockCache(o=" << ceph_mds_op_name(opcode) + << " diri=" << diri->ino(); + if (client_cap) { + out << " c=" << client_cap->get_client(); + } else { + out << " c=(nil)"; + } + out << " r=" << ref; + if (invalidating) { + out << " invalidating"; + } + out << ")"; +} diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h index 6a11144362ec2..7f985651e37d9 100644 --- a/src/mds/Mutation.h +++ b/src/mds/Mutation.h @@ -538,6 +538,7 @@ struct MDLockCache : public MutationImpl { return dir_layout; } + void print(std::ostream& out) const; void attach_locks(); void attach_dirfrags(std::vector&& dfv); void detach_locks(); -- 2.39.5