diff options
-rw-r--r-- | fs/ext3/inode.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 436e5bbccbc2..001eb0e2d48e 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1149,9 +1149,25 @@ static int walk_page_buffers( handle_t *handle, | |||
1149 | static int do_journal_get_write_access(handle_t *handle, | 1149 | static int do_journal_get_write_access(handle_t *handle, |
1150 | struct buffer_head *bh) | 1150 | struct buffer_head *bh) |
1151 | { | 1151 | { |
1152 | int dirty = buffer_dirty(bh); | ||
1153 | int ret; | ||
1154 | |||
1152 | if (!buffer_mapped(bh) || buffer_freed(bh)) | 1155 | if (!buffer_mapped(bh) || buffer_freed(bh)) |
1153 | return 0; | 1156 | return 0; |
1154 | return ext3_journal_get_write_access(handle, bh); | 1157 | /* |
1158 | * __block_prepare_write() could have dirtied some buffers. Clean | ||
1159 | * the dirty bit as jbd2_journal_get_write_access() could complain | ||
1160 | * otherwise about fs integrity issues. Setting of the dirty bit | ||
1161 | * by __block_prepare_write() isn't a real problem here as we clear | ||
1162 | * the bit before releasing a page lock and thus writeback cannot | ||
1163 | * ever write the buffer. | ||
1164 | */ | ||
1165 | if (dirty) | ||
1166 | clear_buffer_dirty(bh); | ||
1167 | ret = ext3_journal_get_write_access(handle, bh); | ||
1168 | if (!ret && dirty) | ||
1169 | ret = ext3_journal_dirty_metadata(handle, bh); | ||
1170 | return ret; | ||
1155 | } | 1171 | } |
1156 | 1172 | ||
1157 | /* | 1173 | /* |