add patch fix-ocfs2-corrupt-when-updating-journal-superblock-fails
[ext4-patch-queue.git] / try-to-initialize-all-groups-we-can-in-case-of-failure-on-ppc64
blob5cb03551ee452b9a0c97270207dda63c50d92abf
1 ext4: try to initialize all groups we can in case of failure on ppc64
3 From: Lukas Czerner <lczerner@redhat.com>
5 Currently on the machines with page size > block size when initializing
6 block group buddy cache we initialize it for all the block group bitmaps
7 in the page. However in the case of read error, checksum error, or if
8 a single bitmap is in any way corrupted we would fail to initialize all
9 of the bitmaps. This is problematic because we will not have access to
10 the other allocation groups even though those might be perfectly fine
11 and usable.
13 Fix this by reading all the bitmaps instead of error out on the first
14 problem and simply skip the bitmaps which were either not read properly,
15 or are not valid.
17 Signed-off-by: Lukas Czerner <lczerner@redhat.com>
18 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
19 ---
20 v2: remove unnecessary else in condition
21 v3: nothing changed
23  fs/ext4/mballoc.c | 9 ++++++---
24  1 file changed, 6 insertions(+), 3 deletions(-)
26 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
27 index 8d1e602..df02951 100644
28 --- a/fs/ext4/mballoc.c
29 +++ b/fs/ext4/mballoc.c
30 @@ -882,10 +882,8 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
32         /* wait for I/O completion */
33         for (i = 0, group = first_group; i < groups_per_page; i++, group++) {
34 -               if (bh[i] && ext4_wait_block_bitmap(sb, group, bh[i])) {
35 +               if (bh[i] && ext4_wait_block_bitmap(sb, group, bh[i]))
36                         err = -EIO;
37 -                       goto out;
38 -               }
39         }
41         first_block = page->index * blocks_per_page;
42 @@ -898,6 +896,11 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
43                         /* skip initialized uptodate buddy */
44                         continue;
46 +               if (!buffer_verified(bh[group - first_group]))
47 +                       /* Skip faulty bitmaps */
48 +                       continue;
49 +               err = 0;
51                 /*
52                  * data carry information regarding this
53                  * particular group in the format specified
54 -- 
55 1.8.3.1
58 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
59 the body of a message to majordomo@vger.kernel.org
60 More majordomo info at  http://vger.kernel.org/majordomo-info.html