]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ceph: use ceph_evict_inode to cleanup inode's resource
authorYan, Zheng <zyan@redhat.com>
Sun, 2 Jun 2019 01:45:38 +0000 (09:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:10:58 +0000 (09:10 +0200)
commit 87bc5b895d94a0f40fe170d4cf5771c8e8f85d15 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ceph/inode.c
fs/ceph/super.c
fs/ceph/super.h

index 761451f36e2df4a508974b80bdda1af216c1d00b..5b7d4881a4f88fcba53bda05d0cbad403d092305 100644 (file)
@@ -523,13 +523,16 @@ void ceph_free_inode(struct inode *inode)
        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);
 
index d57fa60dcd43603562d9a12a8c100b0f276fb6ba..74ca5970397f6225140b36375907704fdbf67ef2 100644 (file)
@@ -840,10 +840,10 @@ static int ceph_remount(struct super_block *sb, int *flags, char *data)
 
 static const struct super_operations ceph_super_ops = {
        .alloc_inode    = ceph_alloc_inode,
-       .destroy_inode  = ceph_destroy_inode,
        .free_inode     = ceph_free_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,
index 5f27e1f7f2d65a4bd40ffd203f1e58a4315438d7..048409fba1a84b918a38aadebd17374a76648c15 100644 (file)
@@ -876,7 +876,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_destroy_inode(struct inode *inode);
+extern void ceph_evict_inode(struct inode *inode);
 extern void ceph_free_inode(struct inode *inode);
 extern int ceph_drop_inode(struct inode *inode);