diff mbox

[01/29] mds: don't renew revoking lease

Message ID 1357290140-17044-2-git-send-email-zheng.z.yan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng Jan. 4, 2013, 9:01 a.m. UTC
From: "Yan, Zheng" <zheng.z.yan@intel.com>

MDS may receives lease renew request while lease is being revoked,
just ignore the renew request.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
 src/mds/Locker.cc | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index 76708ec..c8cd236 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -2914,18 +2914,20 @@  void Locker::handle_client_lease(MClientLease *m)
 
   case CEPH_MDS_LEASE_RENEW:
     {
-      dout(7) << "handle_client_lease client." << client
-	      << " renew on " << *dn << dendl;
-      int pool = 1;   // fixme.. do something smart!
-      m->h.duration_ms = (int)(1000 * mdcache->client_lease_durations[pool]);
-      m->h.seq = ++l->seq;
-      m->clear_payload();
-      
-      utime_t now = ceph_clock_now(g_ceph_context);
-      now += mdcache->client_lease_durations[pool];
-      mdcache->touch_client_lease(l, pool, now);
-      
-      mds->send_message_client_counted(m, m->get_connection());
+      dout(7) << "handle_client_lease client." << client << " renew on " << *dn
+	      << (!dn->lock.can_lease(client)?", revoking lease":"") << dendl;
+      if (dn->lock.can_lease(client)) {
+	int pool = 1;   // fixme.. do something smart!
+	m->h.duration_ms = (int)(1000 * mdcache->client_lease_durations[pool]);
+	m->h.seq = ++l->seq;
+	m->clear_payload();
+
+	utime_t now = ceph_clock_now(g_ceph_context);
+	now += mdcache->client_lease_durations[pool];
+	mdcache->touch_client_lease(l, pool, now);
+
+	mds->send_message_client_counted(m, m->get_connection());
+      }
     }
     break;