diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-02-15 13:48:21 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-02-15 13:48:21 -0500 |
commit | e56eb6590693a5a340e8f596db2768a6e1b9e236 (patch) | |
tree | 0fccb796503d6296b36f343be70ad35c0fba2d7c /fs | |
parent | 9df5643ad135c7f8c02d3b69020de4ec910f9fc0 (diff) |
ext4: Don't claim block from group which has corrupt bitmap
In ext4_mb_complex_scan_group, if the extent length of the newly
found extentet is greater than than the total free blocks counted
in group info, break without claiming the block.
Document different ext4_error usage, explaining the state with which we
continue if we mount with errors=continue
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/mballoc.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 2121184a3fa5..6968c53e62ad 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -967,6 +967,10 @@ static void ext4_mb_generate_buddy(struct super_block *sb, | |||
967 | ext4_error(sb, __FUNCTION__, | 967 | ext4_error(sb, __FUNCTION__, |
968 | "EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n", | 968 | "EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n", |
969 | group, free, grp->bb_free); | 969 | group, free, grp->bb_free); |
970 | /* | ||
971 | * If we intent to continue, we consider group descritor | ||
972 | * corrupt and update bb_free using bitmap value | ||
973 | */ | ||
970 | grp->bb_free = free; | 974 | grp->bb_free = free; |
971 | } | 975 | } |
972 | 976 | ||
@@ -1822,7 +1826,7 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, | |||
1822 | EXT4_BLOCKS_PER_GROUP(sb), i); | 1826 | EXT4_BLOCKS_PER_GROUP(sb), i); |
1823 | if (i >= EXT4_BLOCKS_PER_GROUP(sb)) { | 1827 | if (i >= EXT4_BLOCKS_PER_GROUP(sb)) { |
1824 | /* | 1828 | /* |
1825 | * IF we corrupt the bitmap we won't find any | 1829 | * IF we have corrupt bitmap, we won't find any |
1826 | * free blocks even though group info says we | 1830 | * free blocks even though group info says we |
1827 | * we have free blocks | 1831 | * we have free blocks |
1828 | */ | 1832 | */ |
@@ -1838,6 +1842,12 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, | |||
1838 | ext4_error(sb, __FUNCTION__, "%d free blocks as per " | 1842 | ext4_error(sb, __FUNCTION__, "%d free blocks as per " |
1839 | "group info. But got %d blocks\n", | 1843 | "group info. But got %d blocks\n", |
1840 | free, ex.fe_len); | 1844 | free, ex.fe_len); |
1845 | /* | ||
1846 | * The number of free blocks differs. This mostly | ||
1847 | * indicate that the bitmap is corrupt. So exit | ||
1848 | * without claiming the space. | ||
1849 | */ | ||
1850 | break; | ||
1841 | } | 1851 | } |
1842 | 1852 | ||
1843 | ext4_mb_measure_extent(ac, &ex, e4b); | 1853 | ext4_mb_measure_extent(ac, &ex, e4b); |
@@ -3771,6 +3781,10 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, | |||
3771 | (unsigned long) pa->pa_len); | 3781 | (unsigned long) pa->pa_len); |
3772 | ext4_error(sb, __FUNCTION__, "free %u, pa_free %u\n", | 3782 | ext4_error(sb, __FUNCTION__, "free %u, pa_free %u\n", |
3773 | free, pa->pa_free); | 3783 | free, pa->pa_free); |
3784 | /* | ||
3785 | * pa is already deleted so we use the value obtained | ||
3786 | * from the bitmap and continue. | ||
3787 | */ | ||
3774 | } | 3788 | } |
3775 | atomic_add(free, &sbi->s_mb_discarded); | 3789 | atomic_add(free, &sbi->s_mb_discarded); |
3776 | if (ac) | 3790 | if (ac) |