]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/cache: don't assume non-auth xlocks to be remote locks 57020/head
authorLeonid Usov <leonid.usov@ibm.com>
Sun, 21 Apr 2024 19:14:06 +0000 (22:14 +0300)
committerLeonid Usov <leonid.usov@ibm.com>
Mon, 22 Apr 2024 15:45:07 +0000 (18:45 +0300)
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/65606
Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
src/mds/Locker.cc
src/mds/MDCache.cc
src/mds/Server.cc

index ad8f7df0f07bcf0be07cfcc42e5345e2ff3a18d2..294683c0717fcff87411a94cf1e1f68a97a40af0 100644 (file)
@@ -711,7 +711,7 @@ void Locker::_drop_locks(MutationImpl *mut, set<CInode*> *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)
index f65f81d217e1d6ded054589f803d66edf6d4e11e..43394e8cd0e958f9d1875c048b026a44d7f6930c 100644 (file)
@@ -4173,7 +4173,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];
@@ -9890,7 +9890,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();
index 0bb30664ac5f669847d4f8cc587604a13d8dfe2e..366f0934d8c34e39d60b23c6e83ec946390cb549 100644 (file)
@@ -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.