All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zheng.z.yan@intel.com>
To: ceph-devel@vger.kernel.org
Cc: sage@inktank.com, "Yan, Zheng" <zheng.z.yan@intel.com>
Subject: [PATCH 4/6] mds: handle "state == LOCK_LOCK_XLOCK" when cancelling xlock
Date: Wed, 17 Jul 2013 16:28:41 +0800	[thread overview]
Message-ID: <1374049723-19274-5-git-send-email-zheng.z.yan@intel.com> (raw)
In-Reply-To: <1374049723-19274-1-git-send-email-zheng.z.yan@intel.com>

From: "Yan, Zheng" <zheng.z.yan@intel.com>

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 <zheng.z.yan@intel.com>
---
 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<CInode*> *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<CInode *>(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


  parent reply	other threads:[~2013-07-17  8:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-17  8:28 [PATCH 0/6] misc fixes for mds Yan, Zheng
2013-07-17  8:28 ` [PATCH 1/6] mds: fix cap revoke confirmation Yan, Zheng
2013-07-17  8:28 ` [PATCH 2/6] mds: revoke GSHARED cap when finishing xlock Yan, Zheng
2013-07-17  8:28 ` [PATCH 3/6] mds: remove "type != CEPH_LOCK_DN" check in Locker::cancel_locking() Yan, Zheng
2013-07-17  8:28 ` Yan, Zheng [this message]
2013-07-17  8:28 ` [PATCH 5/6] mds: wake xlock waiter when xlock is done Yan, Zheng
2013-07-17  8:28 ` [PATCH 6/6] mds: change LOCK_SCAN to unstable state Yan, Zheng
2013-07-23  5:34 ` [PATCH 0/6] misc fixes for mds Yan, Zheng
2013-08-05  6:10 Yan, Zheng
2013-08-05  6:10 ` [PATCH 4/6] mds: handle "state == LOCK_LOCK_XLOCK" when cancelling xlock Yan, Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374049723-19274-5-git-send-email-zheng.z.yan@intel.com \
    --to=zheng.z.yan@intel.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.