From a0815d556d1cfb686b46995f86fb081f623fa720 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust@primarydata.com>
Date: Wed, 25 Mar 2015 18:58:53 -0400
Subject: NFSv4.1/pnfs: Ensure that writes respect the O_SYNC flag when doing
 O_DIRECT

If the caller does not specify the O_SYNC flag, then it is legitimate
to return from O_DIRECT without doing a pNFS layoutcommit operation.
However if the file is opened O_DIRECT|O_SYNC then we'd better get it
right.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/file.c | 1 +
 1 file changed, 1 insertion(+)

(limited to 'fs/nfs/file.c')

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 6959cb76744b..28228f381266 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -281,6 +281,7 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 
 	trace_nfs_fsync_enter(inode);
 
+	nfs_inode_dio_wait(inode);
 	do {
 		ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
 		if (ret != 0)
-- 
cgit v1.2.1