]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: wake up lock waiters after forcibly changing lock state 30508/head
authorYan, Zheng <zyan@redhat.com>
Sun, 9 Jun 2019 03:27:28 +0000 (11:27 +0800)
committerYan, Zheng <zyan@redhat.com>
Sun, 22 Sep 2019 07:14:23 +0000 (15:14 +0800)
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)

src/mds/MDCache.cc

index 886b0eef1a391d42bdea70ec80969fdb7c0fbe57..5f4411d9c1c6a75665fc4919ecd77d88c8a93a91 100644 (file)
@@ -1487,6 +1487,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();
+
+      MDSContext::vec finished;
       for (const auto &p : client_snap_caps) {
        SimpleLock *lock = in->get_lock(p.first);
        ceph_assert(lock);
@@ -1495,10 +1497,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;
   }