]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fail to mount if we have problems reading the block groups
authorJosef Bacik <josef@redhat.com>
Fri, 19 Mar 2010 20:49:55 +0000 (20:49 +0000)
committerChris Mason <chris.mason@oracle.com>
Wed, 31 Mar 2010 01:19:09 +0000 (21:19 -0400)
commit54a355b4e7b0d4ba412211f1c6620a6101644e59
treed662fe7e7d9ddec1214982b3dcd955228e18562f
parent28590cd35d9e1cf315430baa1b83a2bd950aafb5
Btrfs: fail to mount if we have problems reading the block groups

We don't actually check the return value of btrfs_read_block_groups, so we can
possibly succeed to mount, but then fail to say read the superblock xattr for
selinux which will cause the vfs code to deactivate the super.

This is a problem because in find_free_extent we just assume that we
will find the right space_info for the allocation we want.  But if we
failed to read the block groups, we won't have setup any space_info's,
and we'll hit a NULL pointer deref in find_free_extent.

This patch fixes that problem by checking the return value of
btrfs_read_block_groups, and failing out properly.  I've also added a
check in find_free_extent so if for some reason we don't find an
appropriate space_info, we just return -ENOSPC.

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c