From patchwork Fri Mar 2 07:40:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6ZmI546J6bmP?= X-Patchwork-Id: 10253553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7E7166037D for ; Fri, 2 Mar 2018 07:44:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BF81287DE for ; Fri, 2 Mar 2018 07:44:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D3CC288A3; Fri, 2 Mar 2018 07:44:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B2F328881 for ; Fri, 2 Mar 2018 07:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034271AbeCBHoS (ORCPT ); Fri, 2 Mar 2018 02:44:18 -0500 Received: from mtabjsc2.360.cn ([123.125.82.7]:34350 "EHLO mtabjsc2.360.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034253AbeCBHoR (ORCPT ); Fri, 2 Mar 2018 02:44:17 -0500 X-Greylist: delayed 353 seconds by postgrey-1.27 at vger.kernel.org; Fri, 02 Mar 2018 02:44:16 EST Received: from CAS2.corp.qihoo.net (unknown [220.181.158.202]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mtabjsc2.360.cn (QHMAIL) with ESMTP id 1EF76AB8299; Fri, 2 Mar 2018 15:40:51 +0800 (CST) Received: from EX02.corp.qihoo.net ([fe80::7882:7b3d:59d6:3fc7]) by CAS2.corp.qihoo.net ([220.181.158.130]) with mapi id 14.03.0319.002; Fri, 2 Mar 2018 15:40:49 +0800 From: =?gb2312?B?s8LT8cX0?= To: "'ceph-devel@vger.kernel.org'" CC: "bel5f5@gmail.com" Subject: [PATCH] Ceph: Make sure stale dentries should be unhashed successfully in time. Thread-Topic: [PATCH] Ceph: Make sure stale dentries should be unhashed successfully in time. Thread-Index: AdOx+cdIRVVwaBZzR6GzsHsNphXN/A== Date: Fri, 2 Mar 2018 07:40:49 +0000 Message-ID: <43180B106D8B514FB730205E2D1199E40399EE7C@EX02.corp.qihoo.net> Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.18.240.33] MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prior to kernel v3.19, d_invalidate() might not unhash stale dentries due to reference count, so the stale dentries are left in the memory, causing a delayed expiration. Fixes: http://tracker.ceph.com/issues/23097 Signed-off-by: Yupeng Chen --- fs/ceph/inode.c | 4 ++++ 1 file changed, 4 insertions(+) -- 1.8.3.1 diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index c6ec5aa..70a38f2 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1345,6 +1345,10 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req) dn, d_inode(dn), ceph_vinop(d_inode(dn)), ceph_vinop(in)); d_invalidate(dn); + /* Prito to v3.19,d_invalidate might unhash the dentry unsuccessfully.*/ + if (!d_unhashed(dn)) { + d_drop(dn); + } have_lease = false; }