summaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs_nfs.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-06-27 00:54:58 +0200
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-07-06 01:08:01 +0200
commit2e18d4d822ea9cc811ea26a880cf2ed47cbf8889 (patch)
tree1ce746bef1598990b96f6f5b4e0c11017a3c9ee7 /fs/nfs/pnfs_nfs.c
parentpNFS/flexfiles: Clean up calls to pnfs_set_layoutcommit() (diff)
downloadlinux-2e18d4d822ea9cc811ea26a880cf2ed47cbf8889.tar.xz
linux-2e18d4d822ea9cc811ea26a880cf2ed47cbf8889.zip
pNFS: Files and flexfiles always need to commit before layoutcommit
So ensure that we mark the layout for commit once the write is done, and then ensure that the commit to ds is finished before sending layoutcommit. Note that by doing this, we're able to optimise away the commit for the case of servers that don't need layoutcommit in order to return updated attributes. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs_nfs.c')
-rw-r--r--fs/nfs/pnfs_nfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c
index 0dfc476da3e1..0d10cc280a23 100644
--- a/fs/nfs/pnfs_nfs.c
+++ b/fs/nfs/pnfs_nfs.c
@@ -932,6 +932,13 @@ EXPORT_SYMBOL_GPL(pnfs_layout_mark_request_commit);
int
pnfs_nfs_generic_sync(struct inode *inode, bool datasync)
{
+ int ret;
+
+ if (!pnfs_layoutcommit_outstanding(inode))
+ return 0;
+ ret = nfs_commit_inode(inode, FLUSH_SYNC);
+ if (ret < 0)
+ return ret;
if (datasync)
return 0;
return pnfs_layoutcommit_inode(inode, true);