Skip to content

Commit

Permalink
btrfs: Sector Size check during Mount
Browse files Browse the repository at this point in the history
Gracefully fail when trying to mount a BTRFS file system that has a
sectorsize smaller than PAGE_SIZE.

On PPC it is possible to build a FS while using a 4k PAGE_SIZE kernel
then boot into a 64K PAGE_SIZE kernel.  Presently open_ctree fails in an
endless loop and hangs the machine in this situation.

My debugging has show this Sector size < Page size to be a non trivial
situation and a graceful exit from the situation would be nice for the
time being.

Signed-off-by: Keith Mannthey <kmannth@us.ibm.com>
  • Loading branch information
Keith Mannthey authored and David Sterba committed Feb 15, 2012
1 parent d98456f commit 941b2dd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2258,6 +2258,12 @@ struct btrfs_root *open_ctree(struct super_block *sb,
goto fail_sb_buffer;
}

if (sectorsize < PAGE_SIZE) {
printk(KERN_WARNING "btrfs: Incompatible sector size "
"found 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 941b2dd

Please sign in to comment.