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>
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 6959cb7..28228f3 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -281,6 +281,7 @@
 
 	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)