From patchwork Sun Jul 21 02:21:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2830873 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 7181E9F9A0 for ; Sun, 21 Jul 2013 02:21:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D5A220161 for ; Sun, 21 Jul 2013 02:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5395020154 for ; Sun, 21 Jul 2013 02:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755221Ab3GUCVi (ORCPT ); Sat, 20 Jul 2013 22:21:38 -0400 Received: from mga11.intel.com ([192.55.52.93]:36648 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754220Ab3GUCV1 (ORCPT ); Sat, 20 Jul 2013 22:21:27 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 20 Jul 2013 19:21:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,710,1367996400"; d="scan'208";a="373567029" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.20.141]) by fmsmga002.fm.intel.com with ESMTP; 20 Jul 2013 19:21:24 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, "Yan, Zheng" Subject: [PATCH 1/2] mds: notify clients about deleted inode Date: Sun, 21 Jul 2013 10:21:13 +0800 Message-Id: <1374373274-3457-2-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1374373274-3457-1-git-send-email-zheng.z.yan@intel.com> References: <1374373274-3457-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=-7.3 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" To make sure clients trim the deleted inode from the their cache ASAP. After all clients release the inode, we can reclaim space. Signed-off-by: Yan, Zheng --- src/mds/Locker.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 30e014a..7bbb749 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -1776,6 +1776,10 @@ bool Locker::issue_caps(CInode *in, Capability *only_cap) continue; } + // notify clients about deleted inode, to make sure they release caps ASAP. + if (in->inode.nlink == 0) + wanted |= CEPH_CAP_LINK_SHARED; + // are there caps that the client _wants_ and can have, but aren't pending? // or do we need to revoke? if (((wanted & allowed) & ~pending) || // missing wanted+allowed caps