From patchwork Fri Mar 2 07:38:17 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: 10253559 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 2B6BA6037F for ; Fri, 2 Mar 2018 07:48:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DCA12882E for ; Fri, 2 Mar 2018 07:48:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02A69288BC; Fri, 2 Mar 2018 07:48:29 +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 52AE02882E for ; Fri, 2 Mar 2018 07:48:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034260AbeCBHs1 (ORCPT ); Fri, 2 Mar 2018 02:48:27 -0500 Received: from mtabjsc2.360.cn ([123.125.82.7]:58770 "EHLO mtabjsc2.360.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034243AbeCBHs0 (ORCPT ); Fri, 2 Mar 2018 02:48:26 -0500 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 F24696B2130 for ; Fri, 2 Mar 2018 15:38:18 +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:38:17 +0800 From: =?gb2312?B?s8LT8cX0?= To: "'ceph-devel@vger.kernel.org'" 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+SPu+cDdVIYvT1KlXg0+GN1VYQ== Date: Fri, 2 Mar 2018 07:38:17 +0000 Message-ID: <43180B106D8B514FB730205E2D1199E40399EC68@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; }