From patchwork Mon Aug 5 06:10:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2838528 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4BAF29F479 for ; Mon, 5 Aug 2013 06:10:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50F782017D for ; Mon, 5 Aug 2013 06:10:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 498CA20124 for ; Mon, 5 Aug 2013 06:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754318Ab3HEGKg (ORCPT ); Mon, 5 Aug 2013 02:10:36 -0400 Received: from mga03.intel.com ([143.182.124.21]:33765 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753695Ab3HEGKe (ORCPT ); Mon, 5 Aug 2013 02:10:34 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 04 Aug 2013 23:10:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,816,1367996400"; d="scan'208";a="341696491" Received: from zyan5-mobl.sh.intel.com ([10.239.13.8]) by azsmga001.ch.intel.com with ESMTP; 04 Aug 2013 23:10:33 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, "Yan, Zheng" Subject: [PATCH 1/6] mds: fix cap revoke confirmation Date: Mon, 5 Aug 2013 14:10:22 +0800 Message-Id: <1375683030-28305-2-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1375683030-28305-1-git-send-email-zheng.z.yan@intel.com> References: <1375683030-28305-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 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Yan, Zheng" There are several issues in the Capability::confirm_receipt() 1. when receiving a client caps message with 'seq == last_sent', it doesn't mean we finish revoking caps. The client can send caps message that only flushes dirty metadata. 2. When receiving a client caps message with 'seq == N', we should forget pending revocations whose seq numbers are less than N. This is because, when revoking caps, we create a revoke_info structure and set its seq number to 'last_sent', then increase the 'last_sent'. 3. When client actively releases caps (by request), the code only works for the 'seq == last_sent' case. If there are pending revocations, we should update them as if the release message is received before we revoke the corresponding caps. Signed-off-by: Yan, Zheng --- src/mds/Capability.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mds/Capability.h b/src/mds/Capability.h index fdecb90..fb6b3dc 100644 --- a/src/mds/Capability.h +++ b/src/mds/Capability.h @@ -171,14 +171,16 @@ public: } void confirm_receipt(ceph_seq_t seq, unsigned caps) { if (seq == last_sent) { - _pending = caps; _revokes.clear(); _issued = caps; + // don't add bits + _pending &= caps; } else { // can i forget any revocations? - while (!_revokes.empty() && - _revokes.front().seq <= seq) + while (!_revokes.empty() && _revokes.front().seq < seq) _revokes.pop_front(); + if (!_revokes.empty() && _revokes.front().seq == seq) + _revokes.begin()->before = caps; _calc_issued(); } //check_rdcaps_list();