Skip to content

Commit

Permalink
ext4: honor O_(D)SYNC semantic in ext4_fallocate()
Browse files Browse the repository at this point in the history
Ext4 must make sure the transaction to be commited to the disk when
user opens a file with O_(D)SYNC flag and do a fallocate(2) call.

This problem had been reported by Christoph Hellwig in this thread:
http://www.spinics.net/lists/linux-btrfs/msg13621.html

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Zheng Liu authored and Theodore Ts'o committed Jun 30, 2012
1 parent 1c8457c commit f4e95b3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -4420,6 +4420,8 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
ext4_falloc_update_inode(inode, mode, new_size,
(map.m_flags & EXT4_MAP_NEW));
ext4_mark_inode_dirty(handle, inode);
if ((file->f_flags & O_SYNC) && ret >= max_blocks)
ext4_handle_sync(handle);
ret2 = ext4_journal_stop(handle);
if (ret2)
break;
Expand Down

0 comments on commit f4e95b3

Please sign in to comment.