diff options
author | Zheng Liu <gnehzuil.liu@gmail.com> | 2012-06-30 19:12:57 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-06-30 19:12:57 -0400 |
commit | f4e95b3316c4daa43224753bb98f41456fef86c7 (patch) | |
tree | 29bce2b6f2dc86433f9615a1a6a8628840ad680d /fs/ext4 | |
parent | 1c8457cadc9cefe7ec920a2f3537ff1fe20f4061 (diff) | |
download | lwn-f4e95b3316c4daa43224753bb98f41456fef86c7.tar.gz lwn-f4e95b3316c4daa43224753bb98f41456fef86c7.zip |
ext4: honor O_(D)SYNC semantic in ext4_fallocate()
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>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/extents.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 91341ec6e06a..f1089cba913a 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4420,6 +4420,8 @@ retry: 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; |