]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/hostfs/hostfs_kern.c
fs: icache RCU free inodes
[mirror_ubuntu-bionic-kernel.git] / fs / hostfs / hostfs_kern.c
index cd7c93917cc7c29636ee7c87a8846177e4098d23..861113fcfc88ca3b366254a5adf1c7b1859a57fb 100644 (file)
@@ -32,7 +32,7 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode)
 
 #define FILE_HOSTFS_I(file) HOSTFS_I((file)->f_path.dentry->d_inode)
 
-static int hostfs_d_delete(struct dentry *dentry)
+static int hostfs_d_delete(const struct dentry *dentry)
 {
        return 1;
 }
@@ -92,12 +92,10 @@ __uml_setup("hostfs=", hostfs_args,
 
 static char *__dentry_name(struct dentry *dentry, char *name)
 {
-       char *p = __dentry_path(dentry, name, PATH_MAX);
+       char *p = dentry_path_raw(dentry, name, PATH_MAX);
        char *root;
        size_t len;
 
-       spin_unlock(&dcache_lock);
-
        root = dentry->d_sb->s_fs_info;
        len = strlen(root);
        if (IS_ERR(p)) {
@@ -123,25 +121,23 @@ static char *dentry_name(struct dentry *dentry)
        if (!name)
                return NULL;
 
-       spin_lock(&dcache_lock);
        return __dentry_name(dentry, name); /* will unlock */
 }
 
 static char *inode_name(struct inode *ino)
 {
        struct dentry *dentry;
-       char *name = __getname();
-       if (!name)
-               return NULL;
+       char *name;
 
-       spin_lock(&dcache_lock);
-       if (list_empty(&ino->i_dentry)) {
-               spin_unlock(&dcache_lock);
-               __putname(name);
+       dentry = d_find_alias(ino);
+       if (!dentry)
                return NULL;
-       }
-       dentry = list_first_entry(&ino->i_dentry, struct dentry, d_alias);
-       return __dentry_name(dentry, name); /* will unlock */
+
+       name = dentry_name(dentry);
+
+       dput(dentry);
+
+       return name;
 }
 
 static char *follow_link(char *link)
@@ -251,11 +247,18 @@ static void hostfs_evict_inode(struct inode *inode)
        }
 }
 
-static void hostfs_destroy_inode(struct inode *inode)
+static void hostfs_i_callback(struct rcu_head *head)
 {
+       struct inode *inode = container_of(head, struct inode, i_rcu);
+       INIT_LIST_HEAD(&inode->i_dentry);
        kfree(HOSTFS_I(inode));
 }
 
+static void hostfs_destroy_inode(struct inode *inode)
+{
+       call_rcu(&inode->i_rcu, hostfs_i_callback);
+}
+
 static int hostfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
 {
        const char *root_path = vfs->mnt_sb->s_fs_info;
@@ -962,11 +965,11 @@ out:
        return err;
 }
 
-static int hostfs_read_sb(struct file_system_type *type,
+static struct dentry *hostfs_read_sb(struct file_system_type *type,
                          int flags, const char *dev_name,
-                         void *data, struct vfsmount *mnt)
+                         void *data)
 {
-       return get_sb_nodev(type, flags, data, hostfs_fill_sb_common, mnt);
+       return mount_nodev(type, flags, data, hostfs_fill_sb_common);
 }
 
 static void hostfs_kill_sb(struct super_block *s)
@@ -978,7 +981,7 @@ static void hostfs_kill_sb(struct super_block *s)
 static struct file_system_type hostfs_type = {
        .owner          = THIS_MODULE,
        .name           = "hostfs",
-       .get_sb         = hostfs_read_sb,
+       .mount          = hostfs_read_sb,
        .kill_sb        = hostfs_kill_sb,
        .fs_flags       = 0,
 };