aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2019-06-01 21:45:38 -0400
committerIlya Dryomov <idryomov@gmail.com>2019-07-08 08:01:45 -0400
commit87bc5b895d94a0f40fe170d4cf5771c8e8f85d15 (patch)
treeaf317e037b3f4e23b24d483f4f6db617cf3e905b
parent0f7cf80ae96c2a585a00b2cd8b6d24699db47f35 (diff)
ceph: use ceph_evict_inode to cleanup inode's resource
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/40102 Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--fs/ceph/inode.c7
-rw-r--r--fs/ceph/super.c2
-rw-r--r--fs/ceph/super.h2
3 files changed, 7 insertions, 4 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 2c49eb831c6f..a565ab124282 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -526,13 +526,16 @@ void ceph_free_inode(struct inode *inode)
526 kmem_cache_free(ceph_inode_cachep, ci); 526 kmem_cache_free(ceph_inode_cachep, ci);
527} 527}
528 528
529void ceph_destroy_inode(struct inode *inode) 529void ceph_evict_inode(struct inode *inode)
530{ 530{
531 struct ceph_inode_info *ci = ceph_inode(inode); 531 struct ceph_inode_info *ci = ceph_inode(inode);
532 struct ceph_inode_frag *frag; 532 struct ceph_inode_frag *frag;
533 struct rb_node *n; 533 struct rb_node *n;
534 534
535 dout("destroy_inode %p ino %llx.%llx\n", inode, ceph_vinop(inode)); 535 dout("evict_inode %p ino %llx.%llx\n", inode, ceph_vinop(inode));
536
537 truncate_inode_pages_final(&inode->i_data);
538 clear_inode(inode);
536 539
537 ceph_fscache_unregister_inode_cookie(ci); 540 ceph_fscache_unregister_inode_cookie(ci);
538 541
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index c21201a951ce..5f0c950ca966 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -840,10 +840,10 @@ static int ceph_remount(struct super_block *sb, int *flags, char *data)
840 840
841static const struct super_operations ceph_super_ops = { 841static const struct super_operations ceph_super_ops = {
842 .alloc_inode = ceph_alloc_inode, 842 .alloc_inode = ceph_alloc_inode,
843 .destroy_inode = ceph_destroy_inode,
844 .free_inode = ceph_free_inode, 843 .free_inode = ceph_free_inode,
845 .write_inode = ceph_write_inode, 844 .write_inode = ceph_write_inode,
846 .drop_inode = ceph_drop_inode, 845 .drop_inode = ceph_drop_inode,
846 .evict_inode = ceph_evict_inode,
847 .sync_fs = ceph_sync_fs, 847 .sync_fs = ceph_sync_fs,
848 .put_super = ceph_put_super, 848 .put_super = ceph_put_super,
849 .remount_fs = ceph_remount, 849 .remount_fs = ceph_remount,
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index a592d4a8266c..30e9a4e415cc 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -884,7 +884,7 @@ static inline bool __ceph_have_pending_cap_snap(struct ceph_inode_info *ci)
884extern const struct inode_operations ceph_file_iops; 884extern const struct inode_operations ceph_file_iops;
885 885
886extern struct inode *ceph_alloc_inode(struct super_block *sb); 886extern struct inode *ceph_alloc_inode(struct super_block *sb);
887extern void ceph_destroy_inode(struct inode *inode); 887extern void ceph_evict_inode(struct inode *inode);
888extern void ceph_free_inode(struct inode *inode); 888extern void ceph_free_inode(struct inode *inode);
889extern int ceph_drop_inode(struct inode *inode); 889extern int ceph_drop_inode(struct inode *inode);
890 890