Skip to content

Commit

Permalink
Btrfs: close all bdevs on mount failure
Browse files Browse the repository at this point in the history
Fix a bug introduced by 20b4507.  We have to return EINVAL on mount
failure, but doing that too early in the sequence leaves all of the
devices opened exclusively.  This also fixes an issue where under some
scenarios only a second mount -o degraded <devices> command would
succeed.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
Ilya Dryomov authored and David Sterba committed Oct 20, 2011
1 parent 5f52444 commit 20bcd64
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,8 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
set_blocksize(bdev, 4096);

bh = btrfs_read_dev_super(bdev);
if (!bh) {
ret = -EINVAL;
if (!bh)
goto error_close;
}

disk_super = (struct btrfs_super_block *)bh->b_data;
devid = btrfs_stack_device_id(&disk_super->dev_item);
Expand Down Expand Up @@ -655,7 +653,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
continue;
}
if (fs_devices->open_devices == 0) {
ret = -EIO;
ret = -EINVAL;
goto out;
}
fs_devices->seeding = seeding;
Expand Down

0 comments on commit 20bcd64

Please sign in to comment.