]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Fix btrfs_fill_super to return -EINVAL when no FS found
authorYan <yanzheng@21cn.com>
Tue, 1 Apr 2008 15:21:34 +0000 (11:21 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:01 +0000 (11:04 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/disk-io.c
fs/btrfs/super.c
fs/btrfs/volumes.c

index 709e33d08bb5486fb2a9d5801e9b4bcf5d77a903..5547607681f4147c44e8faf94511a0d8bd012d5b 100644 (file)
@@ -728,9 +728,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        struct btrfs_root *dev_root = kmalloc(sizeof(struct btrfs_root),
                                              GFP_NOFS);
        int ret;
-       int err = -EIO;
+       int err = -EINVAL;
        struct btrfs_super_block *disk_super;
-
        if (!extent_root || !tree_root || !fs_info) {
                err = -ENOMEM;
                goto fail;
index 9624923a33dc03f8006988d3f63aa72d49ff90f8..892864906880e0442cd1f8d49eac06426892b864 100644 (file)
@@ -236,9 +236,9 @@ static int btrfs_fill_super(struct super_block * sb,
 
        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");
-               return -EIO;
+               return PTR_ERR(tree_root);
        }
        sb->s_fs_info = tree_root;
        disk_super = &tree_root->fs_info->super_copy;
index d8fce32a3bbc3b35d8529f95fee25d344ef054a0..169be0f7285b56331065dd0ef09341de4d95eec4 100644 (file)
@@ -237,7 +237,7 @@ int btrfs_scan_one_device(const char *path, int flags, void *holder,
        if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
            sizeof(disk_super->magic))) {
                printk("no btrfs found on %s\n", path);
-               ret = -ENOENT;
+               ret = -EINVAL;
                goto error_brelse;
        }
        devid = le64_to_cpu(disk_super->dev_item.devid);