btrfs: disallow unequal data/metadata blocksize for mixed block groups
authorDavid Sterba <dsterba@suse.cz>
Fri, 17 Feb 2012 11:26:09 +0000 (12:26 +0100)
committerChris Mason <chris.mason@oracle.com>
Thu, 29 Mar 2012 00:30:28 +0000 (20:30 -0400)
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>
fs/btrfs/disk-io.c

index 38c2ee1ca0d5dba1dc89e248a4c318e737353480..fe087847c8e75b05721bc7bbeb195e30ec1a5b54 100644 (file)
@@ -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);