From patchwork Fri Jan 4 09:01:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1931701 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id DEA5ADFABD for ; Fri, 4 Jan 2013 09:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752719Ab3ADJC3 (ORCPT ); Fri, 4 Jan 2013 04:02:29 -0500 Received: from mga01.intel.com ([192.55.52.88]:51114 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752091Ab3ADJC0 (ORCPT ); Fri, 4 Jan 2013 04:02:26 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 04 Jan 2013 01:02:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,409,1355126400"; d="scan'208";a="272789940" Received: from zyan5-mobl.sh.intel.com ([10.239.36.28]) by fmsmga002.fm.intel.com with ESMTP; 04 Jan 2013 01:02:24 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 01/29] mds: don't renew revoking lease Date: Fri, 4 Jan 2013 17:01:52 +0800 Message-Id: <1357290140-17044-2-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1357290140-17044-1-git-send-email-zheng.z.yan@intel.com> References: <1357290140-17044-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" MDS may receives lease renew request while lease is being revoked, just ignore the renew request. Signed-off-by: Yan, Zheng --- src/mds/Locker.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) 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;