Commit 81281039 authored by Yan, Zheng's avatar Yan, Zheng Committed by Greg Kroah-Hartman

ceph: use ceph_evict_inode to cleanup inode's resource

[ Upstream commit 87bc5b89 ]

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().

Cc: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/40102Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 42fa0e35
...@@ -528,13 +528,16 @@ static void ceph_i_callback(struct rcu_head *head) ...@@ -528,13 +528,16 @@ static void ceph_i_callback(struct rcu_head *head)
kmem_cache_free(ceph_inode_cachep, ci); 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_info *ci = ceph_inode(inode);
struct ceph_inode_frag *frag; struct ceph_inode_frag *frag;
struct rb_node *n; 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); ceph_fscache_unregister_inode_cookie(ci);
......
...@@ -827,9 +827,9 @@ static int ceph_remount(struct super_block *sb, int *flags, char *data) ...@@ -827,9 +827,9 @@ static int ceph_remount(struct super_block *sb, int *flags, char *data)
static const struct super_operations ceph_super_ops = { static const struct super_operations ceph_super_ops = {
.alloc_inode = ceph_alloc_inode, .alloc_inode = ceph_alloc_inode,
.destroy_inode = ceph_destroy_inode,
.write_inode = ceph_write_inode, .write_inode = ceph_write_inode,
.drop_inode = ceph_drop_inode, .drop_inode = ceph_drop_inode,
.evict_inode = ceph_evict_inode,
.sync_fs = ceph_sync_fs, .sync_fs = ceph_sync_fs,
.put_super = ceph_put_super, .put_super = ceph_put_super,
.remount_fs = ceph_remount, .remount_fs = ceph_remount,
......
...@@ -854,7 +854,7 @@ static inline bool __ceph_have_pending_cap_snap(struct ceph_inode_info *ci) ...@@ -854,7 +854,7 @@ static inline bool __ceph_have_pending_cap_snap(struct ceph_inode_info *ci)
extern const struct inode_operations ceph_file_iops; extern const struct inode_operations ceph_file_iops;
extern struct inode *ceph_alloc_inode(struct super_block *sb); extern struct inode *ceph_alloc_inode(struct super_block *sb);
extern void ceph_destroy_inode(struct inode *inode); extern void ceph_evict_inode(struct inode *inode);
extern int ceph_drop_inode(struct inode *inode); extern int ceph_drop_inode(struct inode *inode);
extern struct inode *ceph_get_inode(struct super_block *sb, extern struct inode *ceph_get_inode(struct super_block *sb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment