1 ext4: fix initialization of UNINIT bitmap blocks
3 From: Frederic Bohe <frederic.bohe@bull.net>
5 We must always initialize uninitialized bitmap blocks even if the
6 buffer head is marked uptodate, since it could have been read in by a
7 userspace program. So always initialized the bitmap block if it is
8 marked uninitialzied and not dirty; it will marked initialized as soon
9 as we allocate a block or inode out of that bitmap.
11 Signed-off-by: Frederic Bohe <frederic.bohe@bull.net>
12 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
18 3 files changed, 9 insertions(+), 3 deletions(-)
20 Index: linux-2.6.27-rc5+patch_queue/fs/ext4/balloc.c
21 ===================================================================
22 --- linux-2.6.27-rc5+patch_queue.orig/fs/ext4/balloc.c 2008-09-15 10:59:27.000000000 +0200
23 +++ linux-2.6.27-rc5+patch_queue/fs/ext4/balloc.c 2008-09-15 14:03:04.000000000 +0200
24 @@ -318,9 +318,11 @@ ext4_read_block_bitmap(struct super_bloc
25 block_group, bitmap_blk);
28 - if (bh_uptodate_or_lock(bh))
29 + if (buffer_uptodate(bh) &&
30 + !(desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)))
34 spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group));
35 if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
36 ext4_init_block_bitmap(sb, bh, block_group, desc);
37 Index: linux-2.6.27-rc5+patch_queue/fs/ext4/ialloc.c
38 ===================================================================
39 --- linux-2.6.27-rc5+patch_queue.orig/fs/ext4/ialloc.c 2008-09-15 10:59:27.000000000 +0200
40 +++ linux-2.6.27-rc5+patch_queue/fs/ext4/ialloc.c 2008-09-15 11:12:16.000000000 +0200
41 @@ -115,9 +115,11 @@ ext4_read_inode_bitmap(struct super_bloc
42 block_group, bitmap_blk);
45 - if (bh_uptodate_or_lock(bh))
46 + if (buffer_uptodate(bh) &&
47 + !(desc->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)))
51 spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group));
52 if (desc->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
53 ext4_init_inode_bitmap(sb, bh, block_group, desc);
54 Index: linux-2.6.27-rc5+patch_queue/fs/ext4/mballoc.c
55 ===================================================================
56 --- linux-2.6.27-rc5+patch_queue.orig/fs/ext4/mballoc.c 2008-09-15 10:59:27.000000000 +0200
57 +++ linux-2.6.27-rc5+patch_queue/fs/ext4/mballoc.c 2008-09-15 14:02:44.000000000 +0200
58 @@ -785,9 +785,11 @@ static int ext4_mb_init_cache(struct pag
62 - if (bh_uptodate_or_lock(bh[i]))
63 + if (buffer_uptodate(bh[i]) &&
64 + !(desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)))
68 spin_lock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
69 if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
70 ext4_init_block_bitmap(sb, bh[i],
75 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
76 the body of a message to majordomo@vger.kernel.org
77 More majordomo info at http://vger.kernel.org/majordomo-info.html