From: Yan, Zheng Date: Sun, 9 Jun 2019 03:27:28 +0000 (+0800) Subject: mds: wake up lock waiters after forcibly changing lock state X-Git-Tag: v15.1.0~2332^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0a1e92abf1cfc8bddf526cbf5bceea7b854dcfe8;p=ceph.git mds: wake up lock waiters after forcibly changing lock state 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" --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 5d0014db9ca4..0c43dbd84d99 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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; }