linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] ext4: make sure O_(D)SYNC semantic in ext4_fallocate()
@ 2012-01-16  8:47 Zheng Liu
  2012-05-23  1:19 ` Zheng Liu
  2012-06-14  0:15 ` Ted Ts'o
  0 siblings, 2 replies; 4+ messages in thread
From: Zheng Liu @ 2012-01-16  8:47 UTC (permalink / raw)
  To: linux-ext4; +Cc: Zheng Liu, Theodore Ts'o

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

CC: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 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 74f23c2..00e32d9 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4356,6 +4356,8 @@ retry:
 			ret = PTR_ERR(handle);
 			break;
 		}
+		if (file->f_flags & O_SYNC)
+			ext4_handle_sync(handle);
 		ret = ext4_map_blocks(handle, inode, &map, flags);
 		if (ret <= 0) {
 #ifdef EXT4FS_DEBUG
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-14  2:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-16  8:47 [PATCH RESEND] ext4: make sure O_(D)SYNC semantic in ext4_fallocate() Zheng Liu
2012-05-23  1:19 ` Zheng Liu
2012-06-14  0:15 ` Ted Ts'o
2012-06-14  2:43   ` Zheng Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).