Currently, O_DIRECT writes in a hole or outside the 'i_size' was not actually honored, while using a buffered io instead.
It hurts/cheats the 'O_DIRECT' semantics somehow, users may be confusing about the data lost after a crash when performing the odirect append writes. A straightforward way is to flush the pagecache like O_SYNC did to guarantee the real touch to disk before writes get returned. Signed-off-by: Tristan Ye <[email protected]> --- fs/ocfs2/file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 2b10b36..97b41f8 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -2321,7 +2321,7 @@ out_dio: 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) -- 1.5.5 _______________________________________________ Ocfs2-devel mailing list [email protected] http://oss.oracle.com/mailman/listinfo/ocfs2-devel
