]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
fuse: switch to ->free_inode()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 15 Apr 2019 23:37:09 +0000 (19:37 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 2 May 2019 02:43:26 +0000 (22:43 -0400)
fuse_destroy_inode() is gone - sanity checks that need the stack
trace of the caller get moved into ->evict_inode(), the rest joins
the RCU-delayed part which becomes ->free_inode().

While we are at it, don't just pass the address of what happens
to be the first member of structure to kmem_cache_free() -
get_fuse_inode() is there for purpose and it gives the proper
container_of() use.  No behaviour change, but verifying correctness
is easier that way.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/fuse/inode.c

index ec5d9953dfb6413fe5f8d507c58e965911a2a4c3..f485d09d14df7c8ebb2aa7c6f90612050fee7ec4 100644 (file)
@@ -107,34 +107,30 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
        return inode;
 }
 
-static void fuse_i_callback(struct rcu_head *head)
-{
-       struct inode *inode = container_of(head, struct inode, i_rcu);
-       kmem_cache_free(fuse_inode_cachep, inode);
-}
-
-static void fuse_destroy_inode(struct inode *inode)
+static void fuse_free_inode(struct inode *inode)
 {
        struct fuse_inode *fi = get_fuse_inode(inode);
-       if (S_ISREG(inode->i_mode) && !is_bad_inode(inode)) {
-               WARN_ON(!list_empty(&fi->write_files));
-               WARN_ON(!list_empty(&fi->queued_writes));
-       }
+
        mutex_destroy(&fi->mutex);
        kfree(fi->forget);
-       call_rcu(&inode->i_rcu, fuse_i_callback);
+       kmem_cache_free(fuse_inode_cachep, fi);
 }
 
 static void fuse_evict_inode(struct inode *inode)
 {
+       struct fuse_inode *fi = get_fuse_inode(inode);
+
        truncate_inode_pages_final(&inode->i_data);
        clear_inode(inode);
        if (inode->i_sb->s_flags & SB_ACTIVE) {
                struct fuse_conn *fc = get_fuse_conn(inode);
-               struct fuse_inode *fi = get_fuse_inode(inode);
                fuse_queue_forget(fc, fi->forget, fi->nodeid, fi->nlookup);
                fi->forget = NULL;
        }
+       if (S_ISREG(inode->i_mode) && !is_bad_inode(inode)) {
+               WARN_ON(!list_empty(&fi->write_files));
+               WARN_ON(!list_empty(&fi->queued_writes));
+       }
 }
 
 static int fuse_remount_fs(struct super_block *sb, int *flags, char *data)
@@ -814,7 +810,7 @@ static const struct export_operations fuse_export_operations = {
 
 static const struct super_operations fuse_super_operations = {
        .alloc_inode    = fuse_alloc_inode,
-       .destroy_inode  = fuse_destroy_inode,
+       .free_inode     = fuse_free_inode,
        .evict_inode    = fuse_evict_inode,
        .write_inode    = fuse_write_inode,
        .drop_inode     = generic_delete_inode,