]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.17/0014-ext4-Fix-BUG_ON-at-fs-buffer.c-652-in-no-journal-mod.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.17 / 0014-ext4-Fix-BUG_ON-at-fs-buffer.c-652-in-no-journal-mod.patch
1 From 04cbf99a9333c66de2474429c01e13d110aa5fd0 Mon Sep 17 00:00:00 2001
2 From: Curt Wohlgemuth <curtw@google.com>
3 Date: Sun, 30 May 2010 22:49:28 -0400
4 Subject: ext4: Fix BUG_ON at fs/buffer.c:652 in no journal mode
5
6 commit 73b50c1c92666d326b5fa2c945d46509f2f6d91f upstream (as of v2.6.33-git11)
7
8 Calls to ext4_handle_dirty_metadata should only pass in an inode
9 pointer for inode-specific metadata, and not for shared metadata
10 blocks such as inode table blocks, block group descriptors, the
11 superblock, etc.
12
13 The BUG_ON can get tripped when updating a special device (such as a
14 block device) that is opened (so that i_mapping is set in
15 fs/block_dev.c) and the file system is mounted in no journal mode.
16
17 Addresses-Google-Bug: #2404870
18
19 Signed-off-by: Curt Wohlgemuth <curtw@google.com>
20 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22 ---
23 fs/ext4/ext4_jbd2.c | 2 +-
24 fs/ext4/ialloc.c | 2 +-
25 fs/ext4/inode.c | 6 +++---
26 fs/ext4/namei.c | 4 ++--
27 4 files changed, 7 insertions(+), 7 deletions(-)
28
29 --- a/fs/ext4/ext4_jbd2.c
30 +++ b/fs/ext4/ext4_jbd2.c
31 @@ -89,7 +89,7 @@ int __ext4_handle_dirty_metadata(const c
32 ext4_journal_abort_handle(where, __func__, bh,
33 handle, err);
34 } else {
35 - if (inode && bh)
36 + if (inode)
37 mark_buffer_dirty_inode(bh, inode);
38 else
39 mark_buffer_dirty(bh);
40 --- a/fs/ext4/ialloc.c
41 +++ b/fs/ext4/ialloc.c
42 @@ -904,7 +904,7 @@ repeat_in_this_group:
43 BUFFER_TRACE(inode_bitmap_bh,
44 "call ext4_handle_dirty_metadata");
45 err = ext4_handle_dirty_metadata(handle,
46 - inode,
47 + NULL,
48 inode_bitmap_bh);
49 if (err)
50 goto fail;
51 --- a/fs/ext4/inode.c
52 +++ b/fs/ext4/inode.c
53 @@ -5158,7 +5158,7 @@ static int ext4_do_update_inode(handle_t
54 EXT4_FEATURE_RO_COMPAT_LARGE_FILE);
55 sb->s_dirt = 1;
56 ext4_handle_sync(handle);
57 - err = ext4_handle_dirty_metadata(handle, inode,
58 + err = ext4_handle_dirty_metadata(handle, NULL,
59 EXT4_SB(sb)->s_sbh);
60 }
61 }
62 @@ -5187,7 +5187,7 @@ static int ext4_do_update_inode(handle_t
63 }
64
65 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
66 - rc = ext4_handle_dirty_metadata(handle, inode, bh);
67 + rc = ext4_handle_dirty_metadata(handle, NULL, bh);
68 if (!err)
69 err = rc;
70 ext4_clear_inode_state(inode, EXT4_STATE_NEW);
71 @@ -5741,7 +5741,7 @@ static int ext4_pin_inode(handle_t *hand
72 err = jbd2_journal_get_write_access(handle, iloc.bh);
73 if (!err)
74 err = ext4_handle_dirty_metadata(handle,
75 - inode,
76 + NULL,
77 iloc.bh);
78 brelse(iloc.bh);
79 }
80 --- a/fs/ext4/namei.c
81 +++ b/fs/ext4/namei.c
82 @@ -2024,7 +2024,7 @@ int ext4_orphan_add(handle_t *handle, st
83 /* Insert this inode at the head of the on-disk orphan list... */
84 NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan);
85 EXT4_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
86 - err = ext4_handle_dirty_metadata(handle, inode, EXT4_SB(sb)->s_sbh);
87 + err = ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);
88 rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
89 if (!err)
90 err = rc;
91 @@ -2096,7 +2096,7 @@ int ext4_orphan_del(handle_t *handle, st
92 if (err)
93 goto out_brelse;
94 sbi->s_es->s_last_orphan = cpu_to_le32(ino_next);
95 - err = ext4_handle_dirty_metadata(handle, inode, sbi->s_sbh);
96 + err = ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh);
97 } else {
98 struct ext4_iloc iloc2;
99 struct inode *i_prev =