Skip to contentSkip to conversation

ceph: use ceph_evict_inode to cleanup inode's resource

PATCH In review Yan, Zheng 2 participants 2 messages Jun 2, 2019 Ceph client

lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/1 ceph: use ceph_evict_inode to cleanup inode's resource

remove_session_caps() relies on __wait_on_freeing_inode(), to wait for freezing inode to remove its caps. But VFS wakes freeing inode waiters before calling destroy_inode().

---
 fs/ceph/inode.c | 25 ++++++++++++++-----------
 fs/ceph/super.c |  1 +
 fs/ceph/super.h |  1 +
 3 files changed, 16 insertions(+), 11 deletions(-)
fs/ceph/inode.c +14 -11
index 125ac54b5841..9e481b41d5bc 100644
@@ -515,22 +515,13 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
 	return &ci->vfs_inode;
 }
 
-static void ceph_i_callback(struct rcu_head *head)
-{
-	struct inode *inode = container_of(head, struct inode, i_rcu);
-	struct ceph_inode_info *ci = ceph_inode(inode);
-
-	kfree(ci->i_symlink);
-	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));
 
 	ceph_fscache_unregister_inode_cookie(ci);
 
@@ -577,7 +568,19 @@ 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));
+}
 
+static void ceph_i_callback(struct rcu_head *head)
+{
+	struct inode *inode = container_of(head, struct inode, i_rcu);
+	struct ceph_inode_info *ci = ceph_inode(inode);
+
+	kfree(ci->i_symlink);
+	kmem_cache_free(ceph_inode_cachep, ci);
+}
+
+void ceph_destroy_inode(struct inode *inode)
+{
 	call_rcu(&inode->i_rcu, ceph_i_callback);
 }
 
fs/ceph/super.c +1 -0
index b1ee41372e85..67eb9d592ab7 100644
@@ -842,6 +842,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,
fs/ceph/super.h +1 -0
index 9c82d213a5ab..98d2bafc2ee2 100644
@@ -882,6 +882,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);
 
Signature · 1 line
2.17.2
#1 lore raw
Quoted 3 lines · Zheng

remove_session_caps() relies on __wait_on_freeing_inode(), to wait for freezing inode to remove its caps. But VFS wakes freeing inode waiters before calling destroy_inode().

*blink*

Which tree is that against?

fs/ceph/inode.c struct inode *ceph_alloc_inode(struct super_block *sb) · line 525

Quoted 8 lines
fs/ceph/inode.c +0 -8
-static void ceph_i_callback(struct rcu_head *head)
-{
-	struct inode *inode = container_of(head, struct inode, i_rcu);
-	struct ceph_inode_info *ci = ceph_inode(inode);
-
-	kfree(ci->i_symlink);
-	kmem_cache_free(ceph_inode_cachep, ci);
-}

... is gone from mainline, and AFAICS not reintroduced in ceph tree. What am I missing here?