]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: wake up lock waiters after forcibly changing lock state 28459/head
authorYan, Zheng <zyan@redhat.com>
Sun, 9 Jun 2019 03:27:28 +0000 (11:27 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 20 Jun 2019 12:53:46 +0000 (20:53 +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>
src/mds/MDCache.cc

index 5d0014db9ca4ff909593078ceb673e9cbeddccb9..0c43dbd84d99b96b653fa25905c3ce2bd010699d 100644 (file)
@@ -1484,6 +1484,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);
@@ -1492,10 +1494,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;
   }