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
6 commit 73b50c1c92666d326b5fa2c945d46509f2f6d91f upstream (as of v2.6.33-git11)
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
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.
17 Addresses-Google-Bug: #2404870
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>
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(-)
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,
37 mark_buffer_dirty_inode(bh, inode);
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,
53 @@ -5158,7 +5158,7 @@ static int ext4_do_update_inode(handle_t
54 EXT4_FEATURE_RO_COMPAT_LARGE_FILE);
56 ext4_handle_sync(handle);
57 - err = ext4_handle_dirty_metadata(handle, inode,
58 + err = ext4_handle_dirty_metadata(handle, NULL,
62 @@ -5187,7 +5187,7 @@ static int ext4_do_update_inode(handle_t
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);
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);
74 err = ext4_handle_dirty_metadata(handle,
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);
91 @@ -2096,7 +2096,7 @@ int ext4_orphan_del(handle_t *handle, st
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);
98 struct ext4_iloc iloc2;
99 struct inode *i_prev =