提交 81c8c82b 编写于 作者: T Tristan Ye 提交者: Tao Ma

Ocfs2: Fix a regression bug from mainline commit(6b933c8e).

The patch is to fix the regression bug brought from commit 6b933c8e...( 'ocfs2:
Avoid direct write if we fall back to buffered I/O'):

http://oss.oracle.com/bugzilla/show_bug.cgi?id=1285

The commit 6b933c8e changed __generic_file_aio_write
to generic_file_buffered_write, which didn't call filemap_{write,wait}_range to  flush
the pagecaches when we were falling O_DIRECT writes back to buffered ones. it did hurt
the O_DIRECT semantics somehow in extented odirect writes.

This patch tries to guarantee O_DIRECT writes of 'fall back to buffered' to be correctly
flushed.
Signed-off-by: NTristan Ye <tristan.ye@oracle.com>
Signed-off-by: NTao Ma <tao.ma@oracle.com>
上级 9b4c0ff3
......@@ -2338,7 +2338,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) ||
((file->f_flags & O_DIRECT) && has_refcount)) {
((file->f_flags & O_DIRECT) && !direct_io)) {
ret = filemap_fdatawrite_range(file->f_mapping, pos,
pos + count - 1);
if (ret < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册