aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorAnand Jain2015-08-14 18:32:51 +0800
committerDavid Sterba2015-09-29 16:29:59 +0200
commit92fc03fbdcbe2523be3f7e6b8e95fee9563a10d2 (patch)
treeec5f318ad04cf4e55581e0a5987eac02b6810c4d /fs/btrfs/volumes.c
parentc1b7e474595b1b3a4463450cc22aa18b926093a3 (diff)
Btrfs: SB read failure should return EIO for __bread failure
This will return EIO when __bread() fails to read SB, instead of EINVAL. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 643879208f05..e8a618261218 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -211,8 +211,8 @@ btrfs_get_bdev_and_sb(const char *device_path, fmode_t flags, void *holder,
}
invalidate_bdev(*bdev);
*bh = btrfs_read_dev_super(*bdev);
- if (!*bh) {
- ret = -EINVAL;
+ if (IS_ERR(*bh)) {
+ ret = PTR_ERR(*bh);
blkdev_put(*bdev, flags);
goto error;
}
@@ -6746,8 +6746,8 @@ int btrfs_scratch_superblock(struct btrfs_device *device)
struct btrfs_super_block *disk_super;
bh = btrfs_read_dev_super(device->bdev);
- if (!bh)
- return -EINVAL;
+ if (IS_ERR(bh))
+ return PTR_ERR(bh);
disk_super = (struct btrfs_super_block *)bh->b_data;
memset(&disk_super->magic, 0, sizeof(disk_super->magic));