Skip to content

Commit

Permalink
btrfs: disallow unequal data/metadata blocksize for mixed block groups
Browse files Browse the repository at this point in the history
With support for bigger metadata blocks, we must avoid mounting a
filesystem with different block size for mixed block groups, this causes
corruption (found by xfstests/083).

Signed-off-by: David Sterba <dsterba@suse.cz>
  • Loading branch information
David Sterba authored and Chris Mason committed Mar 29, 2012
1 parent fcd1f06 commit 65139ed
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2302,6 +2302,14 @@ int open_ctree(struct super_block *sb,
goto fail_sb_buffer;
}

if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) &&
(leafsize != nodesize || sectorsize != nodesize)) {
printk(KERN_WARNING "btrfs: unequal leaf/node/sector sizes "
"are not allowed for mixed block groups on %s\n",
sb->s_id);
goto fail_sb_buffer;
}

mutex_lock(&fs_info->chunk_mutex);
ret = btrfs_read_sys_array(tree_root);
mutex_unlock(&fs_info->chunk_mutex);
Expand Down

0 comments on commit 65139ed

Please sign in to comment.