1 Since we could skip corrupt block groups, this patch
2 use ext4_warning() intead of ext4_error() to make FS not
3 emount RO in default, also fix a leftover from upstream
4 commit 163a203ddb36c36d4a1c942
6 fs/ext4/balloc.c | 6 +++---
7 fs/ext4/ialloc.c | 8 ++++----
8 fs/ext4/mballoc.c | 13 ++++++++++---
9 3 files changed, 17 insertions(+), 10 deletions(-)
11 Index: linux-3.12.44-52.18/fs/ext4/balloc.c
12 ===================================================================
13 --- linux-3.12.44-52.18.orig/fs/ext4/balloc.c
14 +++ linux-3.12.44-52.18/fs/ext4/balloc.c
15 @@ -364,7 +364,7 @@ void ext4_validate_block_bitmap(struct s
16 blk = ext4_valid_block_bitmap(sb, desc, block_group, bh);
17 if (unlikely(blk != 0)) {
18 ext4_unlock_group(sb, block_group);
19 - ext4_error(sb, "bg %u: block %llu: invalid block bitmap",
20 + ext4_warning(sb, "bg %u: block %llu: invalid block bitmap",
22 set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
24 @@ -372,7 +372,7 @@ void ext4_validate_block_bitmap(struct s
25 if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
27 ext4_unlock_group(sb, block_group);
28 - ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
29 + ext4_warning(sb, "bg %u: bad block bitmap checksum", block_group);
30 set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
33 Index: linux-3.12.44-52.18/fs/ext4/ialloc.c
34 ===================================================================
35 --- linux-3.12.44-52.18.orig/fs/ext4/ialloc.c
36 +++ linux-3.12.44-52.18/fs/ext4/ialloc.c
37 @@ -76,7 +76,7 @@ static unsigned ext4_init_inode_bitmap(s
38 /* If checksum is bad mark all blocks and inodes use to prevent
39 * allocation, essentially implementing a per-group read-only flag. */
40 if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) {
41 - ext4_error(sb, "Checksum bad for group %u", block_group);
42 + ext4_warning(sb, "Checksum bad for group %u", block_group);
43 grp = ext4_get_group_info(sb, block_group);
44 set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
45 set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state);
46 @@ -182,8 +182,8 @@ verify:
47 EXT4_INODES_PER_GROUP(sb) / 8)) {
48 ext4_unlock_group(sb, block_group);
50 - ext4_error(sb, "Corrupt inode bitmap - block_group = %u, "
51 - "inode_bitmap = %llu", block_group, bitmap_blk);
52 + ext4_warning(sb, "Corrupt inode bitmap - block_group = %u, "
53 + "inode_bitmap = %llu", block_group, bitmap_blk);
54 grp = ext4_get_group_info(sb, block_group);
55 set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state);
57 @@ -320,7 +320,7 @@ out:
61 - ext4_error(sb, "bit already cleared for inode %lu", ino);
62 + ext4_warning(sb, "bit already cleared for inode %lu", ino);
63 set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state);
66 Index: linux-3.12.44-52.18/fs/ext4/mballoc.c
67 ===================================================================
68 --- linux-3.12.44-52.18.orig/fs/ext4/mballoc.c
69 +++ linux-3.12.44-52.18/fs/ext4/mballoc.c
70 @@ -752,11 +752,18 @@ int ext4_mb_generate_buddy(struct super_
71 if (free != grp->bb_free) {
72 struct ext4_group_desc *gdp;
73 gdp = ext4_get_group_desc(sb, group, NULL);
74 - ext4_error(sb, "group %lu: %u blocks in bitmap, %u in bb, "
75 - "%u in gd, %lu pa's\n", (long unsigned int)group,
76 + ext4_warning(sb, "group %lu: %u blocks in bitmap, %u in bb, "
77 + "%u in gd, %lu pa's block bitmap corrupt",
78 + (long unsigned int)group,
79 free, grp->bb_free, ext4_free_group_clusters(sb, gdp),
83 + * If we intend to continue, we consider group descriptor
84 + * corrupt and update bb_free using bitmap value
86 + grp->bb_free = free;
87 + set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
90 mb_set_largest_free_order(sb, grp);