aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/hypfs/inode.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 341aff2687a5..cd128b07beda 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -288,46 +288,30 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
288 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 288 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
289 sb->s_magic = HYPFS_MAGIC; 289 sb->s_magic = HYPFS_MAGIC;
290 sb->s_op = &hypfs_s_ops; 290 sb->s_op = &hypfs_s_ops;
291 if (hypfs_parse_options(data, sb)) { 291 if (hypfs_parse_options(data, sb))
292 rc = -EINVAL; 292 return -EINVAL;
293 goto err_alloc;
294 }
295 root_inode = hypfs_make_inode(sb, S_IFDIR | 0755); 293 root_inode = hypfs_make_inode(sb, S_IFDIR | 0755);
296 if (!root_inode) { 294 if (!root_inode)
297 rc = -ENOMEM; 295 return -ENOMEM;
298 goto err_alloc;
299 }
300 root_inode->i_op = &simple_dir_inode_operations; 296 root_inode->i_op = &simple_dir_inode_operations;
301 root_inode->i_fop = &simple_dir_operations; 297 root_inode->i_fop = &simple_dir_operations;
302 root_dentry = d_alloc_root(root_inode); 298 sb->s_root = root_dentry = d_alloc_root(root_inode);
303 if (!root_dentry) { 299 if (!root_dentry) {
304 iput(root_inode); 300 iput(root_inode);
305 rc = -ENOMEM; 301 return -ENOMEM;
306 goto err_alloc;
307 } 302 }
308 if (MACHINE_IS_VM) 303 if (MACHINE_IS_VM)
309 rc = hypfs_vm_create_files(sb, root_dentry); 304 rc = hypfs_vm_create_files(sb, root_dentry);
310 else 305 else
311 rc = hypfs_diag_create_files(sb, root_dentry); 306 rc = hypfs_diag_create_files(sb, root_dentry);
312 if (rc) 307 if (rc)
313 goto err_tree; 308 return rc;
314 sbi->update_file = hypfs_create_update_file(sb, root_dentry); 309 sbi->update_file = hypfs_create_update_file(sb, root_dentry);
315 if (IS_ERR(sbi->update_file)) { 310 if (IS_ERR(sbi->update_file))
316 rc = PTR_ERR(sbi->update_file); 311 return PTR_ERR(sbi->update_file);
317 goto err_tree;
318 }
319 hypfs_update_update(sb); 312 hypfs_update_update(sb);
320 sb->s_root = root_dentry;
321 pr_info("Hypervisor filesystem mounted\n"); 313 pr_info("Hypervisor filesystem mounted\n");
322 return 0; 314 return 0;
323
324err_tree:
325 hypfs_delete_tree(root_dentry);
326 d_genocide(root_dentry);
327 dput(root_dentry);
328err_alloc:
329 kfree(sbi);
330 return rc;
331} 315}
332 316
333static int hypfs_get_super(struct file_system_type *fst, int flags, 317static int hypfs_get_super(struct file_system_type *fst, int flags,
@@ -340,12 +324,12 @@ static void hypfs_kill_super(struct super_block *sb)
340{ 324{
341 struct hypfs_sb_info *sb_info = sb->s_fs_info; 325 struct hypfs_sb_info *sb_info = sb->s_fs_info;
342 326
343 if (sb->s_root) { 327 if (sb->s_root)
344 hypfs_delete_tree(sb->s_root); 328 hypfs_delete_tree(sb->s_root);
329 if (sb_info->update_file)
345 hypfs_remove(sb_info->update_file); 330 hypfs_remove(sb_info->update_file);
346 kfree(sb->s_fs_info); 331 kfree(sb->s_fs_info);
347 sb->s_fs_info = NULL; 332 sb->s_fs_info = NULL;
348 }
349 kill_litter_super(sb); 333 kill_litter_super(sb);
350} 334}
351 335