/[packages]/cauldron/kernel-rt/current/SOURCES/ext4-fix-unjournaled-inode-bitmap-modification.patch
ViewVC logotype

Contents of /cauldron/kernel-rt/current/SOURCES/ext4-fix-unjournaled-inode-bitmap-modification.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 312037 - (show annotations) (download)
Thu Nov 1 11:26:08 2012 UTC (8 years, 10 months ago) by tmb
File size: 3142 byte(s)
- ext4: fix unjournaled inode bitmap modification
  (P200, fixes possible data corruption bug)
- md/raid1: Fix assembling of arrays containing Replacements
  (P201, fixes reduced data safety)
- net: add new QCA alx ethernet driver (P250, P251)


1 From ffb5387e85d528fb6d0d924abfa3fbf0fc484071 Mon Sep 17 00:00:00 2001
2 From: Eric Sandeen <sandeen@redhat.com>
3 Date: Sun, 28 Oct 2012 22:24:57 -0400
4 Subject: ext4: fix unjournaled inode bitmap modification
5
6 From: Eric Sandeen <sandeen@redhat.com>
7
8 commit ffb5387e85d528fb6d0d924abfa3fbf0fc484071 upstream.
9
10 commit 119c0d4460b001e44b41dcf73dc6ee794b98bd31 changed
11 ext4_new_inode() such that the inode bitmap was being modified
12 outside a transaction, which could lead to corruption, and was
13 discovered when journal_checksum found a bad checksum in the
14 journal during log replay.
15
16 Nix ran into this when using the journal_async_commit mount
17 option, which enables journal checksumming. The ensuing
18 journal replay failures due to the bad checksums led to
19 filesystem corruption reported as the now infamous
20 "Apparent serious progressive ext4 data corruption bug"
21
22 [ Changed by tytso to only call ext4_journal_get_write_access() only
23 when we're fairly certain that we're going to allocate the inode. ]
24
25 I've tested this by mounting with journal_checksum and
26 running fsstress then dropping power; I've also tested by
27 hacking DM to create snapshots w/o first quiescing, which
28 allows me to test journal replay repeatedly w/o actually
29 power-cycling the box. Without the patch I hit a journal
30 checksum error every time. With this fix it survives
31 many iterations.
32
33 Reported-by: Nix <nix@esperi.org.uk>
34 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
35 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
36 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
37
38 ---
39 fs/ext4/ialloc.c | 19 +++++++++----------
40 1 file changed, 9 insertions(+), 10 deletions(-)
41
42 --- a/fs/ext4/ialloc.c
43 +++ b/fs/ext4/ialloc.c
44 @@ -716,6 +716,10 @@ repeat_in_this_group:
45 "inode=%lu", ino + 1);
46 continue;
47 }
48 + BUFFER_TRACE(inode_bitmap_bh, "get_write_access");
49 + err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
50 + if (err)
51 + goto fail;
52 ext4_lock_group(sb, group);
53 ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data);
54 ext4_unlock_group(sb, group);
55 @@ -729,6 +733,11 @@ repeat_in_this_group:
56 goto out;
57
58 got:
59 + BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
60 + err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);
61 + if (err)
62 + goto fail;
63 +
64 /* We may have to initialize the block bitmap if it isn't already */
65 if (ext4_has_group_desc_csum(sb) &&
66 gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
67 @@ -762,11 +771,6 @@ got:
68 goto fail;
69 }
70
71 - BUFFER_TRACE(inode_bitmap_bh, "get_write_access");
72 - err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
73 - if (err)
74 - goto fail;
75 -
76 BUFFER_TRACE(group_desc_bh, "get_write_access");
77 err = ext4_journal_get_write_access(handle, group_desc_bh);
78 if (err)
79 @@ -814,11 +818,6 @@ got:
80 }
81 ext4_unlock_group(sb, group);
82
83 - BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
84 - err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);
85 - if (err)
86 - goto fail;
87 -
88 BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata");
89 err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh);
90 if (err)

  ViewVC Help
Powered by ViewVC 1.1.28