Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp9880ybp; Thu, 3 Oct 2019 09:27:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsh7gYUaVI93LX8THOuffJleRxaMEYgsqy6fzZOyvxLDls/eUah0Q+LW9DRD6OMGC6i35v X-Received: by 2002:a17:906:9604:: with SMTP id s4mr8633578ejx.38.1570120048063; Thu, 03 Oct 2019 09:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120048; cv=none; d=google.com; s=arc-20160816; b=seDxaTlstK7kPmbdwaImQBg7vNqd7IMg8sHOujY3LpQUNID5kdZvnrZbTyCCDbf+5P dhnVE7inxgmg+d41Ayjx+IpDbMKglg2/X58X0lQQOhUP78a85OUQEv1d+rv4HiBwPQuN GyCCoqTm04kowXyizZrVD7i9IKSeTBfERixbkmpVKnDl+r37342EdWOqqGKSVQVHW+oF GWQOrWB0ePNvqUiPHxrMWeS6bOJUco/c+V0w8lUYptSmFNljNDzlOZPj+vhqo3GVBwfy e/tpSSmm9N/TPCAHAHPVfucUUwxoNJxNDMawHW8Uo0/Latm6ZgC80AlSEqdXEJ88NZNI 9ypQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nWOT24jo2YGLgQP/Ak+1QBL8TG1GvNUxG5ySFCBMYY4=; b=wJliGPAYbT2Cz7y6BadogihRb/5PB33o8OXE/v9LllPO9+SvuMaY6Q84Ev1U5mO18O Q3RGI5r1Cy7bfg50ObHqBRMgqnYyh8Mzo2BS7K3MK+O1RiXRGrx8ms/07swBx8xvoP3+ 9GPu4z3i/P8YOeiDuemlTkkwoXsyqnT+LFsyYUeEUzCE5sDyFQeye22t+A/No9NkgfDn 0gRG+1imz25D2Ft95RwfD//4tiAwfgOLvXYNPH1ur2W6AZmlJGQQzi4ojdmGN1lnHtrR jbN3X1aJNYm7QoRW2GS/MOYRjka77Tv4UdHs6rwFlwSQ0dm4GCWIktuAdPcsXSK+JbBR T4sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uCR4FtDG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o27si1447733ejr.304.2019.10.03.09.27.03; Thu, 03 Oct 2019 09:27:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uCR4FtDG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733078AbfJCQXR (ORCPT + 99 others); Thu, 3 Oct 2019 12:23:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:52128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389206AbfJCQXO (ORCPT ); Thu, 3 Oct 2019 12:23:14 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8D346215EA; Thu, 3 Oct 2019 16:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119794; bh=WmrOGuY5GMN6eKGQLwtMcAe+ftTx4I0a4povACCJ4Uc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uCR4FtDGbiCWYljZ5o5PC/CLYHMwIU0GlclKSFLxl+fBbPjQ9Jtrg19Uu2VzywMRn D07tIBUafwS0IMiu9+kaIURU71Zu4hfjMlMJdqqSfPS1wsFBq4MCs81pKgjNPDD8CO 5n+aX6F13hVYwcVJL66k8GK1u3hPAiNCoLiA4DfE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Yan, Zheng" , Jeff Layton , Ilya Dryomov , Sasha Levin Subject: [PATCH 4.19 158/211] ceph: use ceph_evict_inode to cleanup inodes resource Date: Thu, 3 Oct 2019 17:53:44 +0200 Message-Id: <20191003154524.124604407@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154447.010950442@linuxfoundation.org> References: <20191003154447.010950442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yan, Zheng [ Upstream commit 87bc5b895d94a0f40fe170d4cf5771c8e8f85d15 ] remove_session_caps() relies on __wait_on_freeing_inode(), to wait for freeing inode to remove its caps. But VFS wakes freeing inode waiters before calling destroy_inode(). [ jlayton: mainline moved to ->free_inode before the original patch was merged. This backport reinstates ceph_destroy_inode and just has it do the call_rcu call. ] Cc: stable@vger.kernel.org Link: https://tracker.ceph.com/issues/40102 Signed-off-by: "Yan, Zheng" Reviewed-by: Jeff Layton Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin --- fs/ceph/inode.c | 10 ++++++++-- fs/ceph/super.c | 1 + fs/ceph/super.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 11f19432a74c4..c06845237cbaa 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -528,13 +528,16 @@ static void ceph_i_callback(struct rcu_head *head) kmem_cache_free(ceph_inode_cachep, ci); } -void ceph_destroy_inode(struct inode *inode) +void ceph_evict_inode(struct inode *inode) { struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_frag *frag; struct rb_node *n; - dout("destroy_inode %p ino %llx.%llx\n", inode, ceph_vinop(inode)); + dout("evict_inode %p ino %llx.%llx\n", inode, ceph_vinop(inode)); + + truncate_inode_pages_final(&inode->i_data); + clear_inode(inode); ceph_fscache_unregister_inode_cookie(ci); @@ -576,7 +579,10 @@ void ceph_destroy_inode(struct inode *inode) ceph_buffer_put(ci->i_xattrs.prealloc_blob); ceph_put_string(rcu_dereference_raw(ci->i_layout.pool_ns)); +} +void ceph_destroy_inode(struct inode *inode) +{ call_rcu(&inode->i_rcu, ceph_i_callback); } diff --git a/fs/ceph/super.c b/fs/ceph/super.c index c5cf46e43f2e7..ccab249a37f6a 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -830,6 +830,7 @@ static const struct super_operations ceph_super_ops = { .destroy_inode = ceph_destroy_inode, .write_inode = ceph_write_inode, .drop_inode = ceph_drop_inode, + .evict_inode = ceph_evict_inode, .sync_fs = ceph_sync_fs, .put_super = ceph_put_super, .remount_fs = ceph_remount, diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 0180193097905..8d3eabf06d66a 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -854,6 +854,7 @@ static inline bool __ceph_have_pending_cap_snap(struct ceph_inode_info *ci) extern const struct inode_operations ceph_file_iops; extern struct inode *ceph_alloc_inode(struct super_block *sb); +extern void ceph_evict_inode(struct inode *inode); extern void ceph_destroy_inode(struct inode *inode); extern int ceph_drop_inode(struct inode *inode); -- 2.20.1