diff options
| -rw-r--r-- | fs/ext4/inode.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 981a1fc30eaa..250c2df04a92 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -684,6 +684,21 @@ out_sem: | |||
| 684 | ret = check_block_validity(inode, map); | 684 | ret = check_block_validity(inode, map); |
| 685 | if (ret != 0) | 685 | if (ret != 0) |
| 686 | return ret; | 686 | return ret; |
| 687 | |||
| 688 | /* | ||
| 689 | * Inodes with freshly allocated blocks where contents will be | ||
| 690 | * visible after transaction commit must be on transaction's | ||
| 691 | * ordered data list. | ||
| 692 | */ | ||
| 693 | if (map->m_flags & EXT4_MAP_NEW && | ||
| 694 | !(map->m_flags & EXT4_MAP_UNWRITTEN) && | ||
| 695 | !(flags & EXT4_GET_BLOCKS_ZERO) && | ||
| 696 | !IS_NOQUOTA(inode) && | ||
| 697 | ext4_should_order_data(inode)) { | ||
| 698 | ret = ext4_jbd2_file_inode(handle, inode); | ||
| 699 | if (ret) | ||
| 700 | return ret; | ||
| 701 | } | ||
| 687 | } | 702 | } |
| 688 | return retval; | 703 | return retval; |
| 689 | } | 704 | } |
| @@ -1289,15 +1304,6 @@ static int ext4_write_end(struct file *file, | |||
| 1289 | int i_size_changed = 0; | 1304 | int i_size_changed = 0; |
| 1290 | 1305 | ||
| 1291 | trace_ext4_write_end(inode, pos, len, copied); | 1306 | trace_ext4_write_end(inode, pos, len, copied); |
| 1292 | if (ext4_test_inode_state(inode, EXT4_STATE_ORDERED_MODE)) { | ||
| 1293 | ret = ext4_jbd2_file_inode(handle, inode); | ||
| 1294 | if (ret) { | ||
| 1295 | unlock_page(page); | ||
| 1296 | put_page(page); | ||
| 1297 | goto errout; | ||
| 1298 | } | ||
| 1299 | } | ||
| 1300 | |||
| 1301 | if (ext4_has_inline_data(inode)) { | 1307 | if (ext4_has_inline_data(inode)) { |
| 1302 | ret = ext4_write_inline_data_end(inode, pos, len, | 1308 | ret = ext4_write_inline_data_end(inode, pos, len, |
| 1303 | copied, page); | 1309 | copied, page); |
