Skip to content

Commit

Permalink
ext4: Call ext4_jbd2_file_inode() after zeroing block
Browse files Browse the repository at this point in the history
In data=ordered mode we should call ext4_jbd2_file_inode() so that crash
after the truncate transaction has committed does not expose stall data
in the tail of the block.

Thanks Jan Kara for pointing that out.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Lukas Czerner authored and Theodore Ts'o committed May 28, 2013
1 parent d863dc3 commit 0713ed0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3681,8 +3681,11 @@ int ext4_block_zero_page_range(handle_t *handle,
err = 0;
if (ext4_should_journal_data(inode)) {
err = ext4_handle_dirty_metadata(handle, inode, bh);
} else
} else {
mark_buffer_dirty(bh);
if (ext4_test_inode_state(inode, EXT4_STATE_ORDERED_MODE))
err = ext4_jbd2_file_inode(handle, inode);
}

unlock:
unlock_page(page);
Expand Down

0 comments on commit 0713ed0

Please sign in to comment.