Skip to content

Commit

Permalink
Btrfs: close devices on all error paths in open_ctree()
Browse files Browse the repository at this point in the history
Fix a bug introduced by 7e66285 where we would leave devices busy on
certain error paths in open_ctree().  fs_info is guaranteed to be
non-NULL now so it's safe to dereference it on all error paths.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
Ilya Dryomov committed Nov 9, 2011
1 parent 4d34b27 commit 586e46e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2460,21 +2460,20 @@ struct btrfs_root *open_ctree(struct super_block *sb,
btrfs_stop_workers(&fs_info->caching_workers);
fail_alloc:
fail_iput:
btrfs_mapping_tree_free(&fs_info->mapping_tree);

invalidate_inode_pages2(fs_info->btree_inode->i_mapping);
iput(fs_info->btree_inode);

btrfs_close_devices(fs_info->fs_devices);
btrfs_mapping_tree_free(&fs_info->mapping_tree);
fail_bdi:
bdi_destroy(&fs_info->bdi);
fail_srcu:
cleanup_srcu_struct(&fs_info->subvol_srcu);
fail:
btrfs_close_devices(fs_info->fs_devices);
free_fs_info(fs_info);
return ERR_PTR(err);

recovery_tree_root:

if (!btrfs_test_opt(tree_root, RECOVERY))
goto fail_tree_roots;

Expand Down

0 comments on commit 586e46e

Please sign in to comment.