From: "Yan, Zheng" Subject: [PATCH 4/6] mds: handle "state == LOCK_LOCK_XLOCK" when cancelling xlock Date: Wed, 17 Jul 2013 16:28:41 +0800 Message-ID: <1374049723-19274-5-git-send-email-zheng.z.yan@intel.com> References: <1374049723-19274-1-git-send-email-zheng.z.yan@intel.com> Return-path: Received: from mga14.intel.com ([143.182.124.37]:50906 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753090Ab3GQI2w (ORCPT ); Wed, 17 Jul 2013 04:28:52 -0400 In-Reply-To: <1374049723-19274-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org List-ID: To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, "Yan, Zheng" From: "Yan, Zheng" If we find lock state is LOCK_LOCK_XLOCK when cancelling xlock, set lock state to LOCK_XLOCK_DONE and call Locker::eval_gather(). This makes sure the lock will eventually transit to a stable state. (LOCK_XLOCK_DONE's next state is stable) Signed-off-by: Yan, Zheng --- src/mds/Locker.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index aaf6590..47ea6fc 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -544,8 +544,13 @@ void Locker::cancel_locking(Mutation *mut, set *pneed_issue) if (lock->get_parent()->is_auth()) { bool need_issue = false; - if (lock->get_state() == LOCK_PREXLOCK) + if (lock->get_state() == LOCK_PREXLOCK) { _finish_xlock(lock, &need_issue); + } else if (lock->get_state() == LOCK_LOCK_XLOCK && + lock->get_num_xlocks() == 0) { + lock->set_state(LOCK_XLOCKDONE); + eval_gather(lock, true, &need_issue); + } if (need_issue) pneed_issue->insert(static_cast(lock->get_parent())); } @@ -1509,8 +1514,11 @@ void Locker::xlock_finish(SimpleLock *lock, Mutation *mut, bool *pneed_issue) SimpleLock::WAIT_WR | SimpleLock::WAIT_RD, 0); } else { - if (lock->get_num_xlocks() == 0) + if (lock->get_num_xlocks() == 0) { + if (lock->get_state() == LOCK_LOCK_XLOCK) + lock->set_state(LOCK_XLOCKDONE); _finish_xlock(lock, &do_issue); + } } if (do_issue) { -- 1.8.1.4