Commit e58ca020 authored by Yan's avatar Yan Committed by Chris Mason

Fix btrfs_fill_super to return -EINVAL when no FS found

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 63b10fc4
...@@ -728,9 +728,8 @@ struct btrfs_root *open_ctree(struct super_block *sb, ...@@ -728,9 +728,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
struct btrfs_root *dev_root = kmalloc(sizeof(struct btrfs_root), struct btrfs_root *dev_root = kmalloc(sizeof(struct btrfs_root),
GFP_NOFS); GFP_NOFS);
int ret; int ret;
int err = -EIO; int err = -EINVAL;
struct btrfs_super_block *disk_super; struct btrfs_super_block *disk_super;
if (!extent_root || !tree_root || !fs_info) { if (!extent_root || !tree_root || !fs_info) {
err = -ENOMEM; err = -ENOMEM;
goto fail; goto fail;
......
...@@ -236,9 +236,9 @@ static int btrfs_fill_super(struct super_block * sb, ...@@ -236,9 +236,9 @@ static int btrfs_fill_super(struct super_block * sb,
tree_root = open_ctree(sb, fs_devices); tree_root = open_ctree(sb, fs_devices);
if (!tree_root || IS_ERR(tree_root)) { if (IS_ERR(tree_root)) {
printk("btrfs: open_ctree failed\n"); printk("btrfs: open_ctree failed\n");
return -EIO; return PTR_ERR(tree_root);
} }
sb->s_fs_info = tree_root; sb->s_fs_info = tree_root;
disk_super = &tree_root->fs_info->super_copy; disk_super = &tree_root->fs_info->super_copy;
......
...@@ -237,7 +237,7 @@ int btrfs_scan_one_device(const char *path, int flags, void *holder, ...@@ -237,7 +237,7 @@ int btrfs_scan_one_device(const char *path, int flags, void *holder,
if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC, if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
sizeof(disk_super->magic))) { sizeof(disk_super->magic))) {
printk("no btrfs found on %s\n", path); printk("no btrfs found on %s\n", path);
ret = -ENOENT; ret = -EINVAL;
goto error_brelse; goto error_brelse;
} }
devid = le64_to_cpu(disk_super->dev_item.devid); devid = le64_to_cpu(disk_super->dev_item.devid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment