aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurt Wohlgemuth <curtw@google.com>2010-02-16 15:06:29 -0500
committerTheodore Ts'o <tytso@mit.edu>2010-02-16 15:06:29 -0500
commit73b50c1c92666d326b5fa2c945d46509f2f6d91f (patch)
tree87e2cc6fed3259a83364ede33d8f4d68173f8175
parentba869023eac8354b17acdcff82b851ea8e7b1809 (diff)
ext4: Fix BUG_ON at fs/buffer.c:652 in no journal mode
Calls to ext4_handle_dirty_metadata should only pass in an inode pointer for inode-specific metadata, and not for shared metadata blocks such as inode table blocks, block group descriptors, the superblock, etc. The BUG_ON can get tripped when updating a special device (such as a block device) that is opened (so that i_mapping is set in fs/block_dev.c) and the file system is mounted in no journal mode. Addresses-Google-Bug: #2404870 Signed-off-by: Curt Wohlgemuth <curtw@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/ext4_jbd2.c2
-rw-r--r--fs/ext4/ialloc.c2
-rw-r--r--fs/ext4/inode.c6
-rw-r--r--fs/ext4/namei.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 2f407c487e6b..53d2764d71ca 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -125,7 +125,7 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
125 ext4_journal_abort_handle(where, __func__, bh, 125 ext4_journal_abort_handle(where, __func__, bh,
126 handle, err); 126 handle, err);
127 } else { 127 } else {
128 if (inode && bh) 128 if (inode)
129 mark_buffer_dirty_inode(bh, inode); 129 mark_buffer_dirty_inode(bh, inode);
130 else 130 else
131 mark_buffer_dirty(bh); 131 mark_buffer_dirty(bh);
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index e4aaf619b56d..004c9da9e5c6 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -898,7 +898,7 @@ repeat_in_this_group:
898 BUFFER_TRACE(inode_bitmap_bh, 898 BUFFER_TRACE(inode_bitmap_bh,
899 "call ext4_handle_dirty_metadata"); 899 "call ext4_handle_dirty_metadata");
900 err = ext4_handle_dirty_metadata(handle, 900 err = ext4_handle_dirty_metadata(handle,
901 inode, 901 NULL,
902 inode_bitmap_bh); 902 inode_bitmap_bh);
903 if (err) 903 if (err)
904 goto fail; 904 goto fail;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 536067bcf75b..ecac8c5a6f5c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5120,7 +5120,7 @@ static int ext4_do_update_inode(handle_t *handle,
5120 EXT4_FEATURE_RO_COMPAT_LARGE_FILE); 5120 EXT4_FEATURE_RO_COMPAT_LARGE_FILE);
5121 sb->s_dirt = 1; 5121 sb->s_dirt = 1;
5122 ext4_handle_sync(handle); 5122 ext4_handle_sync(handle);
5123 err = ext4_handle_dirty_metadata(handle, inode, 5123 err = ext4_handle_dirty_metadata(handle, NULL,
5124 EXT4_SB(sb)->s_sbh); 5124 EXT4_SB(sb)->s_sbh);
5125 } 5125 }
5126 } 5126 }
@@ -5149,7 +5149,7 @@ static int ext4_do_update_inode(handle_t *handle,
5149 } 5149 }
5150 5150
5151 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); 5151 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
5152 rc = ext4_handle_dirty_metadata(handle, inode, bh); 5152 rc = ext4_handle_dirty_metadata(handle, NULL, bh);
5153 if (!err) 5153 if (!err)
5154 err = rc; 5154 err = rc;
5155 ext4_clear_inode_state(inode, EXT4_STATE_NEW); 5155 ext4_clear_inode_state(inode, EXT4_STATE_NEW);
@@ -5701,7 +5701,7 @@ static int ext4_pin_inode(handle_t *handle, struct inode *inode)
5701 err = jbd2_journal_get_write_access(handle, iloc.bh); 5701 err = jbd2_journal_get_write_access(handle, iloc.bh);
5702 if (!err) 5702 if (!err)
5703 err = ext4_handle_dirty_metadata(handle, 5703 err = ext4_handle_dirty_metadata(handle,
5704 inode, 5704 NULL,
5705 iloc.bh); 5705 iloc.bh);
5706 brelse(iloc.bh); 5706 brelse(iloc.bh);
5707 } 5707 }
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index bd2dc0b71c8c..a13948f8242f 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2017,7 +2017,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)
2017 /* Insert this inode at the head of the on-disk orphan list... */ 2017 /* Insert this inode at the head of the on-disk orphan list... */
2018 NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan); 2018 NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan);
2019 EXT4_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino); 2019 EXT4_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
2020 err = ext4_handle_dirty_metadata(handle, inode, EXT4_SB(sb)->s_sbh); 2020 err = ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);
2021 rc = ext4_mark_iloc_dirty(handle, inode, &iloc); 2021 rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
2022 if (!err) 2022 if (!err)
2023 err = rc; 2023 err = rc;
@@ -2089,7 +2089,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
2089 if (err) 2089 if (err)
2090 goto out_brelse; 2090 goto out_brelse;
2091 sbi->s_es->s_last_orphan = cpu_to_le32(ino_next); 2091 sbi->s_es->s_last_orphan = cpu_to_le32(ino_next);
2092 err = ext4_handle_dirty_metadata(handle, inode, sbi->s_sbh); 2092 err = ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh);
2093 } else { 2093 } else {
2094 struct ext4_iloc iloc2; 2094 struct ext4_iloc iloc2;
2095 struct inode *i_prev = 2095 struct inode *i_prev =