]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: wake up lock waiters after forcibly changing lock state 30234/head
authorYan, Zheng <zyan@redhat.com>
Sun, 9 Jun 2019 03:27:28 +0000 (11:27 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 1 Oct 2019 14:20:16 +0000 (16:20 +0200)
commit df79944a "mds: cleanup unneeded client_snap_caps when
splitting snap inode" is incomplete.

Fixes: http://tracker.ceph.com/issues/39987
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 0a1e92abf1cfc8bddf526cbf5bceea7b854dcfe8)

Conflicts:
    src/mds/MDCache.cc
- in mimic, "error: 'vec' is not a member of 'MDSContext'"
  addressed by declaring finished as list<MDSInternalContextBase*> instead of
  MDSContext::vec

src/mds/MDCache.cc

index 49c59e0bf7761576ff32ee56aec28ad5189183e2..c88c5cafbd6480020dee658f2a5cf3bdaa810bb0 100644 (file)
@@ -1585,6 +1585,8 @@ CInode *MDCache::cow_inode(CInode *in, snapid_t last)
       in->client_snap_caps.clear();
       in->item_open_file.remove_myself();
       in->item_caps.remove_myself();
+
+      list<MDSInternalContextBase*> finished;
       for (const auto &p : client_snap_caps) {
        SimpleLock *lock = in->get_lock(p.first);
        ceph_assert(lock);
@@ -1593,10 +1595,13 @@ CInode *MDCache::cow_inode(CInode *in, snapid_t last)
          lock->put_wrlock();
          (void)q; /* unused */
        }
-       ceph_assert(!lock->get_num_wrlocks());
-       lock->set_state(LOCK_SYNC);
-       in->auth_unpin(lock);
+       if (!lock->get_num_wrlocks()) {
+         lock->set_state(LOCK_SYNC);
+         lock->take_waiting(SimpleLock::WAIT_STABLE|SimpleLock::WAIT_RD, finished);
+         in->auth_unpin(lock);
+       }
       }
+      mds->queue_waiters(finished);
     }
     return oldin;
   }