From 1f0641f6d45e8bbe2a93deaaa2c239658cd73cf8 Mon Sep 17 00:00:00 2001 From: Leonid Usov Date: Sun, 21 Apr 2024 22:14:06 +0300 Subject: [PATCH] squid: mds/cache: don't assume non-auth xlocks to be remote locks A few places in the code assumed that non-auth xlocks must be remote, which prevented a proper drop lock procedure when those locks turned out to be locallocks. Fixes: https://tracker.ceph.com/issues/65710 Original-Issue: https://tracker.ceph.com/issues/65606 Original-PR: https://github.com/ceph/ceph/pull/57020 Signed-off-by: Leonid Usov (cherry picked from commit 3aa055d89c6d72b614423b7d6945e2780e7db74d) --- src/mds/Locker.cc | 2 +- src/mds/MDCache.cc | 4 ++-- src/mds/Server.cc | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index cdb39e6081cb..94b200404fdc 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -711,7 +711,7 @@ void Locker::_drop_locks(MutationImpl *mut, set *pneed_issue, MDSCacheObject *obj = lock->get_parent(); if (it->is_xlock()) { - if (obj->is_auth()) { + if (obj->is_auth() || lock->is_locallock()) { bool ni = false; xlock_finish(it++, mut, &ni); if (ni) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 0226ce32f719..5b72fb65f39e 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -4172,7 +4172,7 @@ void MDCache::rejoin_send_rejoins() for (const auto& q : mdr->locks) { auto lock = q.lock; auto obj = lock->get_parent(); - if (q.is_xlock() && !obj->is_auth()) { + if (q.is_xlock() && !obj->is_auth() && !lock->is_locallock()) { mds_rank_t who = obj->authority().first; if (rejoins.count(who) == 0) continue; const auto& rejoin = rejoins[who]; @@ -9889,7 +9889,7 @@ void MDCache::request_drop_foreign_locks(const MDRequestRef& mdr) for (auto it = mdr->locks.begin(); it != mdr->locks.end(); ) { SimpleLock *lock = it->lock; - if (it->is_xlock() && !lock->get_parent()->is_auth()) { + if (!lock->is_locallock() && it->is_xlock() && !lock->get_parent()->is_auth()) { dout(10) << "request_drop_foreign_locks forgetting lock " << *lock << " on " << lock->get_parent() << dendl; lock->put_xlock(); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 0bb30664ac5f..366f0934d8c3 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -3048,6 +3048,9 @@ void Server::dispatch_peer_request(const MDRequestRef& mdr) SimpleLock *lock = mds->locker->get_lock(mdr->peer_request->get_lock_type(), mdr->peer_request->get_object_info()); + // we shouldn't be getting peer requests about local locks + ceph_assert(!lock->is_locallock()); + if (!lock) { dout(10) << "don't have object, dropping" << dendl; ceph_abort_msg("don't have object"); // can this happen, if we auth pinned properly. -- 2.47.3