mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 01:09:38 -05:00
ext4: fix mmap write protection for data=journal mode
Commitafb585a97f
"ext4: data=journal: write-protect pages on j_submit_inode_data_buffers()") added calls ext4_jbd2_inode_add_write() to track inode ranges whose mappings need to get write-protected during transaction commits. However the added calls use wrong start of a range (0 instead of page offset) and so write protection is not necessarily effective. Use correct range start to fix the problem. Fixes:afb585a97f
("ext4: data=journal: write-protect pages on j_submit_inode_data_buffers()") Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20201027132751.29858-1-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
ea4b01d9b8
commit
b5b18160a3
1 changed files with 3 additions and 2 deletions
|
@ -1918,7 +1918,7 @@ static int __ext4_journalled_writepage(struct page *page,
|
||||||
}
|
}
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = err;
|
ret = err;
|
||||||
err = ext4_jbd2_inode_add_write(handle, inode, 0, len);
|
err = ext4_jbd2_inode_add_write(handle, inode, page_offset(page), len);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = err;
|
ret = err;
|
||||||
EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid;
|
EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid;
|
||||||
|
@ -6159,7 +6159,8 @@ retry_alloc:
|
||||||
if (ext4_walk_page_buffers(handle, page_buffers(page),
|
if (ext4_walk_page_buffers(handle, page_buffers(page),
|
||||||
0, len, NULL, write_end_fn))
|
0, len, NULL, write_end_fn))
|
||||||
goto out_error;
|
goto out_error;
|
||||||
if (ext4_jbd2_inode_add_write(handle, inode, 0, len))
|
if (ext4_jbd2_inode_add_write(handle, inode,
|
||||||
|
page_offset(page), len))
|
||||||
goto out_error;
|
goto out_error;
|
||||||
ext4_set_inode_state(inode, EXT4_STATE_JDATA);
|
ext4_set_inode_state(inode, EXT4_STATE_JDATA);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue