Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297889
b: refs/heads/master
c: fcd1f06
h: refs/heads/master
i:
  297887: fa6a72d
v: v3
  • Loading branch information
David Sterba authored and Chris Mason committed Mar 29, 2012
1 parent b02c2e9 commit a7aa540
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 914b20070b413ca10f832c45a58b2894990f065f
refs/heads/master: fcd1f065daca593badb7f99d473639cf3b551795
23 changes: 18 additions & 5 deletions trunk/fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
static struct extent_io_ops btree_extent_io_ops;
static void end_workqueue_fn(struct btrfs_work *work);
static void free_fs_root(struct btrfs_root *root);
static void btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
int read_only);
static void btrfs_destroy_ordered_operations(struct btrfs_root *root);
static void btrfs_destroy_ordered_extents(struct btrfs_root *root);
Expand Down Expand Up @@ -2135,7 +2135,12 @@ int open_ctree(struct super_block *sb,
/* check FS state, whether FS is broken. */
fs_info->fs_state |= btrfs_super_flags(disk_super);

btrfs_check_super_valid(fs_info, sb->s_flags & MS_RDONLY);
ret = btrfs_check_super_valid(fs_info, sb->s_flags & MS_RDONLY);
if (ret) {
printk(KERN_ERR "btrfs: superblock contains fatal errors\n");
err = ret;
goto fail_alloc;
}

/*
* run through our array of backup supers and setup
Expand Down Expand Up @@ -3324,15 +3329,23 @@ static int btree_lock_page_hook(struct page *page, void *data,
return 0;
}

static void btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
int read_only)
{
if (btrfs_super_csum_type(fs_info->super_copy) >= ARRAY_SIZE(btrfs_csum_sizes)) {
printk(KERN_ERR "btrfs: unsupported checksum algorithm\n");
return -EINVAL;
}

if (read_only)
return;
return 0;

if (fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)
if (fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) {
printk(KERN_WARNING "warning: mount fs with errors, "
"running btrfsck is recommended\n");
}

return 0;
}

int btrfs_error_commit_super(struct btrfs_root *root)
Expand Down

0 comments on commit a7aa540

Please sign in to comment.